diff src/ov-fcn-inline.cc @ 9892:ac69e6f4b33d

Add HDF5-1.8 compatibility while maintaining compatibility with HDF5-1.6 versions
author Kacper Kowalik <xarthisius.kk@gmail.com>
date Tue, 01 Dec 2009 00:49:07 +0100
parents b3089dba88bf
children cd96d29c5efa
line wrap: on
line diff
--- a/src/ov-fcn-inline.cc	Mon Nov 30 14:32:10 2009 -0500
+++ b/src/ov-fcn-inline.cc	Tue Dec 01 00:49:07 2009 +0100
@@ -273,7 +273,11 @@
 			      bool /* save_as_floats */)
 {
   hid_t group_hid = -1;
+#if HAVE_HDF5_18
+  group_hid = H5Gcreate (loc_id, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   group_hid = H5Gcreate (loc_id, name, 0);
+#endif
   if (group_hid < 0 ) return false;
 
   size_t len = 0;
@@ -299,9 +303,13 @@
       H5Gclose (group_hid);
       return false;
     }
-
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
+			H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   data_hid = H5Dcreate (group_hid, "args", H5T_NATIVE_CHAR, space_hid,
 			H5P_DEFAULT);
+#endif
   if (data_hid < 0)
     {
       H5Sclose (space_hid);
@@ -349,8 +357,12 @@
       H5Gclose (group_hid);
       return false;
     }
-
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, 
+  			H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   data_hid = H5Dcreate (group_hid, "nm",  type_hid, space_hid, H5P_DEFAULT);
+#endif
   if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
 				H5P_DEFAULT, nm.c_str ()) < 0)
     {
@@ -369,8 +381,13 @@
       return false;
     }
 
+#if HAVE_HDF5_18
+  data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
+			H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   data_hid = H5Dcreate (group_hid, "iftext",  type_hid, space_hid,
 			H5P_DEFAULT);
+#endif
   if (data_hid < 0 || H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL,
 				H5P_DEFAULT, iftext.c_str ()) < 0)
     {
@@ -395,10 +412,18 @@
   hsize_t rank;
   int slen;
 
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
   group_hid = H5Gopen (loc_id, name);
+#endif
   if (group_hid < 0 ) return false;
 
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "args", H5P_DEFAULT);
+#else
   data_hid = H5Dopen (group_hid, "args");
+#endif
   space_hid = H5Dget_space (data_hid);
   rank = H5Sget_simple_extent_ndims (space_hid);
 
@@ -434,7 +459,11 @@
   for (size_t i = 0; i < hdims[1]; i++)
     ifargs(i) = std::string (s1 + i*hdims[0]);
 
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "nm", H5P_DEFAULT);
+#else
   data_hid = H5Dopen (group_hid, "nm");
+#endif
 
   if (data_hid < 0)
     {
@@ -492,7 +521,11 @@
   H5Dclose (data_hid);
   nm = nm_tmp;
 
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "iftext", H5P_DEFAULT);
+#else
   data_hid = H5Dopen (group_hid, "iftext");
+#endif
 
   if (data_hid < 0)
     {