44 H5::Exception::dontPrint();
51 catch(
const H5::Exception& e )
59 "for file <"<< fullname <<
">"<< std::endl;
83 catch(
const H5::Exception& e )
103 catch(
const H5::Exception& e )
121 numObjs = group.getNumObjs();
123 catch(
const H5::Exception& e )
128 for (
int i=0; (i<numObjs) && success; ++i)
132 H5G_obj_t h5type = group.getObjTypeByIdx(i);
133 if (h5type == H5G_GROUP)
135 string name = group.getObjnameByIdx(i);
136 groupList.push_back(group.openGroup(name));
141 catch(
const H5::Exception& e )
154 vector<Group> groupList;
159 groupList.insert(groupList.begin(), group);
164 vector<Group>::iterator group_iter = groupList.begin();
165 while (group_iter != groupList.end())
167 int numObjs = group_iter->getNumObjs();
168 for (
int i=0; i<numObjs; ++i)
170 H5G_obj_t h5type = group_iter->getObjTypeByIdx(i);
171 if (h5type == H5G_DATASET)
173 string name = group_iter->getObjnameByIdx(i);
174 datasetList.push_back(group_iter->openDataSet(name));
180 catch(
const H5::Exception& e )
192 vector<Group> groupList;
195 groupList.insert(groupList.begin(), group);
200 vector<Group>::iterator group_iter = groupList.begin();
201 while (group_iter != groupList.end())
203 int numObjs = group_iter->getNumObjs();
204 for (
int i=0; i<numObjs; ++i)
206 H5G_obj_t h5type = group_iter->getObjTypeByIdx(i);
207 if (h5type == H5G_DATASET)
209 string name = group_iter->getObjnameByIdx(i);
210 DataSet dataset (group_iter->openDataSet(name));
211 DataSpace dspace (dataset.getSpace());
212 if (dspace.getSimpleExtentNdims() > 1)
213 datasetList.push_back(dataset);
219 catch(
const H5::Exception& e )
235 int numAttr = obj.getNumAttrs();
236 for (
int i=0; i<numAttr; ++i)
238 attrList.push_back(obj.openAttribute(i));
241 catch(
const H5::Exception& e )
267 H5::Group* named_group = 0;
268 vector<Group> groupList;
274 std::vector<Group>::iterator group = groupList.begin();
275 while (group != groupList.end())
281 named_group =
new Group(*group);
287 catch(
const H5::Exception& e )
311 H5::DataSet* named_dataset = 0;
312 vector<DataSet> datasetList;
313 if (!
getDatasets(baseGroup, datasetList, recursive))
317 std::vector<H5::DataSet>::iterator dataset = datasetList.begin();
318 while (dataset != datasetList.end())
324 named_dataset =
new H5::DataSet(*dataset);
330 catch(
const H5::Exception& e )
334 return named_dataset;
346 H5T_class_t typeClass = obj->getTypeClass();
348 H5T_order_t order = H5T_ORDER_NONE;
350 if ( typeClass == H5T_INTEGER )
352 H5::IntType intype = obj->getIntType();
353 order = intype.getOrder();
355 else if ( typeClass == H5T_FLOAT )
357 H5::FloatType floatType = obj->getFloatType();
358 order = floatType.getOrder();
361 if ( order == H5T_ORDER_LE )
365 else if ( order == H5T_ORDER_BE )
370 catch(
const H5::Exception& e )
381 H5T_order_t order = obj.getOrder();
382 if ( order == H5T_ORDER_LE )
386 else if ( order == H5T_ORDER_BE )
397 H5T_class_t classType = (H5T_class_t)type;
403 result =
"H5T_INTEGER";
406 result =
"H5T_FLOAT";
412 result =
"H5T_STRING";
415 result =
"H5T_BITFIELD";
418 result =
"H5T_OPAQUE";
421 result =
"H5T_COMPOUND";
424 result =
"H5T_REFERENCE";
433 result =
"H5T_ARRAY";
437 result =
"H5T_NO_CLASS";
451 H5::DataSpace dataspace = dataset.getSpace();
454 int ndims = dataspace.getSimpleExtentNdims();
458 std::vector<hsize_t> dims_out(ndims);
459 dataspace.getSimpleExtentDims( &dims_out.front(), 0 );
462 extents.push_back(static_cast<ossim_uint32>(dims_out[i]));
468 catch(
const H5::Exception& e )
482 H5::DataType datatype = dataset.getDataType();
484 if ( ( typeClass != H5T_INTEGER ) && ( typeClass != H5T_FLOAT ) )
488 hid_t mem_type_id = H5Dget_type( datatype.getId() );
489 if( mem_type_id > -1 )
491 hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
493 if( H5Tequal(H5T_NATIVE_CHAR, native_type) )
495 else if ( H5Tequal( H5T_NATIVE_UCHAR, native_type) )
497 else if( H5Tequal( H5T_NATIVE_SHORT, native_type) )
499 else if(H5Tequal(H5T_NATIVE_USHORT, native_type))
501 else if(H5Tequal( H5T_NATIVE_INT, native_type))
503 else if(H5Tequal( H5T_NATIVE_UINT, native_type ) )
505 else if(H5Tequal( H5T_NATIVE_LONG, native_type))
507 else if(H5Tequal( H5T_NATIVE_ULONG, native_type))
509 else if(H5Tequal( H5T_NATIVE_LLONG, native_type))
511 else if(H5Tequal( H5T_NATIVE_ULLONG, native_type))
513 else if(H5Tequal( H5T_NATIVE_FLOAT, native_type))
515 else if(H5Tequal( H5T_NATIVE_DOUBLE, native_type))
518 else if ( typeClass == H5T_INTEGER )
520 H5::IntType intType (dataset);
521 bool isSigned = intType.getSign() == H5T_SGN_NONE ? false :
true;
522 size = intType.getSize();
555 size = datatype.getSize();
569 catch(
const H5::Exception& e )
578 const H5::FloatType& dataType,
581 char* buf =
const_cast<char*
>(dataPtr);
586 bool returnValue =
true;
594 endian.
swap(*float_value);
603 endian.
swap(*float_value);
617 const H5::IntType& dataType,
620 char* buf =
const_cast<char*
>(dataPtr);
626 bool returnValue =
true;
644 intValue =
reinterpret_cast<ossim_int8*
>(buf);
666 endian.
swap(*intValue);
676 endian.
swap(*intValue);
698 endian.
swap(*intValue);
708 endian.
swap(*intValue);
729 endian.
swap(*intValue);
739 endian.
swap(*intValue);
761 const H5::StrType& dataType,
764 bool returnValue =
false;
765 const char* startPtr = dataPtr;
766 const char* endPtr = dataPtr;
767 const char* maxPtr = dataPtr + dataType.getSize();
770 while((endPtr != maxPtr)&&(*endPtr!=
'\0')) ++endPtr;
771 result = std::string(startPtr, endPtr);
772 bool returnValue =
true;
char ossim_int8
Previous DLL import export section.
bool getRoot(H5::Group &root) const
Assigns the root group.
bool contains(char aChar) const
static ossimString toString(bool aValue)
Numeric to string methods.
OSSIM_DLL ossimByteOrder byteOrder()
unsigned short ossim_uint16
bool open(const ossimFilename &hdf5File)
Opens specified HDF5 file.
static bool getDatasets(H5::Group group, std::vector< H5::DataSet > &datasetList, bool recursive=false)
Assigns list of datasets under specified group.
OSSIM_DLL bool isSigned(ossimScalarType scalarType)
static ossimByteOrder getByteOrder(const H5::AbstractDs *obj)
static ossimScalarType getScalarType(const H5::DataSet &dataset)
bool close()
Closes the file and deletes all pointers.
H5::Group * findGroupByName(const std::string &group_name, const H5::Group *parent_group=0, bool recursive=false) const
Finds a group by name.
static std::string getDatatypeClassType(ossim_int32 type)
unsigned long long ossim_uint64
unsigned int ossim_uint32
static bool getChildGroups(H5::Group group, std::vector< H5::Group > &groupList, bool recursive=false)
Assigns list of groups under specified group.
static bool stringTypeToString(std::string &result, const H5::StrType &dataType, const char *dataPtr)
static bool floatTypeToString(std::string &result, const H5::FloatType &dataType, const char *dataPtr)
static bool getAttributes(const H5::H5Object &obj, std::vector< H5::Attribute > &attrList)
H5::DataSet * findDatasetByName(const std::string &dataset_name, const H5::Group *group=0, bool recursive=false) const
Finds a dataset by name.
static void getExtents(const H5::DataSet &dataset, std::vector< ossim_uint32 > &extents)
static bool getNdimDatasets(H5::Group group, std::vector< H5::DataSet > &datasetList, bool recursive=false)
Assigns list of all multi-dimensional datasets under current active group.
unsigned char ossim_uint8
static bool intTypeToString(std::string &result, const H5::IntType &dataType, const char *dataPtr)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const