Skip to content

Commit eabe91d

Browse files
committed
hdf5: implement Stringer for IType
Signed-off-by: Sebastien Binet <[email protected]>
1 parent 2fe883e commit eabe91d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

h5i_identifier.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package hdf5
1111
import "C"
1212

1313
import (
14+
"fmt"
1415
"unsafe"
1516
)
1617

@@ -26,6 +27,27 @@ const (
2627
BAD_ID IType = C.H5I_BADID
2728
)
2829

30+
func (typ IType) String() string {
31+
switch typ {
32+
case FILE:
33+
return "file"
34+
case GROUP:
35+
return "group"
36+
case DATATYPE:
37+
return "datatype"
38+
case DATASPACE:
39+
return "dataspace"
40+
case DATASET:
41+
return "dataset"
42+
case ATTRIBUTE:
43+
return "attribute"
44+
case BAD_ID:
45+
return "bad_id"
46+
default:
47+
return fmt.Sprintf("IType=%d", int(typ))
48+
}
49+
}
50+
2951
// Identifier is a simple wrapper around a C hid_t. It has basic methods
3052
// which apply to every type in the go-hdf5 API.
3153
type Identifier struct {

0 commit comments

Comments
 (0)