2003-04-01 01:59:04 +08:00
|
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
|
* All rights reserved. *
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
2000-11-12 08:10:08 +08:00
|
|
|
|
|
|
|
|
|
/***********************************************************
|
|
|
|
|
*
|
|
|
|
|
* Test program: tgenprop
|
|
|
|
|
*
|
|
|
|
|
* Test the Generic Property functionality
|
|
|
|
|
*
|
|
|
|
|
*************************************************************/
|
|
|
|
|
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#define H5P_PACKAGE /*suppress error about including H5Ppkg */
|
|
|
|
|
|
2002-10-08 22:08:10 +08:00
|
|
|
|
/* Define this macro to indicate that the testing APIs should be available */
|
|
|
|
|
#define H5P_TESTING
|
|
|
|
|
|
2001-04-04 02:09:16 +08:00
|
|
|
|
#include "testhdf5.h"
|
|
|
|
|
#include "hdf5.h"
|
2002-10-08 22:08:10 +08:00
|
|
|
|
#include "H5Dprivate.h" /* For Dataset creation property list names */
|
2003-05-16 03:22:33 +08:00
|
|
|
|
#include "H5Ppkg.h" /* Generic Properties */
|
2000-11-12 08:10:08 +08:00
|
|
|
|
|
|
|
|
|
#define FILENAME "tgenprop.h5"
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Property definitions */
|
2000-11-14 08:06:14 +08:00
|
|
|
|
#define CLASS1_NAME "Class 1"
|
2002-10-08 22:08:10 +08:00
|
|
|
|
#define CLASS1_PATH "root/Class 1"
|
2000-11-14 08:06:14 +08:00
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
#define CLASS2_NAME "Class 2"
|
2002-10-08 22:08:10 +08:00
|
|
|
|
#define CLASS2_PATH "root/Class 1/Class 2"
|
2000-11-15 10:27:15 +08:00
|
|
|
|
|
|
|
|
|
/* Property definitions */
|
|
|
|
|
#define PROP1_NAME "Property 1"
|
|
|
|
|
int prop1_def=10; /* Property 1 default value */
|
|
|
|
|
#define PROP1_SIZE sizeof(prop1_def)
|
|
|
|
|
#define PROP1_DEF_VALUE (&prop1_def)
|
|
|
|
|
|
|
|
|
|
#define PROP2_NAME "Property 2"
|
2001-11-28 00:29:13 +08:00
|
|
|
|
float prop2_def=(float)3.14; /* Property 2 default value */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
#define PROP2_SIZE sizeof(prop2_def)
|
|
|
|
|
#define PROP2_DEF_VALUE (&prop2_def)
|
|
|
|
|
|
|
|
|
|
#define PROP3_NAME "Property 3"
|
|
|
|
|
char prop3_def[10]="Ten chars"; /* Property 3 default value */
|
|
|
|
|
#define PROP3_SIZE sizeof(prop3_def)
|
|
|
|
|
#define PROP3_DEF_VALUE (&prop3_def)
|
|
|
|
|
|
2000-11-15 23:33:00 +08:00
|
|
|
|
#define PROP4_NAME "Property 4"
|
|
|
|
|
double prop4_def=1.41; /* Property 4 default value */
|
|
|
|
|
#define PROP4_SIZE sizeof(prop4_def)
|
|
|
|
|
#define PROP4_DEF_VALUE (&prop4_def)
|
|
|
|
|
|
2000-11-14 08:06:14 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_basic_class(): Test basic generic property list code.
|
|
|
|
|
** Tests creating new generic classes.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-11-14 08:06:14 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2000-11-14 08:06:14 +08:00
|
|
|
|
test_genprop_basic_class(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
2000-11-15 07:13:36 +08:00
|
|
|
|
hid_t cid2; /* Generic Property class ID */
|
|
|
|
|
hid_t cid3; /* Generic Property class ID */
|
2000-11-14 08:06:14 +08:00
|
|
|
|
char *name; /* Name of class */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Class Creation Functionality\n"));
|
2000-11-14 08:06:14 +08:00
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2000-11-14 08:06:14 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Check class name */
|
|
|
|
|
name = H5Pget_class_name(cid1);
|
|
|
|
|
CHECK_PTR(name, "H5Pget_class_name");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(name,CLASS1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
|
2000-11-14 08:06:14 +08:00
|
|
|
|
free(name);
|
|
|
|
|
|
2000-11-15 07:13:36 +08:00
|
|
|
|
/* Check class parent */
|
|
|
|
|
cid2 = H5Pget_class_parent(cid1);
|
|
|
|
|
CHECK_I(cid2, "H5Pget_class_parent");
|
|
|
|
|
|
|
|
|
|
/* Verify class parent correct */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
ret = H5Pequal(cid2,H5P_ROOT);
|
2000-11-15 07:13:36 +08:00
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Make certain false postives aren't being returned */
|
2001-10-16 03:38:51 +08:00
|
|
|
|
ret = H5Pequal(cid2,H5P_FILE_CREATE);
|
2000-11-15 07:13:36 +08:00
|
|
|
|
VERIFY(ret, 0, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Close parent class */
|
|
|
|
|
ret = H5Pclose_class(cid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2000-11-14 08:06:14 +08:00
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Create another new generic class, derived from file creation class */
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_FILE_CREATE,CLASS2_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2000-11-14 08:06:14 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Check class name */
|
|
|
|
|
name = H5Pget_class_name(cid1);
|
|
|
|
|
CHECK_PTR(name, "H5Pget_class_name");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(name,CLASS2_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, name=%s, CLASS2_NAME=%s\n",name,CLASS2_NAME);
|
2000-11-14 08:06:14 +08:00
|
|
|
|
free(name);
|
|
|
|
|
|
2000-11-15 07:13:36 +08:00
|
|
|
|
/* Check class parent */
|
|
|
|
|
cid2 = H5Pget_class_parent(cid1);
|
|
|
|
|
CHECK_I(cid2, "H5Pget_class_parent");
|
|
|
|
|
|
|
|
|
|
/* Verify class parent correct */
|
2001-10-16 03:38:51 +08:00
|
|
|
|
ret = H5Pequal(cid2,H5P_FILE_CREATE);
|
2000-11-15 07:13:36 +08:00
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Check class parent's parent */
|
|
|
|
|
cid3 = H5Pget_class_parent(cid2);
|
|
|
|
|
CHECK_I(cid3, "H5Pget_class_parent");
|
|
|
|
|
|
|
|
|
|
/* Verify class parent's parent correct */
|
2005-11-15 10:55:39 +08:00
|
|
|
|
ret = H5Pequal(cid3,H5P_GROUP_CREATE);
|
2000-11-15 07:13:36 +08:00
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Close parent class's parent */
|
|
|
|
|
ret = H5Pclose_class(cid3);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
/* Close parent class */
|
|
|
|
|
ret = H5Pclose_class(cid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2000-11-14 08:06:14 +08:00
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
} /* end test_genprop_basic_class() */
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_basic_class_prop(): Test basic generic property list code.
|
|
|
|
|
** Tests adding properties to generic classes.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-11-15 10:27:15 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2000-11-15 10:27:15 +08:00
|
|
|
|
test_genprop_basic_class_prop(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
size_t size; /* Size of property */
|
|
|
|
|
size_t nprops; /* Number of properties in class */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Class Properties Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2000-11-15 10:27:15 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 0, "H5Pget_nprops");
|
|
|
|
|
|
2000-11-17 05:00:28 +08:00
|
|
|
|
/* Check the existance of the first property (should fail) */
|
|
|
|
|
ret = H5Pexist(cid1,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 0, "H5Pexist");
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Try to insert the first property again (should fail) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Pregister");
|
|
|
|
|
|
2000-11-17 05:00:28 +08:00
|
|
|
|
/* Check the existance of the first property */
|
|
|
|
|
ret = H5Pexist(cid1,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Check the size of the first property */
|
|
|
|
|
ret = H5Pget_size(cid1,PROP1_NAME,&size);
|
|
|
|
|
CHECK_I(ret, "H5Pget_size");
|
|
|
|
|
VERIFY(size, PROP1_SIZE, "H5Pget_size");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 1, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Try to insert the second property again (should fail) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
VERIFY(ret, FAIL, "H5Pregister");
|
|
|
|
|
|
2000-11-17 05:00:28 +08:00
|
|
|
|
/* Check the existance of the second property */
|
|
|
|
|
ret = H5Pexist(cid1,PROP2_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Check the size of the second property */
|
|
|
|
|
ret = H5Pget_size(cid1,PROP2_NAME,&size);
|
|
|
|
|
CHECK_I(ret, "H5Pget_size");
|
|
|
|
|
VERIFY(size, PROP2_SIZE, "H5Pget_size");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Insert third property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
2000-11-17 05:00:28 +08:00
|
|
|
|
/* Check the existance of the third property */
|
|
|
|
|
ret = H5Pexist(cid1,PROP3_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
2000-11-15 10:27:15 +08:00
|
|
|
|
/* Check the size of the third property */
|
|
|
|
|
ret = H5Pget_size(cid1,PROP3_NAME,&size);
|
|
|
|
|
CHECK_I(ret, "H5Pget_size");
|
|
|
|
|
VERIFY(size, PROP3_SIZE, "H5Pget_size");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 3, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Unregister first property */
|
|
|
|
|
ret = H5Punregister(cid1,PROP1_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Punregister");
|
|
|
|
|
|
|
|
|
|
/* Try to check the size of the first property (should fail) */
|
|
|
|
|
ret = H5Pget_size(cid1,PROP1_NAME,&size);
|
|
|
|
|
VERIFY(ret, FAIL, "H5Pget_size");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Unregister second property */
|
|
|
|
|
ret = H5Punregister(cid1,PROP2_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Punregister");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 1, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Unregister third property */
|
|
|
|
|
ret = H5Punregister(cid1,PROP3_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Punregister");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 0, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
} /* end test_genprop_basic_class_prop() */
|
|
|
|
|
|
2000-11-15 23:33:00 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_iter1(): Property iterator for test_genprop_class_iter
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-11-15 23:33:00 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static int
|
2000-11-15 23:33:00 +08:00
|
|
|
|
test_genprop_iter1(hid_t id, const char *name, void *iter_data)
|
|
|
|
|
{
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int iter_count;
|
|
|
|
|
const char **names;
|
|
|
|
|
} *iter_struct=iter_data;
|
|
|
|
|
|
|
|
|
|
/* Shut compiler up */
|
|
|
|
|
id=id;
|
|
|
|
|
|
|
|
|
|
return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_class_iter(): Test basic generic property list code.
|
|
|
|
|
** Tests iterating over properties in a generic class.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-11-15 23:33:00 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2000-11-15 23:33:00 +08:00
|
|
|
|
test_genprop_class_iter(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
size_t nprops; /* Number of properties in class */
|
|
|
|
|
int idx; /* Index to start iteration at */
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int iter_count;
|
|
|
|
|
const char **names;
|
|
|
|
|
} iter_struct;
|
|
|
|
|
const char *pnames[4]={ /* Names of properties for iterator */
|
|
|
|
|
PROP1_NAME,
|
|
|
|
|
PROP2_NAME,
|
|
|
|
|
PROP3_NAME,
|
|
|
|
|
PROP4_NAME};
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Class Property Iteration Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2000-11-15 23:33:00 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 23:33:00 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 23:33:00 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert third property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 23:33:00 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert third property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-11-15 23:33:00 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Iterate over all properties in class */
|
|
|
|
|
iter_struct.iter_count=0;
|
|
|
|
|
iter_struct.names=pnames;
|
|
|
|
|
ret = H5Piterate(cid1,NULL,test_genprop_iter1,&iter_struct);
|
|
|
|
|
VERIFY(ret, 0, "H5Piterate");
|
|
|
|
|
|
|
|
|
|
/* Iterate over last three properties in class */
|
2000-11-17 05:00:28 +08:00
|
|
|
|
idx=iter_struct.iter_count=1;
|
2000-11-15 23:33:00 +08:00
|
|
|
|
ret = H5Piterate(cid1,&idx,test_genprop_iter1,&iter_struct);
|
|
|
|
|
VERIFY(ret, 0, "H5Piterate");
|
|
|
|
|
VERIFY(idx, (int)nprops, "H5Piterate");
|
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
} /* end test_genprop_class_iter() */
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_cls_cb1(): Property List callback for test_genprop_class_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_cls_cb1(hid_t list_id, void *create_data)
|
|
|
|
|
{
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int count;
|
|
|
|
|
hid_t id;
|
|
|
|
|
} *count_struct=create_data;
|
|
|
|
|
|
|
|
|
|
count_struct->count++;
|
|
|
|
|
count_struct->id=list_id;
|
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-12-13 02:40:09 +08:00
|
|
|
|
test_genprop_cls_cb2(hid_t new_list_id, hid_t UNUSED old_list_id, void *create_data)
|
2001-10-04 01:57:56 +08:00
|
|
|
|
{
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int count;
|
|
|
|
|
hid_t id;
|
|
|
|
|
} *count_struct=create_data;
|
|
|
|
|
|
|
|
|
|
count_struct->count++;
|
|
|
|
|
count_struct->id=new_list_id;
|
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_class_callback(): Test basic generic property list code.
|
|
|
|
|
** Tests callbacks for property lists in a generic class.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_class_callback(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
|
|
|
|
hid_t lid2; /* Generic Property list ID */
|
|
|
|
|
size_t nprops; /* Number of properties in class */
|
|
|
|
|
struct { /* Struct for callbacks */
|
|
|
|
|
int count;
|
|
|
|
|
hid_t id;
|
|
|
|
|
} crt_cb_struct, cls_cb_struct;
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Class Callback Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,test_genprop_cls_cb1,&crt_cb_struct,NULL,NULL,test_genprop_cls_cb1,&cls_cb_struct);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert third property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert fourth property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Initialize class callback structs */
|
|
|
|
|
crt_cb_struct.count=0;
|
|
|
|
|
crt_cb_struct.id=(-1);
|
|
|
|
|
cls_cb_struct.count=0;
|
|
|
|
|
cls_cb_struct.id=(-1);
|
|
|
|
|
|
|
|
|
|
/* Create a property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify that the creation callback occurred */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
VERIFY(crt_cb_struct.count, 1, "H5Pcreate");
|
|
|
|
|
VERIFY(crt_cb_struct.id, lid1, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Create another property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid2 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid2, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify that the creation callback occurred */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
VERIFY(crt_cb_struct.count, 2, "H5Pcreate");
|
|
|
|
|
VERIFY(crt_cb_struct.id, lid2, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid2,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Close first list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify that the close callback occurred */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
VERIFY(cls_cb_struct.count, 1, "H5Pclose");
|
|
|
|
|
VERIFY(cls_cb_struct.id, lid1, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Close second list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify that the close callback occurred */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
VERIFY(cls_cb_struct.count, 2, "H5Pclose");
|
|
|
|
|
VERIFY(cls_cb_struct.id, lid2, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
} /* end test_genprop_class_callback() */
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_basic_list(): Test basic generic property list code.
|
|
|
|
|
** Tests creating new generic property lists.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-12-15 00:45:14 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2000-12-15 00:45:14 +08:00
|
|
|
|
test_genprop_basic_list(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t cid2; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
size_t nprops; /* Number of properties */
|
|
|
|
|
size_t size; /* Size of property */
|
|
|
|
|
int prop1_value; /* Value for property #1 */
|
|
|
|
|
float prop2_value; /* Value for property #2 */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Creation Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2000-12-15 00:45:14 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Add several properties (w/default values) */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
/* Create a property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Get the list's class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
cid2 = H5Pget_class(lid1);
|
|
|
|
|
CHECK_I(cid2, "H5Pget_class");
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Check that the list's class is correct */
|
|
|
|
|
ret = H5Pequal(cid1,cid2);
|
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Check correct "is a" class/list relationship */
|
|
|
|
|
ret = H5Pisa_class(lid1,cid1);
|
|
|
|
|
VERIFY(ret, 1, "H5Pisa_class");
|
|
|
|
|
|
|
|
|
|
/* Check "is a" class/list relationship another way */
|
|
|
|
|
ret = H5Pisa_class(lid1,cid2);
|
|
|
|
|
VERIFY(ret, 1, "H5Pisa_class");
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
/* Check existence of properties */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
ret = H5Pexist(lid1,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
ret = H5Pexist(lid1,PROP2_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check the sizes of the properties */
|
|
|
|
|
ret = H5Pget_size(lid1,PROP1_NAME,&size);
|
|
|
|
|
CHECK_I(ret, "H5Pget_size");
|
|
|
|
|
VERIFY(size, PROP1_SIZE, "H5Pget_size");
|
|
|
|
|
ret = H5Pget_size(lid1,PROP2_NAME,&size);
|
|
|
|
|
CHECK_I(ret, "H5Pget_size");
|
|
|
|
|
VERIFY(size, PROP2_SIZE, "H5Pget_size");
|
|
|
|
|
|
|
|
|
|
/* Check values of properties (set with default values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
ret = H5Pget(lid1,PROP2_NAME,&prop2_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Close list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
} /* end test_genprop_basic_list() */
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_basic_list_prop(): Test basic generic property list code.
|
|
|
|
|
** Tests creating new generic property lists and adding and
|
|
|
|
|
** removing properties from them.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_basic_list_prop(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
|
|
|
|
size_t nprops; /* Number of properties */
|
|
|
|
|
int prop1_value; /* Value for property #1 */
|
|
|
|
|
float prop2_value; /* Value for property #2 */
|
|
|
|
|
char prop3_value[10];/* Property #3 value */
|
|
|
|
|
double prop4_value; /* Property #4 value */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Property Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Add several properties (several w/default values) */
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Create a property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
/* Add temporary properties */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Insert first temporary property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pinsert");
|
|
|
|
|
|
|
|
|
|
/* Insert second temporary property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pinsert");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Check existence of all properties */
|
|
|
|
|
ret = H5Pexist(lid1,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
ret = H5Pexist(lid1,PROP2_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
ret = H5Pexist(lid1,PROP3_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
ret = H5Pexist(lid1,PROP4_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of permanent properties (set with default values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
ret = H5Pget(lid1,PROP2_NAME,&prop2_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Check values of temporary properties (set with regular values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP3_NAME,&prop3_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
ret = H5Pget(lid1,PROP4_NAME,&prop4_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Delete permanent property */
|
|
|
|
|
ret = H5Premove(lid1,PROP2_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Premove");
|
|
|
|
|
|
|
|
|
|
/* Check number of properties */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 3, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Delete temporary property */
|
|
|
|
|
ret = H5Premove(lid1,PROP3_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Premove");
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
/* Check number of properties */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Check existence of remaining properties */
|
|
|
|
|
ret = H5Pexist(lid1,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
ret = H5Pexist(lid1,PROP4_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of permanent properties (set with default values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Check values of temporary properties (set with regular values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP4_NAME,&prop4_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget");
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Close list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
} /* end test_genprop_basic_list_prop() */
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_iter2(): Property iterator for test_genprop_list_iter
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static int
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_iter2(hid_t id, const char *name, void *iter_data)
|
|
|
|
|
{
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int iter_count;
|
|
|
|
|
const char **names;
|
|
|
|
|
} *iter_struct=iter_data;
|
|
|
|
|
|
|
|
|
|
/* Shut compiler up */
|
|
|
|
|
id=id;
|
|
|
|
|
|
|
|
|
|
return(HDstrcmp(name,iter_struct->names[iter_struct->iter_count++]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_list_iter(): Test basic generic property list code.
|
|
|
|
|
** Tests iterating over generic property list properties.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_list_iter(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
|
|
|
|
size_t nprops; /* Number of properties */
|
|
|
|
|
int idx; /* Index to start iteration at */
|
|
|
|
|
struct { /* Struct for iterations */
|
|
|
|
|
int iter_count;
|
|
|
|
|
const char **names;
|
|
|
|
|
} iter_struct;
|
|
|
|
|
const char *pnames[4]={ /* Names of properties for iterator */
|
|
|
|
|
PROP3_NAME,
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
PROP4_NAME,
|
|
|
|
|
PROP1_NAME,
|
|
|
|
|
PROP2_NAME
|
|
|
|
|
};
|
2001-02-28 06:27:45 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Generic Property List Iteration Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Add several properties (several w/default values) */
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Create a property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 2, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Add temporary properties */
|
|
|
|
|
|
|
|
|
|
/* Insert first temporary property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pinsert(lid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pinsert");
|
|
|
|
|
|
|
|
|
|
/* Insert second temporary property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pinsert(lid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pinsert");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in list */
|
|
|
|
|
ret = H5Pget_nprops(lid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
|
|
|
|
/* Iterate over all properties in list */
|
|
|
|
|
iter_struct.iter_count=0;
|
|
|
|
|
iter_struct.names=pnames;
|
|
|
|
|
ret = H5Piterate(lid1,NULL,test_genprop_iter2,&iter_struct);
|
|
|
|
|
VERIFY(ret, 0, "H5Piterate");
|
|
|
|
|
|
|
|
|
|
/* Iterate over last three properties in list */
|
|
|
|
|
idx=iter_struct.iter_count=1;
|
|
|
|
|
ret = H5Piterate(lid1,&idx,test_genprop_iter2,&iter_struct);
|
|
|
|
|
VERIFY(ret, 0, "H5Piterate");
|
|
|
|
|
VERIFY(idx, (int)nprops, "H5Piterate");
|
|
|
|
|
|
|
|
|
|
/* Close list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
} /* end test_genprop_list_iter() */
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
/* Creation information */
|
|
|
|
|
int crt_count;
|
|
|
|
|
char *crt_name;
|
|
|
|
|
void *crt_value;
|
|
|
|
|
|
|
|
|
|
/* Set information */
|
|
|
|
|
int set_count;
|
|
|
|
|
hid_t set_plist_id;
|
|
|
|
|
char *set_name;
|
|
|
|
|
void *set_value;
|
|
|
|
|
|
|
|
|
|
/* Get information */
|
|
|
|
|
int get_count;
|
|
|
|
|
hid_t get_plist_id;
|
|
|
|
|
char *get_name;
|
|
|
|
|
void *get_value;
|
|
|
|
|
|
|
|
|
|
/* Delete information */
|
|
|
|
|
int del_count;
|
|
|
|
|
hid_t del_plist_id;
|
|
|
|
|
char *del_name;
|
|
|
|
|
void *del_value;
|
|
|
|
|
|
2001-08-11 04:47:05 +08:00
|
|
|
|
/* Copy information */
|
|
|
|
|
int cop_count;
|
|
|
|
|
char *cop_name;
|
|
|
|
|
void *cop_value;
|
|
|
|
|
|
2004-01-08 22:55:11 +08:00
|
|
|
|
/* Compare information */
|
|
|
|
|
int cmp_count;
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Close information */
|
|
|
|
|
int cls_count;
|
|
|
|
|
char *cls_name;
|
|
|
|
|
void *cls_value;
|
|
|
|
|
} prop_cb_info;
|
|
|
|
|
|
|
|
|
|
/* Global variables for Callback information */
|
|
|
|
|
prop_cb_info prop1_cb_info; /* Callback statistics for property #1 */
|
|
|
|
|
prop_cb_info prop2_cb_info; /* Callback statistics for property #2 */
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_crt_cb1(): Property creation callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_crt_cb1(const char *name, size_t size, void *def_value)
|
2001-02-28 06:27:45 +08:00
|
|
|
|
{
|
|
|
|
|
/* Set the information from the creation call */
|
|
|
|
|
prop1_cb_info.crt_count++;
|
|
|
|
|
prop1_cb_info.crt_name=HDstrdup(name);
|
2001-08-11 04:47:05 +08:00
|
|
|
|
prop1_cb_info.crt_value=HDmalloc(size);
|
|
|
|
|
HDmemcpy(prop1_cb_info.crt_value,def_value,size);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_set_cb1(): Property set callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_set_cb1(hid_t plist_id, const char *name, size_t size, void *value)
|
2001-02-28 06:27:45 +08:00
|
|
|
|
{
|
|
|
|
|
/* Set the information from the set call */
|
|
|
|
|
prop1_cb_info.set_count++;
|
|
|
|
|
prop1_cb_info.set_plist_id=plist_id;
|
|
|
|
|
if(prop1_cb_info.set_name==NULL)
|
|
|
|
|
prop1_cb_info.set_name=HDstrdup(name);
|
|
|
|
|
if(prop1_cb_info.set_value==NULL)
|
2001-08-11 04:47:05 +08:00
|
|
|
|
prop1_cb_info.set_value=HDmalloc(size);
|
|
|
|
|
HDmemcpy(prop1_cb_info.set_value,value,size);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_get_cb1(): Property get callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_get_cb1(hid_t plist_id, const char *name, size_t size, void *value)
|
2001-02-28 06:27:45 +08:00
|
|
|
|
{
|
|
|
|
|
/* Set the information from the get call */
|
|
|
|
|
prop1_cb_info.get_count++;
|
|
|
|
|
prop1_cb_info.get_plist_id=plist_id;
|
|
|
|
|
if(prop1_cb_info.get_name==NULL)
|
|
|
|
|
prop1_cb_info.get_name=HDstrdup(name);
|
|
|
|
|
if(prop1_cb_info.get_value==NULL)
|
2001-08-11 04:47:05 +08:00
|
|
|
|
prop1_cb_info.get_value=HDmalloc(size);
|
|
|
|
|
HDmemcpy(prop1_cb_info.get_value,value,size);
|
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_cop_cb1(): Property copy callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-08-11 04:47:05 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_cop_cb1(const char *name, size_t size, void *value)
|
|
|
|
|
{
|
|
|
|
|
/* Set the information from the get call */
|
|
|
|
|
prop1_cb_info.cop_count++;
|
|
|
|
|
if(prop1_cb_info.cop_name==NULL)
|
|
|
|
|
prop1_cb_info.cop_name=HDstrdup(name);
|
|
|
|
|
if(prop1_cb_info.cop_value==NULL)
|
|
|
|
|
prop1_cb_info.cop_value=HDmalloc(size);
|
|
|
|
|
HDmemcpy(prop1_cb_info.cop_value,value,size);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-10 03:17:40 +08:00
|
|
|
|
#ifndef H5_WANT_H5_V1_6_COMPAT
|
2004-01-08 22:55:11 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_cmp_cb1(): Property comparison callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2004-01-08 22:55:11 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static int
|
2004-01-08 22:55:11 +08:00
|
|
|
|
test_genprop_prop_cmp_cb1(const void UNUSED *value1, const void UNUSED *value2, size_t UNUSED size)
|
|
|
|
|
{
|
|
|
|
|
/* Set the information from the comparison call */
|
|
|
|
|
prop1_cb_info.cmp_count++;
|
|
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
|
}
|
2004-01-10 03:17:40 +08:00
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_cls_cb1(): Property close callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_cls_cb1(const char *name, size_t size, void *value)
|
2001-02-28 06:27:45 +08:00
|
|
|
|
{
|
|
|
|
|
/* Set the information from the close call */
|
|
|
|
|
prop1_cb_info.cls_count++;
|
2001-10-06 06:29:20 +08:00
|
|
|
|
if(prop1_cb_info.cls_name==NULL)
|
|
|
|
|
prop1_cb_info.cls_name=HDstrdup(name);
|
|
|
|
|
if(prop1_cb_info.cls_value==NULL)
|
|
|
|
|
prop1_cb_info.cls_value=HDmalloc(size);
|
2001-08-11 04:47:05 +08:00
|
|
|
|
HDmemcpy(prop1_cb_info.cls_value,value,size);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_prop_del_cb2(): Property delete callback for test_genprop_list_callback
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static herr_t
|
2001-08-11 04:47:05 +08:00
|
|
|
|
test_genprop_prop_del_cb2(hid_t plist_id, const char *name, size_t size, void *value)
|
2001-02-28 06:27:45 +08:00
|
|
|
|
{
|
|
|
|
|
/* Set the information from the delete call */
|
|
|
|
|
prop2_cb_info.del_count++;
|
|
|
|
|
prop2_cb_info.del_plist_id=plist_id;
|
|
|
|
|
prop2_cb_info.del_name=HDstrdup(name);
|
2001-08-11 04:47:05 +08:00
|
|
|
|
prop2_cb_info.del_value=HDmalloc(size);
|
|
|
|
|
HDmemcpy(prop2_cb_info.del_value,value,size);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
return(SUCCEED);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_list_callback(): Test basic generic property list code.
|
|
|
|
|
** Tests callbacks for properties in a generic property list.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2001-02-28 06:27:45 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_list_callback(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
2001-08-11 04:47:05 +08:00
|
|
|
|
hid_t lid2; /* 2nd Generic Property list ID */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
size_t nprops; /* Number of properties in class */
|
|
|
|
|
int prop1_value; /* Value for property #1 */
|
|
|
|
|
int prop1_new_value=20; /* Property #1 new value */
|
|
|
|
|
float prop2_value; /* Value for property #2 */
|
|
|
|
|
char prop3_value[10];/* Property #3 value */
|
|
|
|
|
double prop4_value; /* Property #4 value */
|
2001-08-11 04:47:05 +08:00
|
|
|
|
struct { /* Struct for callbacks */
|
|
|
|
|
int count;
|
|
|
|
|
hid_t id;
|
|
|
|
|
} cop_cb_struct;
|
2001-02-28 06:27:45 +08:00
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Property Callback Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,test_genprop_cls_cb2,&cop_cb_struct,NULL,NULL);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cls_cb1);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,test_genprop_prop_crt_cb1,test_genprop_prop_set_cb1,test_genprop_prop_get_cb1,NULL,test_genprop_prop_cop_cb1,test_genprop_prop_cmp_cb1,test_genprop_prop_cls_cb1);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with only delete callback) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,test_genprop_prop_del_cb2,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert third property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP3_NAME,PROP3_SIZE,PROP3_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert fourth property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2001-08-11 04:47:05 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP4_NAME,PROP4_SIZE,PROP4_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Check the number of properties in class */
|
|
|
|
|
ret = H5Pget_nprops(cid1,&nprops);
|
|
|
|
|
CHECK_I(ret, "H5Pget_nprops");
|
|
|
|
|
VERIFY(nprops, 4, "H5Pget_nprops");
|
|
|
|
|
|
2001-08-11 04:47:05 +08:00
|
|
|
|
/* Initialize class callback structs */
|
|
|
|
|
cop_cb_struct.count=0;
|
|
|
|
|
cop_cb_struct.id=(-1);
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Initialize callback information for properties tracked */
|
|
|
|
|
HDmemset(&prop1_cb_info,0,sizeof(prop_cb_info));
|
2001-08-11 04:47:05 +08:00
|
|
|
|
HDmemset(&prop2_cb_info,0,sizeof(prop_cb_info));
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Create a property list from the class */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify creation callback information for properties tracked */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
VERIFY(prop1_cb_info.crt_count, 1, "H5Pcreate");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.crt_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.crt_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check values of permanent properties (set with default values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
ret = H5Pget(lid1,PROP2_NAME,&prop2_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop2_value, *PROP2_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Check values of temporary properties (set with regular values) */
|
|
|
|
|
ret = H5Pget(lid1,PROP3_NAME,&prop3_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDmemcmp(&prop3_value,PROP3_DEF_VALUE,PROP3_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #3 doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
ret = H5Pget(lid1,PROP4_NAME,&prop4_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop4_value, *PROP4_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Verify get callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.get_count, 1, "H5Pget");
|
|
|
|
|
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.get_value,PROP1_DEF_VALUE,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Set value of property #1 to different value */
|
|
|
|
|
ret = H5Pset(lid1,PROP1_NAME,&prop1_new_value);
|
|
|
|
|
CHECK_I(ret, "H5Pset");
|
|
|
|
|
|
|
|
|
|
/* Verify set callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.set_count, 1, "H5Pset");
|
|
|
|
|
VERIFY(prop1_cb_info.set_plist_id, lid1, "H5Pset");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.set_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.set_value,&prop1_new_value,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Check new value of tracked properties */
|
|
|
|
|
ret = H5Pget(lid1,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, prop1_new_value, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Verify get callback information again for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.get_count, 2, "H5Pget");
|
|
|
|
|
VERIFY(prop1_cb_info.get_plist_id, lid1, "H5Pget");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.get_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.get_value,&prop1_new_value,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Delete property #2 */
|
|
|
|
|
ret = H5Premove(lid1,PROP2_NAME);
|
|
|
|
|
CHECK_I(ret, "H5Premove");
|
|
|
|
|
|
|
|
|
|
/* Verify delete callback information for properties tracked */
|
|
|
|
|
VERIFY(prop2_cb_info.del_count, 1, "H5Premove");
|
|
|
|
|
VERIFY(prop2_cb_info.del_plist_id, lid1, "H5Premove");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop2_cb_info.del_name,PROP2_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #2 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop2_cb_info.del_value,PROP2_DEF_VALUE,PROP2_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #2 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
2001-08-11 04:47:05 +08:00
|
|
|
|
/* Copy first list */
|
|
|
|
|
lid2 = H5Pcopy(lid1);
|
|
|
|
|
CHECK_I(lid2, "H5Pcopy");
|
|
|
|
|
|
|
|
|
|
/* Verify copy callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.cop_count, 1, "H5Pcopy");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.cop_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.cop_value,&prop1_new_value,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-08-11 04:47:05 +08:00
|
|
|
|
|
|
|
|
|
/* Verify that the class creation callback occurred */
|
|
|
|
|
VERIFY(cop_cb_struct.count, 1, "H5Pcopy");
|
|
|
|
|
VERIFY(cop_cb_struct.id, lid2, "H5Pcopy");
|
|
|
|
|
|
2004-01-10 03:17:40 +08:00
|
|
|
|
#ifndef H5_WANT_H5_V1_6_COMPAT
|
2004-01-08 22:55:11 +08:00
|
|
|
|
/* Compare the two lists */
|
|
|
|
|
ret = H5Pequal(lid1,lid2);
|
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Verify compare callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.cmp_count, 1, "H5Pequal");
|
2004-01-10 03:17:40 +08:00
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Close first list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
|
|
|
|
/* Verify close callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.cls_count, 1, "H5Pclose");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(prop1_cb_info.cls_name,PROP1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 name doesn't match!, line=%d\n",__LINE__);
|
|
|
|
|
if(HDmemcmp(prop1_cb_info.cls_value,&prop1_new_value,PROP1_SIZE)!=0)
|
|
|
|
|
TestErrPrintf("Property #1 value doesn't match!, line=%d\n",__LINE__);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
|
2001-10-06 06:29:20 +08:00
|
|
|
|
/* Close second list */
|
2001-11-03 03:47:41 +08:00
|
|
|
|
ret = H5Pclose(lid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
2001-10-06 06:29:20 +08:00
|
|
|
|
|
|
|
|
|
/* Verify close callback information for properties tracked */
|
|
|
|
|
VERIFY(prop1_cb_info.cls_count, 2, "H5Pclose");
|
|
|
|
|
|
2001-02-28 06:27:45 +08:00
|
|
|
|
/* Free memory allocated for tracking properties */
|
|
|
|
|
HDfree(prop1_cb_info.crt_name);
|
|
|
|
|
HDfree(prop1_cb_info.crt_value);
|
|
|
|
|
HDfree(prop1_cb_info.get_name);
|
|
|
|
|
HDfree(prop1_cb_info.get_value);
|
|
|
|
|
HDfree(prop1_cb_info.set_name);
|
|
|
|
|
HDfree(prop1_cb_info.set_value);
|
2001-08-11 04:47:05 +08:00
|
|
|
|
HDfree(prop1_cb_info.cop_name);
|
|
|
|
|
HDfree(prop1_cb_info.cop_value);
|
2001-02-28 06:27:45 +08:00
|
|
|
|
HDfree(prop1_cb_info.cls_name);
|
|
|
|
|
HDfree(prop1_cb_info.cls_value);
|
|
|
|
|
HDfree(prop2_cb_info.del_name);
|
|
|
|
|
HDfree(prop2_cb_info.del_value);
|
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
} /* end test_genprop_list_callback() */
|
2000-12-15 00:45:14 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_list_addprop(): Test adding properties to a
|
|
|
|
|
** standard HDF5 property list and verify that the library
|
|
|
|
|
** ignores the extra properties.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-02-07 00:08:29 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-02-07 00:08:29 +08:00
|
|
|
|
test_genprop_list_addprop(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid; /* File ID */
|
|
|
|
|
hid_t did; /* Dataset ID */
|
|
|
|
|
hid_t sid; /* Dataspace ID */
|
|
|
|
|
hid_t pid; /* Property List ID */
|
|
|
|
|
int prop1_value; /* Value for property #1 */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create scalar dataspace for dataset */
|
|
|
|
|
sid = H5Screate(H5S_SCALAR);
|
|
|
|
|
CHECK(sid, FAIL, "H5Screate");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset creation property list */
|
|
|
|
|
pid = H5Pcreate(H5P_DATASET_CREATE);
|
|
|
|
|
CHECK(pid, FAIL, "H5Pcreate");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Insert temporary property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-02-07 00:08:29 +08:00
|
|
|
|
ret = H5Pinsert(pid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pinsert(pid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-02-07 00:08:29 +08:00
|
|
|
|
CHECK_I(ret, "H5Pinsert");
|
|
|
|
|
|
|
|
|
|
/* Check existence of added property */
|
|
|
|
|
ret = H5Pexist(pid,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of property (set with default value) */
|
|
|
|
|
ret = H5Pget(pid,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
|
|
|
|
did=H5Dcreate(fid,"Dataset1",H5T_NATIVE_INT,sid,pid);
|
|
|
|
|
CHECK(did, FAIL, "H5Dcreate");
|
|
|
|
|
|
|
|
|
|
/* Check existence of added property (after using property list) */
|
|
|
|
|
ret = H5Pexist(pid,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of property (set with default value) (after using property list) */
|
|
|
|
|
ret = H5Pget(pid,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Close property list */
|
|
|
|
|
ret = H5Pclose(pid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
} /* end test_genprop_list_addprop() */
|
|
|
|
|
|
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_class_addprop(): Test adding properties to a
|
|
|
|
|
** standard HDF5 property class and verify that the library
|
|
|
|
|
** ignores the extra properties and continues to recognize the
|
|
|
|
|
** derived class as a valid version of the derived-from class.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-02-07 00:08:29 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-02-07 00:08:29 +08:00
|
|
|
|
test_genprop_class_addprop(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t fid; /* File ID */
|
|
|
|
|
hid_t did; /* Dataset ID */
|
|
|
|
|
hid_t sid; /* Dataspace ID */
|
|
|
|
|
hid_t cid; /* Property Class ID */
|
|
|
|
|
hid_t pid; /* Property List ID */
|
|
|
|
|
int prop1_value; /* Value for property #1 */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Create file */
|
|
|
|
|
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
|
|
|
|
CHECK(fid, FAIL, "H5Fcreate");
|
|
|
|
|
|
|
|
|
|
/* Create scalar dataspace for dataset */
|
|
|
|
|
sid = H5Screate(H5S_SCALAR);
|
|
|
|
|
CHECK(sid, FAIL, "H5Screate");
|
|
|
|
|
|
|
|
|
|
/* Create a new class, dervied from the dataset creation property list class */
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
cid = H5Pcreate_class(H5P_DATASET_CREATE,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2002-02-07 00:08:29 +08:00
|
|
|
|
CHECK_I(cid, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Check existence of an original property */
|
|
|
|
|
ret = H5Pexist(cid,H5D_CRT_DATA_PIPELINE_NAME);
|
2002-02-08 03:55:43 +08:00
|
|
|
|
VERIFY(ret, 0, "H5Pexist");
|
2002-02-07 00:08:29 +08:00
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-02-07 00:08:29 +08:00
|
|
|
|
ret = H5Pregister(cid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-02-07 00:08:29 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Create a derived dataset creation property list */
|
|
|
|
|
pid = H5Pcreate(cid);
|
|
|
|
|
CHECK(pid, FAIL, "H5Pcreate");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Check existence of an original property */
|
|
|
|
|
ret = H5Pexist(pid,H5D_CRT_DATA_PIPELINE_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check existence of added property */
|
|
|
|
|
ret = H5Pexist(pid,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of property (set with default value) */
|
|
|
|
|
ret = H5Pget(pid,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Create a dataset */
|
|
|
|
|
did=H5Dcreate(fid,"Dataset1",H5T_NATIVE_INT,sid,pid);
|
|
|
|
|
CHECK(did, FAIL, "H5Dcreate");
|
|
|
|
|
|
|
|
|
|
/* Check existence of added property (after using property list) */
|
|
|
|
|
ret = H5Pexist(pid,PROP1_NAME);
|
|
|
|
|
VERIFY(ret, 1, "H5Pexist");
|
|
|
|
|
|
|
|
|
|
/* Check values of property (set with default value) (after using property list) */
|
|
|
|
|
ret = H5Pget(pid,PROP1_NAME,&prop1_value);
|
|
|
|
|
CHECK_I(ret, "H5Pget");
|
|
|
|
|
VERIFY(prop1_value, *PROP1_DEF_VALUE, "H5Pget");
|
|
|
|
|
|
|
|
|
|
/* Close property class */
|
|
|
|
|
ret = H5Pclose_class(cid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Close property list */
|
|
|
|
|
ret = H5Pclose(pid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Pclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Close disk dataspace */
|
|
|
|
|
ret = H5Sclose(sid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Sclose");
|
2005-08-14 04:53:35 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
/* Close Dataset */
|
|
|
|
|
ret = H5Dclose(did);
|
|
|
|
|
CHECK(ret, FAIL, "H5Dclose");
|
|
|
|
|
|
|
|
|
|
/* Close file */
|
|
|
|
|
ret = H5Fclose(fid);
|
|
|
|
|
CHECK(ret, FAIL, "H5Fclose");
|
|
|
|
|
|
|
|
|
|
} /* end test_genprop_class_addprop() */
|
|
|
|
|
|
2002-10-08 01:55:55 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
2002-10-08 22:08:10 +08:00
|
|
|
|
** test_genprop_equal(): Test basic generic property list code.
|
2002-10-08 01:55:55 +08:00
|
|
|
|
** More tests for H5Pequal()
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-10-08 01:55:55 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-10-08 01:55:55 +08:00
|
|
|
|
test_genprop_equal(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property list ID */
|
|
|
|
|
hid_t lid2; /* Generic Property list ID */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Basic Generic Property List Equal Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2002-10-08 01:55:55 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-10-08 01:55:55 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-10-08 01:55:55 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-10-08 01:55:55 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-10-08 01:55:55 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Create a property list from the class */
|
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
|
|
|
|
|
|
|
|
|
/* Copy the property list */
|
|
|
|
|
lid2 = H5Pcopy(lid1);
|
|
|
|
|
CHECK_I(lid2, "H5Pcopy");
|
|
|
|
|
|
|
|
|
|
/* Check that the lists are equal */
|
|
|
|
|
ret = H5Pequal(lid1,lid2);
|
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
} /* ent test_genprop_equal() */
|
|
|
|
|
|
2002-10-08 22:08:10 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_path(): Test basic generic property list code.
|
|
|
|
|
** Tests for class paths
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-10-08 22:08:10 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-10-08 22:08:10 +08:00
|
|
|
|
test_genprop_path(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t cid2; /* Generic Property class ID */
|
2002-10-09 01:16:07 +08:00
|
|
|
|
hid_t cid3; /* Generic Property class ID */
|
2002-10-08 22:08:10 +08:00
|
|
|
|
char *path; /* Class path */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Generic Property List Class Path Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2002-10-08 22:08:10 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-10-08 22:08:10 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-10-08 22:08:10 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Get full path for first class */
|
2002-10-09 01:16:07 +08:00
|
|
|
|
path=H5P_get_class_path_test(cid1);
|
|
|
|
|
CHECK_PTR(path, "H5P_get_class_path_test");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(path,CLASS1_PATH)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH);
|
|
|
|
|
HDfree(path);
|
2002-10-08 22:08:10 +08:00
|
|
|
|
|
|
|
|
|
/* Create another new generic class, derived from first class */
|
[svn-r6252] Purpose:
Lots of performance improvements & a couple new internal API interfaces.
Description:
Performance Improvements:
- Cached file offset & length sizes in shared file struct, to avoid
constantly looking them up in the FCPL.
- Generic property improvements:
- Added "revision" number to generic property classes to speed
up comparisons.
- Changed method of storing properties from using a hash-table
to the TBBT routines in the library.
- Share the propery names between classes and the lists derived
from them.
- Removed redundant 'def_value' buffer from each property.
- Switching code to use a "copy on write" strategy for
properties in each list, where the properties in each list
are shared with the properties in the class, until a
property's value is changed in a list.
- Fixed error in layout code which was allocating too many buffers.
- Redefined public macros of the form (H5open()/H5check, <variable>)
internally to only be (<variable>), avoiding innumerable useless
calls to H5open() and H5check_version().
- Reuse already zeroed buffers in H5F_contig_fill instead of
constantly re-zeroing them.
- Don't write fill values if writing entire dataset.
- Use gettimeofday() system call instead of time() system when
checking the modification time of a dataset.
- Added reference counted string API and use it for tracking the
names of objects opening in a file (for the ID->name code).
- Removed redundant H5P_get() calls in B-tree routines.
- Redefine H5T datatype macros internally to the library, to avoid
calling H5check redundantly.
- Keep dataspace information for dataset locally instead of reading
from disk each time. Added new module to track open objects
in a file, to allow this (which will be useful eventually for
some FPH5 metadata caching issues).
- Remove H5AC_find macro which was inlining metadata cache lookups,
and call function instead.
- Remove redundant memset() calls from H5G_namei() routine.
- Remove redundant checking of object type when locating objects
in metadata cache and rely on the address only.
- Create default dataset object to use when default dataset creation
property list is used to create datasets, bypassing querying
for all the property list values.
- Use default I/O vector size when performing raw data with the
default dataset transfer property list, instead of querying for
I/O vector size.
- Remove H5P_DEFAULT internally to the library, replacing it with
more specific default property list based on the type of
property list needed.
- Remove redundant memset() calls in object header message (H5O*)
routines.
- Remove redunant memset() calls in data I/O routines.
- Split free-list allocation routines into malloc() and calloc()-
like routines, instead of one combined routine.
- Remove lots of indirection in H5O*() routines.
- Simplify metadata cache entry comparison routine (used when
flushing entire cache out).
- Only enable metadata cache statistics when H5AC_DEBUG is turned
on, instead of always tracking them.
- Simplify address comparison macro (H5F_addr_eq).
- Remove redundant metadata cache entry protections during dataset
creation by protecting the object header once and making all
the modifications necessary for the dataset creation before
unprotecting it.
- Reduce # of "number of element in extent" computations performed
by computing and storing the value during dataspace creation.
- Simplify checking for group location's file information, when file
has not been involving in file-mounting operations.
- Use binary encoding for modification time, instead of ASCII.
- Hoist H5HL_peek calls (to get information in a local heap)
out of loops in many group routine.
- Use static variable for iterators of selections, instead of
dynamically allocation them each time.
- Lookup & insert new entries in one step, avoiding traversing
group's B-tree twice.
- Fixed memory leak in H5Gget_objname_idx() routine (tangential to
performance improvements, but fixed along the way).
- Use free-list for reference counted strings.
- Don't bother copying object names into cached group entries,
since they are re-created when an object is opened.
The benchmark I used to measure these results created several thousand
small (2K) datasets in a file and wrote out the data for them. This is
Elena's "regular.c" benchmark.
These changes resulted in approximately ~4.3x speedup of the
development branch when compared to the previous code in the
development branch and ~1.4x speedup compared to the release
branch.
Additionally, these changes reduce the total memory used (code and
data) by the development branch by ~800KB, bringing the development
branch back into the same ballpark as the release branch.
I'll send out a more detailed description of the benchmark results
as a followup note.
New internal API routines:
Added "reference counted strings" API for tracking strings that get
used by multiple owners without duplicating the strings.
Added "ternary search tree" API for text->object mappings.
Platforms tested:
Tested h5committest {arabica (fortran), eirene (fortran, C++)
modi4 (parallel, fortran)}
Other platforms/configurations tested?
FreeBSD 4.7 (sleipnir) serial & parallel
Solaris 2.6 (baldric) serial
2003-01-10 01:20:03 +08:00
|
|
|
|
cid2 = H5Pcreate_class(cid1,CLASS2_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2002-10-08 22:08:10 +08:00
|
|
|
|
CHECK_I(cid2, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert second property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-10-08 22:08:10 +08:00
|
|
|
|
ret = H5Pregister(cid2,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid2,PROP2_NAME,PROP2_SIZE,PROP2_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-10-08 22:08:10 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Get full path for second class */
|
2002-10-09 01:16:07 +08:00
|
|
|
|
path=H5P_get_class_path_test(cid2);
|
|
|
|
|
CHECK_PTR(path, "H5P_get_class_path_test");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(path,CLASS2_PATH)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, path=%s, CLASS2_PATH=%s\n",path,CLASS2_PATH);
|
2002-10-09 01:16:07 +08:00
|
|
|
|
|
|
|
|
|
/* Open a copy of the class with the path name */
|
|
|
|
|
cid3 = H5P_open_class_path_test(path);
|
|
|
|
|
CHECK_I(cid3, "H5Popen_class_path");
|
|
|
|
|
|
|
|
|
|
/* Check that the classes are equal */
|
|
|
|
|
ret = H5Pequal(cid2,cid3);
|
|
|
|
|
VERIFY(ret, 1, "H5Pequal");
|
|
|
|
|
|
|
|
|
|
/* Release the path string */
|
2002-10-08 22:08:10 +08:00
|
|
|
|
free(path);
|
|
|
|
|
|
2002-10-09 01:16:07 +08:00
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid3);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
2002-10-08 22:08:10 +08:00
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid2);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
} /* ent test_genprop_path() */
|
|
|
|
|
|
2002-10-15 03:59:00 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop_refcount(): Test basic generic property list code.
|
|
|
|
|
** Tests for correct reference counting
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2002-10-15 03:59:00 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
static void
|
2002-10-15 03:59:00 +08:00
|
|
|
|
test_genprop_refcount(void)
|
|
|
|
|
{
|
|
|
|
|
hid_t cid1; /* Generic Property class ID */
|
|
|
|
|
hid_t lid1; /* Generic Property class ID */
|
|
|
|
|
char *name; /* Name of class */
|
|
|
|
|
herr_t ret; /* Generic return value */
|
|
|
|
|
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Generic Property List Reference Count Functionality\n"));
|
|
|
|
|
|
|
|
|
|
/* Create a new generic class, derived from the root of the class hierarchy */
|
2006-11-02 12:54:19 +08:00
|
|
|
|
cid1 = H5Pcreate_class(H5P_ROOT,CLASS1_NAME,NULL,NULL,NULL,NULL,NULL,NULL);
|
2002-10-15 03:59:00 +08:00
|
|
|
|
CHECK_I(cid1, "H5Pcreate_class");
|
|
|
|
|
|
|
|
|
|
/* Insert first property into class (with no callbacks) */
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#ifdef H5_WANT_H5_V1_6_COMPAT
|
2002-10-15 03:59:00 +08:00
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL);
|
2004-01-08 22:55:11 +08:00
|
|
|
|
#else /* H5_WANT_H5_V1_6_COMPAT */
|
|
|
|
|
ret = H5Pregister(cid1,PROP1_NAME,PROP1_SIZE,PROP1_DEF_VALUE,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
|
|
|
|
|
#endif /* H5_WANT_H5_V1_6_COMPAT */
|
2002-10-15 03:59:00 +08:00
|
|
|
|
CHECK_I(ret, "H5Pregister");
|
|
|
|
|
|
|
|
|
|
/* Create a new generic list, derived from the root of the class hierarchy */
|
|
|
|
|
lid1 = H5Pcreate(cid1);
|
|
|
|
|
CHECK_I(lid1, "H5Pcreate");
|
|
|
|
|
|
|
|
|
|
/* Check class name */
|
|
|
|
|
name = H5Pget_class_name(cid1);
|
|
|
|
|
CHECK_PTR(name, "H5Pget_class_name");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(name,CLASS1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
|
|
|
|
|
HDfree(name);
|
2002-10-15 03:59:00 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
/* Get the list's class */
|
|
|
|
|
cid1 = H5Pget_class(lid1);
|
|
|
|
|
CHECK_I(cid1, "H5Pget_class");
|
|
|
|
|
|
|
|
|
|
/* Check correct "is a" class/list relationship */
|
|
|
|
|
ret = H5Pisa_class(lid1,cid1);
|
|
|
|
|
VERIFY(ret, 1, "H5Pisa_class");
|
|
|
|
|
|
|
|
|
|
/* Check class name */
|
|
|
|
|
name = H5Pget_class_name(cid1);
|
|
|
|
|
CHECK_PTR(name, "H5Pget_class_name");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(name,CLASS1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
|
|
|
|
|
HDfree(name);
|
2002-10-15 03:59:00 +08:00
|
|
|
|
|
|
|
|
|
/* Close list */
|
|
|
|
|
ret = H5Pclose(lid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose");
|
|
|
|
|
|
|
|
|
|
/* Check class name */
|
|
|
|
|
name = H5Pget_class_name(cid1);
|
|
|
|
|
CHECK_PTR(name, "H5Pget_class_name");
|
2004-01-10 09:41:13 +08:00
|
|
|
|
if(HDstrcmp(name,CLASS1_NAME)!=0)
|
|
|
|
|
TestErrPrintf("Class names don't match!, name=%s, CLASS1_NAME=%s\n",name,CLASS1_NAME);
|
|
|
|
|
HDfree(name);
|
2002-10-15 03:59:00 +08:00
|
|
|
|
|
|
|
|
|
/* Close class */
|
|
|
|
|
ret = H5Pclose_class(cid1);
|
|
|
|
|
CHECK_I(ret, "H5Pclose_class");
|
|
|
|
|
|
|
|
|
|
} /* ent test_genprop_refcount() */
|
|
|
|
|
|
2000-11-12 08:10:08 +08:00
|
|
|
|
/****************************************************************
|
|
|
|
|
**
|
|
|
|
|
** test_genprop(): Main generic property testing routine.
|
2005-08-14 04:53:35 +08:00
|
|
|
|
**
|
2000-11-12 08:10:08 +08:00
|
|
|
|
****************************************************************/
|
2005-08-14 04:53:35 +08:00
|
|
|
|
void
|
2000-11-12 08:10:08 +08:00
|
|
|
|
test_genprop(void)
|
|
|
|
|
{
|
|
|
|
|
/* Output message about test being performed */
|
|
|
|
|
MESSAGE(5, ("Testing Generic Properties\n"));
|
|
|
|
|
|
|
|
|
|
/* These tests use the same file... */
|
2000-11-14 08:06:14 +08:00
|
|
|
|
test_genprop_basic_class(); /* Test basic code for creating a generic class */
|
2000-11-15 10:27:15 +08:00
|
|
|
|
test_genprop_basic_class_prop(); /* Test basic code for adding properties to a generic class */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_class_iter(); /* Test code for iterating over properties in a generic class */
|
|
|
|
|
test_genprop_class_callback(); /* Test code for property class callbacks */
|
|
|
|
|
|
2000-12-15 00:45:14 +08:00
|
|
|
|
test_genprop_basic_list(); /* Test basic code for creating a generic property list */
|
2001-02-28 06:27:45 +08:00
|
|
|
|
test_genprop_basic_list_prop(); /* Test basic code for adding properties to a generic property list */
|
|
|
|
|
test_genprop_list_iter(); /* Test basic code for iterating over properties in a generic property list */
|
|
|
|
|
test_genprop_list_callback(); /* Test code for property list callbacks */
|
2000-11-12 08:10:08 +08:00
|
|
|
|
|
2002-02-07 00:08:29 +08:00
|
|
|
|
test_genprop_list_addprop(); /* Test adding properties to HDF5 property list */
|
|
|
|
|
test_genprop_class_addprop(); /* Test adding properties to HDF5 property class */
|
|
|
|
|
|
2002-10-08 01:55:55 +08:00
|
|
|
|
test_genprop_equal(); /* Tests for more H5Pequal verification */
|
2002-10-08 22:08:10 +08:00
|
|
|
|
test_genprop_path(); /* Tests for class path verification */
|
2002-10-15 03:59:00 +08:00
|
|
|
|
test_genprop_refcount(); /* Tests for class reference counting */
|
2002-10-08 01:55:55 +08:00
|
|
|
|
|
2000-11-12 08:10:08 +08:00
|
|
|
|
} /* test_genprop() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
* Function: cleanup_genprop
|
|
|
|
|
*
|
|
|
|
|
* Purpose: Cleanup temporary test files
|
|
|
|
|
*
|
|
|
|
|
* Return: none
|
|
|
|
|
*
|
|
|
|
|
* Programmer: Quincey Koziol
|
|
|
|
|
* June 8, 1999
|
|
|
|
|
*
|
|
|
|
|
* Modifications:
|
|
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
cleanup_genprop(void)
|
|
|
|
|
{
|
|
|
|
|
remove(FILENAME);
|
|
|
|
|
}
|
|
|
|
|
|