diff src/ov-class.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 2cd940306a06
line wrap: on
line diff
--- a/src/ov-class.cc	Mon Nov 30 14:32:10 2009 -0500
+++ b/src/ov-class.cc	Tue Dec 01 00:49:07 2009 +0100
@@ -1399,7 +1399,11 @@
   Octave_map m;
   Octave_map::iterator i;
 
+#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)
     goto error_cleanup;
 
@@ -1412,14 +1416,22 @@
   space_hid = H5Screate_simple (0 , hdims, 0);
   if (space_hid < 0)
     goto error_cleanup;
-
+#if HAVE_HDF5_18
+  class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
+			 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   class_hid = H5Dcreate (group_hid, "classname",  type_hid, space_hid,
 			 H5P_DEFAULT);
+#endif
   if (class_hid < 0 || H5Dwrite (class_hid, type_hid, H5S_ALL, H5S_ALL, 
 				    H5P_DEFAULT, c_name.c_str ()) < 0)
     goto error_cleanup;
 
+#if HAVE_HDF5_18
+  data_hid = H5Gcreate (group_hid, "value", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+#else
   data_hid = H5Gcreate (group_hid, "value", 0);
+#endif
   if (data_hid < 0)
     goto error_cleanup;
 
@@ -1492,12 +1504,19 @@
   int slen = 0;
   hsize_t rank = 0;
 
+#if HAVE_HDF5_18
+  group_hid = H5Gopen (loc_id, name, H5P_DEFAULT);
+#else
   group_hid = H5Gopen (loc_id, name);
+#endif
   if (group_hid < 0)
     goto error_cleanup;
 
-  
+#if HAVE_HDF5_18
+  data_hid = H5Dopen (group_hid, "classname", H5P_DEFAULT);
+#else
   data_hid = H5Dopen (group_hid, "classname");
+#endif
 
   if (data_hid < 0)
     goto error_cleanup;
@@ -1546,8 +1565,11 @@
   while (0);
   reconstruct_exemplar ();
 
-
+#if HAVE_HDF5_18
+  subgroup_hid = H5Gopen (group_hid, name, H5P_DEFAULT); 
+#else
   subgroup_hid = H5Gopen (group_hid, name); 
+#endif
   H5Gget_num_objs (subgroup_hid, &num_obj);
   H5Gclose (subgroup_hid);