// IndirectValue returns the reflect.Value that "v" points to.
// If "v" is a nil pointer, Indirect returns a zero Value.
// If "v" is not a pointer, Indirect returns v.
507176
func IndirectValue(v reflect.Value) reflect.Value {
	if k := v.Kind(); k == reflect.Ptr { //|| k == reflect.Interface {
		return v.Elem()
	}
	return v
}
483442
func (b *NestedBlock) EmptyValue() cty.Value {
	switch b.Nesting {
	case NestingSingle:
		return cty.NullVal(b.Block.ImpliedType())
	case NestingGroup:
		return b.Block.EmptyValue()
	case NestingList:
		if ty := b.Block.ImpliedType(); ty.HasDynamicTypes() {
			return cty.EmptyTupleVal
		} else {
			return cty.ListValEmpty(ty)
		}
	case NestingMap:
		if ty := b.Block.ImpliedType(); ty.HasDynamicTypes() {
			return cty.EmptyObjectVal
		} else {
			return cty.MapValEmpty(ty)
		}
	case NestingSet:
		return cty.SetValEmpty(b.Block.ImpliedType())
	default:
		// Should never get here because the above is intended to be exhaustive,
		// but we'll be robust and return a result nonetheless.
		return cty.NullVal(cty.DynamicPseudoType)
	}
}
1012076
func (p *Parameter) DefaultValue(stringRepresentation string) *Parameter {
	p.data.DefaultValue = stringRepresentation
	return p
}
317515
func indirectType(typ reflect.Type) reflect.Type {
	if typ.Kind() == reflect.Ptr {
		return typ.Elem()
	}
	return typ
}
188824
func unsafeValueOf(val reflect.Value) reflect.Value {
	uptr := unsafe.Pointer(val.UnsafeAddr())
	return reflect.NewAt(val.Type(), uptr).Elem()
}
793964
func GetRealValue(val *reflect.Value) interface{} {
	if val == nil {
		return nil
	}
	switch val.Kind() {
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return val.Int()
	case reflect.String:
		return val.String()
	case reflect.Bool:
		return val.Bool()
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return val.Uint()
	case reflect.Float32, reflect.Float64:
		return val.Float()
	default:
		return nil
	}
}
1323801
func genericValue(v Value) interface{} {
	if g, ok := v.(*generic); ok {
		return g.p
	}
	return nil
}
790867
func indirectPing(n *Node, target string, amount int, timeout time.Duration) (reached bool, errs []error) {
	resCh := sendPingRequests(n, target, amount, timeout)

	// wait for responses from the ping-reqs
	for result := range resCh {
		switch res := result.(type) {
		case *pingResponse:
			if res.Ok {
				return true, errs
			}
			// If the ping to the target was not-ok we want to wait for more results.

		case error:
			errs = append(errs, res)
		}
	}

	return false, errs
}
1100513
func IndirectType(v interface{}) reflect.Type {
	typ := reflect.TypeOf(v)
	if typ.Kind() == reflect.Ptr {
		return typ.Elem()
	}

	return typ
}
92931
func StringValue(i interface{}) string {
	var buf bytes.Buffer
	stringValue(reflect.ValueOf(i), 0, &buf)
	return buf.String()
}
879388
func DoubleValue(val string) (*wrappers.DoubleValue, error) {
	parsedVal, err := Float64(val)
	return &wrappers.DoubleValue{Value: parsedVal}, err
}
1107074
func (fi *fieldInfo) getValue(a reflect.Value) interface{} {
	for _, i := range fi.path {
		a = a.Field(i)
		if a.Kind() == reflect.Ptr {
			if a.IsNil() {
				return nil
			}
			a = a.Elem()
		}
	}
	return a.Interface()
}
1072457
func (s *StructInjector) Inject(dest interface{}, ctx ...reflect.Value) {
	if dest == nil {
		return
	}

	v := IndirectValue(ValueOf(dest))
	s.InjectElem(v, ctx...)
}
1308674
func stringValue(v reflect.Value) string {
	if v.CanInterface() {
		return fmt.Sprintf("%#v", v.Interface())
	} else {
		return v.String()
	}
}
1109934
func indirectEncodeValue(v reflect.Value) (Marshaler, encoding.TextMarshaler, reflect.Value) {
	// If v is a named type and is addressable,
	// start with its address, so that if the type has pointer methods,
	// we find them.
	if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
		v = v.Addr()
	}
	for {
		if v.Kind() == reflect.Ptr && v.IsNil() {
			break
		}

		vi := v.Interface()
		if m, ok := vi.(Marshaler); ok {
			return m, nil, reflect.Value{}
		}
		if m, ok := vi.(encoding.TextMarshaler); ok {
			return nil, m, reflect.Value{}
		}

		if v.Kind() != reflect.Ptr {
			break
		}

		v = v.Elem()
	}
	return nil, nil, indirect(v, false)
}
1168543
func (v *KeyValue_SetValue_Args) GetValue() (o string) {
	if v != nil && v.Value != nil {
		return *v.Value
	}

	return
}
487753
func (e *ListElement) casValue(from interface{}, to unsafe.Pointer) bool {
	old := atomic.LoadPointer(&e.value)
	if *(*interface{})(old) != from {
		return false
	}
	return atomic.CompareAndSwapPointer(&e.value, old, to)
}