[cig-commits] r13715 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Wed Dec 17 02:31:56 PST 2008
Author: luis
Date: 2008-12-17 02:31:56 -0800 (Wed, 17 Dec 2008)
New Revision: 13715
Modified:
cs/cigma/trunk/src/io_hdf5_reader.cpp
cs/cigma/trunk/src/io_hdf5_reader.h
Log:
Added HDF5_Reader methods to detect what kind of object corresponds
to the given location.
Modified: cs/cigma/trunk/src/io_hdf5_reader.cpp
===================================================================
--- cs/cigma/trunk/src/io_hdf5_reader.cpp 2008-12-17 10:31:54 UTC (rev 13714)
+++ cs/cigma/trunk/src/io_hdf5_reader.cpp 2008-12-17 10:31:56 UTC (rev 13715)
@@ -82,6 +82,7 @@
int HDF5_Reader::readAttrString(const char *loc, const char *attr_name, string& val)
{
+ TRI_LOG_STR("HDF5_Reader::readAttrString()");
return read_scalar_attribute<string>(file, loc, attr_name, val);
}
@@ -105,7 +106,29 @@
return read_scalar_attribute<double>(file, loc, attr_name, val);
}
+bool HDF5_Reader::locationIsGroup(const char *loc)
+{
+ H5::Group* group = h5_open_group(file, loc);
+ if (group != 0)
+ {
+ delete group;
+ return true;
+ }
+ return false;
+}
+bool HDF5_Reader::locationIsDataset(const char *loc)
+{
+ H5::DataSet* dataset = h5_open_dataset(file, loc);
+ if (dataset != 0)
+ {
+ delete dataset;
+ return true;
+ }
+ return false;
+}
+
+
#else
HDF5_Reader::HDF5_Reader()
@@ -168,5 +191,14 @@
return -1;
}
+bool HDF5_Reader::locationIsGroup(const char *loc)
+{
+ return false;
+}
+bool HDF5_Reader::locationIsDataset(const char *loc)
+{
+ return false;
+}
+
#endif
Modified: cs/cigma/trunk/src/io_hdf5_reader.h
===================================================================
--- cs/cigma/trunk/src/io_hdf5_reader.h 2008-12-17 10:31:54 UTC (rev 13714)
+++ cs/cigma/trunk/src/io_hdf5_reader.h 2008-12-17 10:31:56 UTC (rev 13715)
@@ -33,6 +33,9 @@
int readAttrFloat(const char *loc, const char *attr_name, float& val);
int readAttrDouble(const char *loc, const char *attr_name, double& val);
+ bool locationIsGroup(const char *loc);
+ bool locationIsDataset(const char *loc);
+
#ifdef HAVE_HDF5
public:
H5::H5File *file;
More information about the CIG-COMMITS
mailing list