// Set the value, Expects HIGH or LOW
347968
func (op *DTGPIOModuleOpenPin) gpioSetValue(value int) error {
	if op.valueFile == nil {
		fmt.Printf("value file no set\n")
		return errors.New("value file is not defined")
	}

	// Seek the start of the value file before writing. This is sufficient for the driver to accept a new value.
	_, e := op.valueFile.Seek(0, 0)
	if e != nil {
		return e
	}

	// Write a 1 or 0.
	// @todo investigate if we'd get better performance if we have precalculated []byte values with 0 and 1, and
	// use write directly instead of WriteString. Probably only marginal.
	// @todo also check out http://hackaday.com/2013/12/07/speeding-up-beaglebone-black-gpio-a-thousand-times/
	if value == 0 {
		op.valueFile.WriteString("0")
	} else {
		op.valueFile.WriteString("1")
	}

	return nil
}
99807
func (a MultiStatsClient) Set(name string, value string, rate float64) {
	for _, c := range a {
		c.Set(name, value, rate)
	}
}
188283
func (rkv *KeyValue) Set(key, value string) error {
	conn := rkv.pool.Get(rkv.dbindex)
	_, err := conn.Do("SET", rkv.id+":"+key, value)
	return err
}
98807
func (sa *StringsValue) Set(s string) error {
	*sa = append(*sa, s)
	return nil
}
702360
func (s *ShlexOpt) Set(value string) error {
	valueSlice, err := shlex.Split(value)
	*s = ShlexOpt(valueSlice)
	return err
}
681473
func (f *Int64Slice) Set(value string) error {
	tmp, err := strconv.ParseInt(value, 10, 64)
	if err != nil {
		return err
	}
	*f = append(*f, tmp)
	return nil
}
6210
func (c *PCPCounterVector) Set(val int64, instance string) error {
	c.mutex.Lock()
	defer c.mutex.Unlock()

	v, err := c.valInstance(instance)
	if err != nil {
		return err
	}

	if val < v.(int64) {
		return errors.Errorf("cannot set instance %s to a lesser value %v", instance, val)
	}

	return c.setInstance(val, instance)
}
363137
func (value *StringMapValue) Set(v string) error {
	dict := make(map[string]string)
	pairs := parseListWithEscapes(v, ',')
	for _, pair := range pairs {
		parts := strings.SplitN(pair, ":", 2)
		dict[parts[0]] = parts[1]
	}
	*value = dict
	return nil
}
299157
func (s *NoopClient) Set(stat string, value string, rate float32) error {
	return nil
}
125734
func (v *String) Set(value string) {
	v.mu.Lock()
	v.s = value
	v.mu.Unlock()
}
1191133
func (ref *Reference) Set(value interface{}) error {
	buf := bytes.NewBuffer([]byte{})
	err := json.NewEncoder(buf).Encode(value)
	if err != nil {
		return err
	}
	_, err = ref.invokeRequest(http.MethodPut, buf)
	if err != nil {
		return err
	}
	return nil
}
495252
func (s *StreamName) Set(value string) error {
	v := StreamName(value)
	if err := v.Validate(); err != nil {
		return err
	}
	*s = v
	return nil
}
178962
func (i *Int) Set(value int) {
	i.lock.Lock()
	defer i.lock.Unlock()
	i.increment = value
}
97278
func (s *Value) Set(str string) error {
	if len(str) == 0 {
		return fmt.Errorf("invalid size %q", str)
	}

	start, end := 0, len(str)
	if str[0] == '+' {
		s.ExplicitSign = Positive
		start++
	} else if str[0] == '-' {
		s.ExplicitSign = Negative
		start++
	}

	for i, r := range str[start:] {
		if unicode.IsLetter(r) {
			end = start + i
			break
		}
	}

	value, err := strconv.ParseInt(str[:end], 10, 64)
	if err != nil {
		return fmt.Errorf("could not convert %q to size: %v", str, err)
	}

	unitName := str[end:]
	mult, ok := s.unit.mapping[unitName]
	if !ok {
		if len(unitName) != 0 {
			return fmt.Errorf("unit %q is not valid", unitName)
		}
		mult = 1
	}
	s.Value = value * mult
	s.IsSet = true
	return nil
}
740309
func (s *Scale) SetValue(v float64) *Scale {
	s.Value = &v
	return s
}
1155015
func (c *Context) Set(key string, value interface{}) {
	c.data[key] = value
}
713220
func (opt *WeightdeviceOpt) Set(val string) error {
	var value *blkiodev.WeightDevice
	if opt.validator != nil {
		v, err := opt.validator(val)
		if err != nil {
			return err
		}
		value = v
	}
	(opt.values) = append((opt.values), value)
	return nil
}