Skip to content

Commit 79c7424

Browse files
committed
all: apply Dan Kortschak API modifications
1 parent 12b237c commit 79c7424

File tree

8 files changed

+236
-241
lines changed

8 files changed

+236
-241
lines changed

h5a.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
)
1919

2020
type Attribute struct {
21-
Location
21+
Identifier
2222
}
2323

2424
func newAttribute(id C.hid_t) *Attribute {
25-
d := &Attribute{Location{Identifier{id}}}
25+
d := &Attribute{Identifier{id}}
2626
runtime.SetFinalizer(d, (*Attribute).finalizer)
2727
return d
2828
}
@@ -59,9 +59,9 @@ func (s *Attribute) Id() int {
5959
}
6060

6161
// Access the type of an attribute
62-
func (s *Attribute) GetType() Location {
62+
func (s *Attribute) GetType() Identifier {
6363
ftype := C.H5Aget_type(s.id)
64-
return Location{Identifier{ftype}}
64+
return Identifier{ftype}
6565
}
6666

6767
// Close releases and terminates access to an attribute.

h5d.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import (
1818
)
1919

2020
type Dataset struct {
21-
Location
21+
Identifier
2222
}
2323

2424
func newDataset(id C.hid_t) *Dataset {
25-
d := &Dataset{Location{Identifier{id}}}
25+
d := &Dataset{Identifier{id}}
2626
runtime.SetFinalizer(d, (*Dataset).finalizer)
2727
return d
2828
}

h5f.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (f *File) finalizer() {
4747
}
4848

4949
func newFile(id C.hid_t) *File {
50-
f := &File{CommonFG{Location{Identifier{id}}}}
50+
f := &File{CommonFG{Identifier{id}}}
5151
runtime.SetFinalizer(f, (*File).finalizer)
5252
return f
5353
}

h5g.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
// CommonFG is for methods common to both File and Group
2020
type CommonFG struct {
21-
Location
21+
Identifier
2222
}
2323

2424
// Group is an HDF5 container object. It can contain any Location.
@@ -37,7 +37,7 @@ func (g *CommonFG) CreateGroup(name string) (*Group, error) {
3737
if err := checkID(hid); err != nil {
3838
return nil, err
3939
}
40-
group := &Group{CommonFG{Location{Identifier{hid}}}}
40+
group := &Group{CommonFG{Identifier{hid}}}
4141
runtime.SetFinalizer(group, (*Group).finalizer)
4242
return group, nil
4343
}
@@ -87,7 +87,7 @@ func (g *CommonFG) OpenGroup(name string) (*Group, error) {
8787
if err := checkID(hid); err != nil {
8888
return nil, err
8989
}
90-
group := &Group{CommonFG{Location{Identifier{hid}}}}
90+
group := &Group{CommonFG{Identifier{hid}}}
9191
runtime.SetFinalizer(group, (*Group).finalizer)
9292
return group, nil
9393
}

h5i.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ type Identifier struct {
3232
id C.hid_t
3333
}
3434

35-
// A Location embeds Identifier. Dataset, Datatype and Group are all Locations.
36-
type Location struct {
37-
Identifier
38-
}
39-
4035
// Id returns the int value of an identifier.
4136
func (i Identifier) Id() int {
4237
return int(i.id)
@@ -64,7 +59,7 @@ func (i Identifier) File() *File {
6459
if fid < 0 {
6560
return nil
6661
}
67-
return &File{CommonFG{Location{Identifier{fid}}}}
62+
return &File{CommonFG{Identifier{fid}}}
6863
}
6964

7065
// Type returns the type of the identifier.

h5pt.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ import (
1919

2020
// Table is an hdf5 packet-table.
2121
type Table struct {
22-
Location
22+
Identifier
2323
}
2424

2525
func newPacketTable(id C.hid_t) *Table {
26-
t := &Table{Location{Identifier{id}}}
26+
t := &Table{Identifier{id}}
2727
runtime.SetFinalizer(t, (*Table).finalizer)
2828
return t
2929
}

h5t.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
)
1818

1919
type Datatype struct {
20-
Location
20+
Identifier
2121
}
2222

2323
type TypeClass C.H5T_class_t
@@ -105,7 +105,7 @@ func OpenDatatype(c CommonFG, name string, tapl_id int) (*Datatype, error) {
105105

106106
// NewDatatype creates a Datatype from an hdf5 id.
107107
func NewDatatype(id C.hid_t) *Datatype {
108-
t := &Datatype{Location{Identifier{id}}}
108+
t := &Datatype{Identifier{id}}
109109
runtime.SetFinalizer(t, (*Datatype).finalizer)
110110
return t
111111
}
@@ -208,7 +208,7 @@ func NewArrayType(base_type *Datatype, dims []int) (*ArrayType, error) {
208208
if err := checkID(hid); err != nil {
209209
return nil, err
210210
}
211-
t := &ArrayType{Datatype{Location{Identifier{hid}}}}
211+
t := &ArrayType{Datatype{Identifier{hid}}}
212212
runtime.SetFinalizer(t, (*ArrayType).finalizer)
213213
return t, nil
214214
}
@@ -246,7 +246,7 @@ func NewVarLenType(base_type *Datatype) (*VarLenType, error) {
246246
if err := checkID(id); err != nil {
247247
return nil, err
248248
}
249-
t := &VarLenType{Datatype{Location{Identifier{id}}}}
249+
t := &VarLenType{Datatype{Identifier{id}}}
250250
runtime.SetFinalizer(t, (*VarLenType).finalizer)
251251
return t, nil
252252
}
@@ -267,7 +267,7 @@ func NewCompoundType(size int) (*CompoundType, error) {
267267
if err := checkID(id); err != nil {
268268
return nil, err
269269
}
270-
t := &CompoundType{Datatype{Location{Identifier{id}}}}
270+
t := &CompoundType{Datatype{Identifier{id}}}
271271
runtime.SetFinalizer(t, (*CompoundType).finalizer)
272272
return t, nil
273273
}

0 commit comments

Comments
 (0)