// Global returns a global pointer as defined in a module. It returns a pointer to the memory in the device.
775525
func (m Module) Global(name string) (DevicePtr, int64, error) {
	var d C.CUdeviceptr
	var size C.size_t
	cstr := C.CString(name)
	defer C.free(unsafe.Pointer(cstr))
	if err := result(C.cuModuleGetGlobal(&d, &size, m.mod, cstr)); err != nil {
		return 0, 0, err
	}
	return DevicePtr(d), int64(size), nil
}
46809
func (c *Callbacks) OnCDOTAUserMsg_GlobalLightDirection(fn func(*dota.CDOTAUserMsg_GlobalLightDirection) error) {
	c.onCDOTAUserMsg_GlobalLightDirection = append(c.onCDOTAUserMsg_GlobalLightDirection, fn)
}
924743
func (ctx *Context) PushGlobalGoFunction(name string, f interface{}) (int, error) {
	return ctx.Context.PushGlobalGoFunction(name, ctx.wrapFunction(f))
}
516368
func (m *enumerator) Current() ([]byte, int, uint64) {
	var i int
	var v uint64
	if m.lowCurr < len(m.lowIdxs) {
		i = m.lowIdxs[m.lowCurr]
		v = m.currVs[i]
	}
	return m.lowK, i, v
}
697439
func ValidateGlobal(obj *Global) error {
	collections.globalMutex.Lock()
	defer collections.globalMutex.Unlock()

	// Validate key is correct
	keyStr := obj.Name
	if obj.Key != keyStr {
		log.Errorf("Expecting Global Key: %s. Got: %s", keyStr, obj.Key)
		return errors.New("Invalid Key")
	}

	// Validate each field

	if len(obj.ArpMode) > 64 {
		return errors.New("arpMode string too long")
	}

	arpModeMatch := regexp.MustCompile("^(proxy|flood)?$")
	if arpModeMatch.MatchString(obj.ArpMode) == false {
		return errors.New("arpMode string invalid format")
	}

	if len(obj.FwdMode) > 64 {
		return errors.New("fwdMode string too long")
	}

	fwdModeMatch := regexp.MustCompile("^(bridge|routing)?$")
	if fwdModeMatch.MatchString(obj.FwdMode) == false {
		return errors.New("fwdMode string invalid format")
	}

	if len(obj.Name) > 64 {
		return errors.New("name string too long")
	}

	nameMatch := regexp.MustCompile("^(global)$")
	if nameMatch.MatchString(obj.Name) == false {
		return errors.New("name string invalid format")
	}

	if len(obj.NetworkInfraType) > 64 {
		return errors.New("networkInfraType string too long")
	}

	networkInfraTypeMatch := regexp.MustCompile("^(aci|aci-opflex|default)?$")
	if networkInfraTypeMatch.MatchString(obj.NetworkInfraType) == false {
		return errors.New("networkInfraType string invalid format")
	}

	pvtSubnetMatch := regexp.MustCompile("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})/16$")
	if pvtSubnetMatch.MatchString(obj.PvtSubnet) == false {
		return errors.New("pvtSubnet string invalid format")
	}

	vlansMatch := regexp.MustCompile("^([0-9]{1,4}?-[0-9]{1,4}?)$")
	if vlansMatch.MatchString(obj.Vlans) == false {
		return errors.New("vlans string invalid format")
	}

	vxlansMatch := regexp.MustCompile("^([0-9]{1,8}?-[0-9]{1,8}?)$")
	if vxlansMatch.MatchString(obj.Vxlans) == false {
		return errors.New("vxlans string invalid format")
	}

	return nil
}
1178099
func CreateGlobal(obj *Global) error {
	// Validate parameters
	err := ValidateGlobal(obj)
	if err != nil {
		log.Errorf("ValidateGlobal retruned error for: %+v. Err: %v", obj, err)
		return err
	}

	// Check if we handle this object
	if objCallbackHandler.GlobalCb == nil {
		log.Errorf("No callback registered for global object")
		return errors.New("Invalid object type")
	}

	saveObj := obj

	collections.globalMutex.Lock()
	key := collections.globals[obj.Key]
	collections.globalMutex.Unlock()

	// Check if object already exists
	if key != nil {
		// Perform Update callback
		err = objCallbackHandler.GlobalCb.GlobalUpdate(collections.globals[obj.Key], obj)
		if err != nil {
			log.Errorf("GlobalUpdate retruned error for: %+v. Err: %v", obj, err)
			return err
		}

		// save the original object after update
		collections.globalMutex.Lock()
		saveObj = collections.globals[obj.Key]
		collections.globalMutex.Unlock()
	} else {
		// save it in cache
		collections.globalMutex.Lock()
		collections.globals[obj.Key] = obj
		collections.globalMutex.Unlock()

		// Perform Create callback
		err = objCallbackHandler.GlobalCb.GlobalCreate(obj)
		if err != nil {
			log.Errorf("GlobalCreate retruned error for: %+v. Err: %v", obj, err)
			collections.globalMutex.Lock()
			delete(collections.globals, obj.Key)
			collections.globalMutex.Unlock()
			return err
		}
	}

	// Write it to modeldb
	collections.globalMutex.Lock()
	err = saveObj.Write()
	collections.globalMutex.Unlock()
	if err != nil {
		log.Errorf("Error saving global %s to db. Err: %v", saveObj.Key, err)
		return err
	}

	return nil
}
305676
func FindGlobal(key string) *Global {
	collections.globalMutex.Lock()
	defer collections.globalMutex.Unlock()

	obj := collections.globals[key]
	if obj == nil {
		return nil
	}

	return obj
}
66259
func (m *GlobalPositionInt) Pack() []byte {
	data := new(bytes.Buffer)
	binary.Write(data, binary.LittleEndian, m.TIME_BOOT_MS)
	binary.Write(data, binary.LittleEndian, m.LAT)
	binary.Write(data, binary.LittleEndian, m.LON)
	binary.Write(data, binary.LittleEndian, m.ALT)
	binary.Write(data, binary.LittleEndian, m.RELATIVE_ALT)
	binary.Write(data, binary.LittleEndian, m.VX)
	binary.Write(data, binary.LittleEndian, m.VY)
	binary.Write(data, binary.LittleEndian, m.VZ)
	binary.Write(data, binary.LittleEndian, m.HDG)
	return data.Bytes()
}
1100847
func (c *Configuration) FindGlobal(key string) string {
	output, _ := c.gitConfig("--global", key)
	return output
}
815377
func getGlobalInfo() (globalInfo map[string]interface{}) {
	globalInfo = map[string]interface{}{
		"isDistXL":         globalIsDistXL,
		"isXL":             globalIsXL,
		"isBrowserEnabled": globalIsBrowserEnabled,
		"isWorm":           globalWORMEnabled,
		"isEnvBrowser":     globalIsEnvBrowser,
		"isEnvCreds":       globalIsEnvCreds,
		"isEnvRegion":      globalIsEnvRegion,
		"isSSL":            globalIsSSL,
		"serverRegion":     globalServerRegion,
		// Add more relevant global settings here.
	}

	return globalInfo
}
295185
func (c *Context) GlobalInt(name string) int {
	return lookupInt(name, c.globalSet)
}
30182
func (c Config) GetGlobal(option GlobalOption) (string, error) {
	if globals, ok := c[Globals]; ok {
		if settings, ok := globals.(map[GlobalOption]string); ok {
			if value, ok := settings[option]; ok {
				return value, nil
			}
			return "", fmt.Errorf("global setting for %s not found", option)
		}
	}
	return "", fmt.Errorf("no global config options found")

}
1215156
func GlobalMongoRegistry() *MongoRegistry {
	mongoRegistryOnce.Do(func() {
		mongoRegistry = new(MongoRegistry)
		mongoRegistry.builders = make(map[string]BSONBuilder)
	})
	return mongoRegistry
}
932426
func (c *Context) GlobalFloat64(name string) float64 {
	if fs := lookupGlobalFlagSet(name, c); fs != nil {
		return lookupFloat64(name, fs)
	}
	return 0
}
1226287
func (c *Context) GlobalInt(name string) int {
	if fs := lookupGlobalFlagSet(name, c); fs != nil {
		return lookupInt(name, fs)
	}
	return 0
}
222347
func (s *State) RunGlobalCallbacks(ctx context.Context) {
	for _, cb := range s.GlobalCallbacks() {
		cb.Callback(ctx)
	}
}
840599
func (c *Context) GlobalStringSlice(name string) []string {
	return lookupStringSlice(name, c.globalSet)
}