[cig-commits] r13830 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Mon Jan 12 14:09:54 PST 2009
Author: luis
Date: 2009-01-12 14:09:53 -0800 (Mon, 12 Jan 2009)
New Revision: 13830
Modified:
cs/cigma/trunk/src/h5attr.cpp
Log:
Fixed user operators (forgot return values!)
Modified: cs/cigma/trunk/src/h5attr.cpp
===================================================================
--- cs/cigma/trunk/src/h5attr.cpp 2009-01-12 22:09:52 UTC (rev 13829)
+++ cs/cigma/trunk/src/h5attr.cpp 2009-01-12 22:09:53 UTC (rev 13830)
@@ -14,9 +14,11 @@
#include "H5Cpp.h"
#include "hdf5.h"
+//*
#if ((H5_VERS_MAJOR >= 1) && (H5_VERS_MINOR >= 8) && (H5_VERS_RELEASE >= 0))
#define HAVE_HDF5_1_8_0
#endif
+// */
using namespace std;
using namespace boost;
@@ -263,7 +265,6 @@
void print_attr(const string& name, const string& dtype, const string& value)
{
cout << "\t" << name << " = ";
-
if (dtype != "string")
{
cout << value;
@@ -283,28 +284,30 @@
herr_t listGroupOp(hid_t group, const char *name, void *data)
{
- //TRI_LOG_STR("listOp()");
+ TRI_LOG_STR("listGroupOp()");
cout << "\t" << name << endl;
+ return 0;
}
#ifdef HAVE_HDF5_1_8_0
herr_t listAttrOp(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data)
{
- //TRI_LOG_STR("listAttrOp()");
- string name(attr_name);
- string dtype, value;
-
+ TRI_LOG_STR("listAttrOp()");
if (op_data != 0)
{
H5::H5Object *obj = (H5::H5Object *)op_data;
+ string name(attr_name);
+ string dtype, value;
getattr(obj, name, dtype, value);
print_attr(name, dtype, value);
}
+ return 0;
}
void listAttrOp01(H5::H5Object& loc, const string name, void *data)
{
+ TRI_LOG_STR("listAttrOp01()");
string dtype, value;
getattr(&loc, name, dtype, value);
print_attr(name, dtype, value);
@@ -315,14 +318,16 @@
herr_t listAttrOp00(hid_t loc_id, const char *attr_name, void *op_data)
{
- string name(attr_name);
- string dtype, value;
+ TRI_LOG_STR("listAttrOp00()");
if (op_data != 0)
{
H5::H5Object *obj = (H5::H5Object *)op_data;
+ string name(attr_name);
+ string dtype, value;
getattr(obj, name, dtype, value);
print_attr(name, dtype, value);
}
+ return 0;
}
#endif
@@ -468,6 +473,7 @@
else
{
getattr(obj, attr_name, attr_dtype, attr_value);
+ print_attr(attr_name, attr_dtype, attr_value);
}
}
else
@@ -485,20 +491,29 @@
#ifdef HAVE_HDF5_1_8_0
try
{
- int idx = 0;
- while ((status = file->iterateElems(location.c_str(), &idx, listGroupOp, (void *)prefix)) > 0)
+ int _idx = 0;
+ TRI_LOG_STR("Calling file->iterateElems()");
+ while (true)
{
- //TRI_LOG(status);
+ status = file->iterateElems(location.c_str(), &_idx, listGroupOp, (void *)prefix);
+ TRI_LOG(status);
+ TRI_LOG(_idx);
+ if (status <= 0) { break; }
}
} catch(H5::Exception e)
{
+ TRI_LOG_STR("ERROR in file->iterateElems()");
}
#else
hid_t oid = obj->getId();
int _idx = 0;
- while ((status = H5Giterate(oid, location.c_str(), &_idx, listGroupOp, (void *)prefix)) > 0)
+ TRI_LOG_STR("Calling H5Giterate()");
+ while (true)
{
- //TRI_LOG(status);
+ TRI_LOG(_idx);
+ status = H5Giterate(oid, location.c_str(), &_idx, listGroupOp, (void *)prefix);
+ TRI_LOG(status);
+ if (status <= 0) { break; }
}
#endif
}
@@ -511,6 +526,7 @@
#ifdef HAVE_HDF5_1_8_0
H5O_info_t oinfo;
hid_t oid = obj->getId();
+ TRI_LOG_STR("Calling H5Oget_info(oid, &oinfo)");
status = H5Oget_info(oid, &oinfo);
if (status < 0)
{
@@ -526,18 +542,26 @@
cout << indent << "Attributes" << endl;
if (num_attrs > 0)
{
+ hid_t oid = obj->getId();
#ifdef HAVE_HDF5_1_8_0
hsize_t _idx = 0;
- while ((status = H5Aiterate2(oid, H5_INDEX_NAME, H5_ITER_INC, &_idx, listAttrOp, obj)) > 0)
+ TRI_LOG_STR("Calling H5Aiterate2");
+ while (true)
{
- //TRI_LOG(status);
+ TRI_LOG(_idx);
+ status = H5Aiterate2(oid, H5_INDEX_NAME, H5_ITER_INC, &_idx, listAttrOp, obj);
+ TRI_LOG(status);
+ if (status <= 0) { break; }
}
#else
- hid_t oid = obj->getId();
unsigned int _idx = 0;
- while ((status = H5Aiterate(oid, &_idx, listAttrOp00, obj)) > 0)
+ TRI_LOG_STR("Calling H5Aiterate1");
+ while (true)
{
- //TRI_LOG(status);
+ TRI_LOG(_idx);
+ status = H5Aiterate1(oid, &_idx, listAttrOp00, obj);
+ TRI_LOG(status);
+ if (status <= 0) { break; }
}
#endif
}
@@ -556,6 +580,7 @@
}
// Clean up
+ TRI_LOG_STR(">> Cleaning up");
if (obj) { delete obj; }
if (file) { delete file; }
More information about the CIG-COMMITS
mailing list