summaryrefslogtreecommitdiffstats
path: root/src/H5EAtest.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2008-09-11 14:03:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2008-09-11 14:03:23 (GMT)
commitf1d22675ffc09e604c8715b2a6a010ec21acb771 (patch)
treee6d1551f3f8eb71bfeace3255a3fca50cca25cbb /src/H5EAtest.c
parent37ebc24cf85a9aca975181f67afea59ddf08a5ed (diff)
downloadhdf5-f1d22675ffc09e604c8715b2a6a010ec21acb771.zip
hdf5-f1d22675ffc09e604c8715b2a6a010ec21acb771.tar.gz
hdf5-f1d22675ffc09e604c8715b2a6a010ec21acb771.tar.bz2
[svn-r15614] Description:
More extensible array features: add support for setting/getting elements in the array's index block. Tested on: Mac OS X/32 10.5.4 (amazon) in debug mode Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5EAtest.c')
-rw-r--r--src/H5EAtest.c85
1 files changed, 63 insertions, 22 deletions
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 0096d9c..8f2e038 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -39,6 +39,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5Vprivate.h" /* Vector functions */
/****************/
@@ -61,10 +62,10 @@
/********************/
/* Extensible array class callbacks */
-static herr_t H5EA_test_fill(uint8_t *raw_blk, size_t nelmts);
-static herr_t H5EA_test_encode(uint8_t *raw, const void *elmt);
-static herr_t H5EA_test_decode(const uint8_t *raw, void *elmt);
-static herr_t H5EA_test_debug(FILE *stream, int indent, int fwidth, const void *elmt);
+static herr_t H5EA__test_fill(void *nat_blk, size_t nelmts);
+static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts);
+static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts);
+static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth, const void *elmt);
/*********************/
@@ -74,11 +75,11 @@ static herr_t H5EA_test_debug(FILE *stream, int indent, int fwidth, const void *
/* Extensible array testing class information */
const H5EA_class_t H5EA_CLS_TEST[1]={{
H5EA_CLS_TEST_ID, /* Type of Extensible array */
- sizeof(haddr_t), /* Size of native record */
- H5EA_test_fill, /* Fill block of missing elements callback */
- H5EA_test_encode, /* Element encoding callback */
- H5EA_test_decode, /* Element decoding callback */
- H5EA_test_debug /* Element debugging callback */
+ sizeof(uint64_t), /* Size of native element */
+ H5EA__test_fill, /* Fill block of missing elements callback */
+ H5EA__test_encode, /* Element encoding callback */
+ H5EA__test_decode, /* Element decoding callback */
+ H5EA__test_debug /* Element debugging callback */
}};
@@ -94,7 +95,7 @@ const H5EA_class_t H5EA_CLS_TEST[1]={{
/*-------------------------------------------------------------------------
- * Function: H5EA_test_fill
+ * Function: H5EA__test_fill
*
* Purpose: Fill "missing elements" in block of elements
*
@@ -108,17 +109,22 @@ const H5EA_class_t H5EA_CLS_TEST[1]={{
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA_test_fill(uint8_t *raw_blk, size_t nelmts))
+H5EA__test_fill(void *nat_blk, size_t nelmts))
+
+ /* Local variables */
+ uint64_t fill_val = H5EA_TEST_FILL; /* Value to fill elements with */
/* Sanity checks */
- HDassert(raw_blk);
+ HDassert(nat_blk);
HDassert(nelmts);
-END_FUNC(STATIC) /* end H5EA_test_fill() */
+ H5V_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts);
+
+END_FUNC(STATIC) /* end H5EA__test_fill() */
/*-------------------------------------------------------------------------
- * Function: H5EA_test_encode
+ * Function: H5EA__test_encode
*
* Purpose: Encode an element from "native" to "raw" form
*
@@ -132,17 +138,34 @@ END_FUNC(STATIC) /* end H5EA_test_fill() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA_test_encode(uint8_t *raw, const void *elmt))
+H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts))
+
+ /* Local variables */
+ const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */
/* Sanity checks */
HDassert(raw);
HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Encode native elements into raw elements */
+ while(nelmts) {
+ /* Encode element */
+ /* (advances 'raw' pointer */
+ UINT64ENCODE(raw, *elmt);
+
+ /* Advance native element pointer */
+ elmt++;
-END_FUNC(STATIC) /* end H5EA_test_encode() */
+ /* Decrement # of elements to encode */
+ nelmts--;
+ } /* end while */
+
+END_FUNC(STATIC) /* end H5EA__test_encode() */
/*-------------------------------------------------------------------------
- * Function: H5EA_test_decode
+ * Function: H5EA__test_decode
*
* Purpose: Decode an element from "raw" to "native" form
*
@@ -156,17 +179,35 @@ END_FUNC(STATIC) /* end H5EA_test_encode() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA_test_decode(const uint8_t *raw, void *elmt))
+H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts))
+
+ /* Local variables */
+ uint64_t *elmt = (uint64_t *)_elmt; /* Convenience pointer to native elements */
+ const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */
/* Sanity checks */
HDassert(raw);
HDassert(elmt);
+ HDassert(nelmts);
+
+ /* Decode raw elements into native elements */
+ while(nelmts) {
+ /* Decode element */
+ /* (advances 'raw' pointer */
+ UINT64DECODE(raw, *elmt);
+
+ /* Advance native element pointer */
+ elmt++;
+
+ /* Decrement # of elements to decode */
+ nelmts--;
+ } /* end while */
-END_FUNC(STATIC) /* end H5EA_test_decode() */
+END_FUNC(STATIC) /* end H5EA__test_decode() */
/*-------------------------------------------------------------------------
- * Function: H5EA_test_debug
+ * Function: H5EA__test_debug
*
* Purpose: Display an element for debugging
*
@@ -180,13 +221,13 @@ END_FUNC(STATIC) /* end H5EA_test_decode() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5EA_test_debug(FILE *stream, int indent, int fwidth, const void *elmt))
+H5EA__test_debug(FILE *stream, int indent, int fwidth, const void *elmt))
/* Sanity checks */
HDassert(stream);
HDassert(elmt);
-END_FUNC(STATIC) /* end H5EA_test_debug() */
+END_FUNC(STATIC) /* end H5EA__test_debug() */
/*-------------------------------------------------------------------------