7 #include "HDFgroup.hxx"
8 #include "HDFexception.hxx"
10 HDFgroup::HDFgroup(char *name, HDFcontainerObject *father)
11 : HDFcontainerObject(name)
14 _fid = _father->GetId();
15 _father->AddSon(this);
19 void HDFgroup::CreateOnDisk()
21 if ((_id = HDFgroupCreate(_fid,_name)) < 0)
22 throw HDFexception("Can't create group");
25 void HDFgroup::OpenOnDisk()
27 if ((_id = HDFgroupOpen(_fid,_name)) < 0)
28 throw HDFexception("Can't open group");
31 void HDFgroup::CloseOnDisk()
35 if ((ret = HDFgroupClose(_id)) < 0)
36 throw HDFexception("Can't close group");
40 HDFcontainerObject *HDFgroup::GetFather()
45 hdf_object_type HDFgroup::GetObjectType()
50 int HDFgroup::nInternalObjects()
55 if ((ret = HDFnObjects(_fid,_name,&n)) < 0)
56 throw HDFexception("Can't determine the number of internal objects");
61 void HDFgroup::InternalObjectIndentify(int rank, char *object_name)
65 if ((ret = HDFobjectIdentify(_fid,_name,rank,object_name)) < 0)
66 throw HDFexception("Can't identify an internal object");
69 int HDFgroup::ExistInternalObject(char *object_name)
73 char name[HDF_NAME_MAX_LEN+1];
75 n = this->nInternalObjects();
78 this->InternalObjectIndentify(i,name);
79 if (!strcmp(name,object_name))
88 hdf_object_type HDFgroup::InternalObjectType(char *object_name)
93 if ((ret = HDFobjectType(_id,object_name,&type)) < 0)
94 throw HDFexception("Can't determine internal object type");
99 void HDFgroup::FileMount(char *file,hdf_access_mode mode)
104 throw HDFexception("Can't mount the file");
106 if ((_mid = HDFfileOpen(file,mode)) < 0)
107 throw HDFexception("Can't mount the file");
109 if ((ret = HDFfileMount(_fid,_name,_mid)) < 0)
110 throw HDFexception("Can't mount the file");
113 void HDFgroup::FileUnMount()
117 if ((ret = HDFfileUmount(_fid,_name)) < 0)
118 throw HDFexception("Can't unmount the file");
120 if ((ret = HDFfileClose(_mid)) < 0)
121 throw HDFexception("Can't unmount the file");