func (t *Datatype) Size() uint {
	return uint(C.H5Tget_size(t.id))
}
Size returns the size of the Datatype.
package hdf5
import "C"
import (
	"fmt"
	"reflect"
	"runtime"
	"unsafe"
)
type Datatype struct {
	Location
}
type TypeClass C.H5T_class_t
const (
	T_NO_CLASS  TypeClass = -1  
	T_INTEGER   TypeClass = 0   
	T_FLOAT     TypeClass = 1   
	T_TIME      TypeClass = 2   
	T_STRING    TypeClass = 3   
	T_BITFIELD  TypeClass = 4   
	T_OPAQUE    TypeClass = 5   
	T_COMPOUND  TypeClass = 6   
	T_REFERENCE TypeClass = 7   
	T_ENUM      TypeClass = 8   
	T_VLEN      TypeClass = 9   
	T_ARRAY     TypeClass = 10  
	T_NCLASSES  TypeClass = 11  
)
var (
	_go_string_t reflect.Type = reflect.TypeOf(string(""))
	_go_int_t    reflect.Type = reflect.TypeOf(int(0))
	_go_int8_t   reflect.Type = reflect.TypeOf(int8(0))
	_go_int16_t  reflect.Type = reflect.TypeOf(int16(0))
	_go_int32_t  reflect.Type = reflect.TypeOf(int32(0))
	_go_int64_t  reflect.Type = reflect.TypeOf(int64(0))
	_go_uint_t   reflect.Type = reflect.TypeOf(uint(0))
	_go_uint8_t  reflect.Type = reflect.TypeOf(uint8(0))
	_go_uint16_t reflect.Type = reflect.TypeOf(uint16(0))
	_go_uint32_t reflect.Type = reflect.TypeOf(uint32(0))
	_go_uint64_t reflect.Type = reflect.TypeOf(uint64(0))
	_go_float32_t reflect.Type = reflect.TypeOf(float32(0))
	_go_float64_t reflect.Type = reflect.TypeOf(float64(0))
	_go_array_t reflect.Type = reflect.TypeOf([1]int{0})
	_go_slice_t reflect.Type = reflect.TypeOf([]int{0})
	_go_struct_t reflect.Type = reflect.TypeOf(struct{}{})
	_go_ptr_t reflect.Type = reflect.PtrTo(_go_int_t)
)
type typeMap map[TypeClass]reflect.Type
var (
	typeClassToGoType typeMap = typeMap{
		T_NO_CLASS:  nil,
		T_INTEGER:   _go_int_t,
		T_FLOAT:     _go_float32_t,
		T_TIME:      nil,
		T_STRING:    _go_string_t,
		T_BITFIELD:  nil,
		T_OPAQUE:    nil,
		T_COMPOUND:  _go_struct_t,
		T_REFERENCE: _go_ptr_t,
		T_ENUM:      _go_int_t,
		T_VLEN:      _go_slice_t,
		T_ARRAY:     _go_array_t,
	}
	parametricTypes typeMap = typeMap{
		T_COMPOUND: _go_struct_t,
		T_ENUM:     _go_int_t,
		T_OPAQUE:   nil,
		T_STRING:   _go_string_t,
	}
)
func OpenDatatype(c CommonFG, name string, tapl_id int) (*Datatype, error) {
	c_name := C.CString(name)
	defer C.free(unsafe.Pointer(c_name))
	id := C.H5Topen2(C.hid_t(c.id), c_name, C.hid_t(tapl_id))
	if err := checkID(id); err != nil {
		return nil, err
	}
	return NewDatatype(id), nil
}
func NewDatatype(id C.hid_t) *Datatype {
	t := &Datatype{Location{Identifier{id}}}
	runtime.SetFinalizer(t, (*Datatype).finalizer)
	return t
}
func CreateDatatype(class TypeClass, size int) (*Datatype, error) {
	_, ok := parametricTypes[class]
	if !ok {
		return nil,
			fmt.Errorf(
				"invalid TypeClass, want %v, %v, %v or %v, got %v",
				T_COMPOUND, T_OPAQUE, T_STRING, T_ENUM,
				class,
			)
	}
	hid := C.H5Tcreate(C.H5T_class_t(class), C.size_t(size))
	if err := checkID(hid); err != nil {
		return nil, err
	}
	return NewDatatype(hid), nil
}
func (t *Datatype) finalizer() {
	if err := t.Close(); err != nil {
		panic(fmt.Errorf("error closing datatype: %s", err))
	}
}
func (t *Datatype) GoType() reflect.Type {
	return typeClassToGoType[t.Class()]
}
func (t *Datatype) Close() error {
	if t.id == 0 {
		return nil
	}
	err := h5err(C.H5Tclose(t.id))
	t.id = 0
	return err
}
func (t *Datatype) Committed() bool {
	return C.H5Tcommitted(t.id) > 0
}
func (t *Datatype) Copy() (*Datatype, error) {
	return copyDatatype(t.id)
}
func copyDatatype(id C.hid_t) (*Datatype, error) {
	hid := C.H5Tcopy(id)
	if err := checkID(hid); err != nil {
		return nil, err
	}
	return NewDatatype(hid), nil
}
func (t *Datatype) Equal(o *Datatype) bool {
	return C.H5Tequal(t.id, o.id) > 0
}
func (t *Datatype) Lock() error {
	return h5err(C.H5Tlock(t.id))
}