summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Vicente Nunes <pvn@hdfgroup.org>2007-10-05 14:53:24 (GMT)
committerPedro Vicente Nunes <pvn@hdfgroup.org>2007-10-05 14:53:24 (GMT)
commit59b7b09846c5e4d838e3af91393cbb1442af6a6e (patch)
tree417da402cdfc0be9836da5b658f86eec10ce7536
parent1de51c7bc148b9cb5104936dfd23096a222d0cb8 (diff)
downloadhdf5-59b7b09846c5e4d838e3af91393cbb1442af6a6e.zip
hdf5-59b7b09846c5e4d838e3af91393cbb1442af6a6e.tar.gz
hdf5-59b7b09846c5e4d838e3af91393cbb1442af6a6e.tar.bz2
[svn-r14188] added a named datatype with attributes to the h5 file that shows attributes with several iteration orders
tested: windows, linux
-rw-r--r--tools/h5dump/h5dumpgentest.c77
-rw-r--r--tools/h5dump/testh5dump.sh.in2
-rw-r--r--tools/testfiles/torderattr.h5bin1652 -> 2536 bytes
-rw-r--r--tools/testfiles/torderattr1.ddl14
-rw-r--r--tools/testfiles/torderattr2.ddl14
-rw-r--r--tools/testfiles/torderattr3.ddl16
-rw-r--r--tools/testfiles/torderattr4.ddl16
7 files changed, 120 insertions, 19 deletions
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index 16fe91b..20f7367 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -5912,8 +5912,10 @@ gent_attr_creation_order(void)
hid_t did; /* dataset id */
hid_t sid; /* space id */
hid_t aid; /* attribute id */
+ hid_t tid; /* datatype id */
hid_t gcpl_id; /* group creation property list ID */
hid_t dcpl_id; /* dataset creation property list ID */
+ hid_t tcpl_id; /* datatype creation property list ID */
int i;
const char *attr_name[3] = {"c", "b", "a" };
@@ -5928,29 +5930,38 @@ gent_attr_creation_order(void)
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
- /* enable creation order tracking on attributes */
+ /* create dataset creation property list */
+ if((tcpl_id = H5Pcreate(H5P_DATATYPE_CREATE)) < 0)
+ goto out;
+
+ /* enable attribute creation order tracking on dataset property list */
if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
- /* enable creation order tracking on groups */
- if(H5Pset_link_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ /* enable attribute creation order tracking on group property list */
+ if(H5Pset_attr_creation_order(gcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
goto out;
-/*-------------------------------------------------------------------------
- * create a dataset and atributes in it
- *-------------------------------------------------------------------------
- */
+ /* enable attribute creation order tracking on datatype property list */
+ if(H5Pset_attr_creation_order(tcpl_id, H5P_CRT_ORDER_TRACKED) < 0)
+ goto out;
- /* create dataspace for dataset */
+ /* create a dataspace */
if((sid = H5Screate(H5S_SCALAR)) < 0)
goto out;
+/*-------------------------------------------------------------------------
+ * create a dataset and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
/* create a dataset */
if((did = H5Dcreate(fid, "dset", H5T_NATIVE_UCHAR, sid, dcpl_id)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++) {
+ for(i = 0; i < 3; i++)
+ {
if((aid = H5Acreate2(did, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
@@ -5958,41 +5969,75 @@ gent_attr_creation_order(void)
if(H5Aclose(aid) < 0)
goto out;
} /* end for */
-
+
if (H5Dclose(did) < 0)
goto out;
+
/*-------------------------------------------------------------------------
* create a group and atributes in it
*-------------------------------------------------------------------------
*/
- if((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "g", H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0)
goto out;
/* add attributes */
- for(i = 0; i < 3; i++) {
- if((aid = H5Acreate2(gid, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for(i = 0; i < 3; i++)
+ {
+ if ((aid = H5Acreate2(gid, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* close attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
goto out;
+
} /* end for */
if (H5Gclose(gid) < 0)
goto out;
-
+
+/*-------------------------------------------------------------------------
+ * create a named datatype and atributes in it
+ *-------------------------------------------------------------------------
+ */
+
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ goto out;
+
+ if ((H5Tcommit2(fid, "t", tid, H5P_DEFAULT, tcpl_id, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* add attributes */
+ for(i = 0; i < 3; i++)
+ {
+ if ((aid = H5Acreate2(tid, ".", attr_name[i], H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto out;
+
+ /* close attribute */
+ if (H5Aclose(aid) < 0)
+ goto out;
+
+ } /* end for */
+
+ if (H5Tclose(tid) < 0)
+ goto out;
+
+
/* close */
if(H5Sclose(sid) < 0)
goto out;
+
if(H5Pclose(dcpl_id) < 0)
goto out;
if(H5Pclose(gcpl_id) < 0)
goto out;
- if(H5Fclose(fid) < 0)
+ if (H5Pclose(tcpl_id) < 0)
goto out;
+ if (H5Fclose(fid) < 0)
+ goto out;
+
return;
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 1dfa535..3fc39f2 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -483,7 +483,7 @@ TOOLTEST tordergr3.ddl -g 2 -q name -z ascending tordergr.h5
TOOLTEST tordergr4.ddl -g 2 -q name -z descending tordergr.h5
TOOLTEST tordergr5.ddl -q creation_order tordergr.h5
-# tests for dataset attribute order
+# tests for attribute order
TOOLTEST torderattr1.ddl -H --sort_by=name --sort_order=ascending torderattr.h5
TOOLTEST torderattr2.ddl -H --sort_by=name --sort_order=descending torderattr.h5
TOOLTEST torderattr3.ddl -H --sort_by=creation_order --sort_order=ascending torderattr.h5
diff --git a/tools/testfiles/torderattr.h5 b/tools/testfiles/torderattr.h5
index 87d9c06..73ea951 100644
--- a/tools/testfiles/torderattr.h5
+++ b/tools/testfiles/torderattr.h5
Binary files differ
diff --git a/tools/testfiles/torderattr1.ddl b/tools/testfiles/torderattr1.ddl
index a5a7b4d..77eff5a 100644
--- a/tools/testfiles/torderattr1.ddl
+++ b/tools/testfiles/torderattr1.ddl
@@ -33,5 +33,19 @@ GROUP "/" {
DATASPACE SCALAR
}
}
+ DATATYPE "t" H5T_STD_I32LE;
+ ATTRIBUTE "a" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "b" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "c" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+
}
}
diff --git a/tools/testfiles/torderattr2.ddl b/tools/testfiles/torderattr2.ddl
index 9b66d89..fd4160b 100644
--- a/tools/testfiles/torderattr2.ddl
+++ b/tools/testfiles/torderattr2.ddl
@@ -3,6 +3,20 @@ Expected output for 'h5dump -H --sort_by=name --sort_order=descending torderattr
#############################
HDF5 "torderattr.h5" {
GROUP "/" {
+ DATATYPE "t" H5T_STD_I32LE;
+ ATTRIBUTE "c" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "b" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "a" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+
GROUP "g" {
ATTRIBUTE "c" {
DATATYPE H5T_STD_U8LE
diff --git a/tools/testfiles/torderattr3.ddl b/tools/testfiles/torderattr3.ddl
index 19fbade..d14ec74 100644
--- a/tools/testfiles/torderattr3.ddl
+++ b/tools/testfiles/torderattr3.ddl
@@ -20,6 +20,20 @@ GROUP "/" {
}
}
GROUP "g" {
+ ATTRIBUTE "a" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "b" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "c" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ }
+ DATATYPE "t" H5T_STD_I32LE;
ATTRIBUTE "c" {
DATATYPE H5T_STD_U8LE
DATASPACE SCALAR
@@ -32,6 +46,6 @@ GROUP "/" {
DATATYPE H5T_STD_U8LE
DATASPACE SCALAR
}
- }
+
}
}
diff --git a/tools/testfiles/torderattr4.ddl b/tools/testfiles/torderattr4.ddl
index 95fdfea..032c912 100644
--- a/tools/testfiles/torderattr4.ddl
+++ b/tools/testfiles/torderattr4.ddl
@@ -3,7 +3,7 @@ Expected output for 'h5dump -H --sort_by=creation_order --sort_order=descending
#############################
HDF5 "torderattr.h5" {
GROUP "/" {
- GROUP "g" {
+ DATATYPE "t" H5T_STD_I32LE;
ATTRIBUTE "a" {
DATATYPE H5T_STD_U8LE
DATASPACE SCALAR
@@ -16,6 +16,20 @@ GROUP "/" {
DATATYPE H5T_STD_U8LE
DATASPACE SCALAR
}
+
+ GROUP "g" {
+ ATTRIBUTE "c" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "b" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
+ ATTRIBUTE "a" {
+ DATATYPE H5T_STD_U8LE
+ DATASPACE SCALAR
+ }
}
DATASET "dset" {
DATATYPE H5T_STD_U8LE