summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5.c4
-rw-r--r--src/H5D.c4
-rw-r--r--src/H5Dio.c86
-rw-r--r--src/H5R.c9
-rw-r--r--src/H5S.c40
-rw-r--r--src/H5Sall.c45
-rw-r--r--src/H5Shyper.c56
-rw-r--r--src/H5Smpio.c6
-rw-r--r--src/H5Snone.c38
-rw-r--r--src/H5Spkg.h9
-rw-r--r--src/H5Spoint.c92
-rw-r--r--src/H5Sprivate.h52
-rw-r--r--src/H5Sselect.c358
13 files changed, 533 insertions, 266 deletions
diff --git a/src/H5.c b/src/H5.c
index 1b16395..ee1c102 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -2194,8 +2194,8 @@ H5_trace (const double *returning, const char *func, const char *type, ...)
/* This may generate recursive call to the library... -QAK */
{
H5S_t *space = H5I_object(obj);
- if (H5S_SIMPLE==H5S_get_simple_extent_type(space)) {
- asize[argno] = H5S_get_simple_extent_ndims(space);
+ if (H5S_SIMPLE==H5S_GET_SIMPLE_EXTENT_TYPE(space)) {
+ asize[argno] = H5S_GET_SIMPLE_EXTENT_NDIMS(space);
}
}
break;
diff --git a/src/H5D.c b/src/H5D.c
index 4057cb4..8b473f6 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -2161,7 +2161,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
new_dset->alloc_time=H5D_ALLOC_TIME_EARLY;
/* Set up layout information */
- if((ndims=H5S_get_simple_extent_ndims(new_dset->space))<0)
+ if((ndims=H5S_GET_SIMPLE_EXTENT_NDIMS(new_dset->space))<0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get rank")
new_dset->layout.ndims = (unsigned)ndims + 1;
assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim));
@@ -2207,7 +2207,7 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space
* Chunked storage allows any type of data space extension, so we
* don't even bother checking.
*/
- if(chunk_ndims != (unsigned)H5S_get_simple_extent_ndims(new_dset->space))
+ if(chunk_ndims != (unsigned)H5S_GET_SIMPLE_EXTENT_NDIMS(new_dset->space))
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "dimensionality of chunks doesn't match the data space")
if (new_dset->efl.nused>0)
HGOTO_ERROR (H5E_DATASET, H5E_BADVALUE, NULL, "external storage not supported with chunked layout")
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 8ccb441..985089e 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -466,7 +466,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
- if(H5S_select_valid(mem_space)!=TRUE)
+ if(H5S_SELECT_VALID(mem_space)!=TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
}
if (H5S_ALL != file_space_id) {
@@ -474,7 +474,7 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
- if(H5S_select_valid(file_space)!=TRUE)
+ if(H5S_SELECT_VALID(file_space)!=TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
}
@@ -557,7 +557,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
- if (H5S_select_valid(mem_space)!=TRUE)
+ if (H5S_SELECT_VALID(mem_space)!=TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
}
if (H5S_ALL != file_space_id) {
@@ -565,7 +565,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space")
/* Check for valid selection */
- if (H5S_select_valid(file_space)!=TRUE)
+ if (H5S_SELECT_VALID(file_space)!=TRUE)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "selection+offset not within extent")
}
@@ -662,7 +662,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
file_space = dataset->space;
if (!mem_space)
mem_space = file_space;
- if((snelmts = H5S_get_select_npoints(mem_space))<0)
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
@@ -682,7 +682,7 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
- if (nelmts!=(hsize_t)H5S_get_select_npoints(file_space))
+ if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Retrieve dataset properties */
@@ -889,7 +889,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
file_space = dataset->space;
if (!mem_space)
mem_space = file_space;
- if((snelmts = H5S_get_select_npoints(mem_space))<0)
+ if((snelmts = H5S_GET_SELECT_NPOINTS(mem_space))<0)
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection")
H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,hsize_t);
@@ -905,7 +905,7 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
- if (nelmts!=(hsize_t)H5S_get_select_npoints(file_space))
+ if (nelmts!=(hsize_t)H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "src and dest data spaces have different sizes")
/* Retrieve dataset properties */
@@ -1082,7 +1082,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
#endif
/* Sanity check dataset, then read it */
assert(dataset->layout.addr!=HADDR_UNDEF || dataset->efl.nused>0 ||
- H5S_NULL == H5S_get_simple_extent_type(file_space) ||
+ H5S_NULL == H5S_GET_SIMPLE_EXTENT_TYPE(file_space) ||
dataset->layout.type==H5D_COMPACT);
H5_CHECK_OVERFLOW(nelmts,hsize_t,size_t);
status = (sconv->read)(dataset->ent.file, &(dataset->layout),
@@ -1166,7 +1166,7 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
/* Start strip mining... */
for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
- assert(H5S_select_iter_nelmts(&file_iter)==(nelmts-smine_start));
+ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(nelmts-smine_start));
smine_nelmts = MIN(request_nelmts, (nelmts-smine_start));
/*
@@ -1246,15 +1246,15 @@ H5D_contig_read(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type,
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
@@ -1411,7 +1411,7 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
/* Start strip mining... */
for (smine_start=0; smine_start<nelmts; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
- assert(H5S_select_iter_nelmts(&file_iter)==(nelmts-smine_start));
+ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(nelmts-smine_start));
smine_nelmts = MIN(request_nelmts, (nelmts-smine_start));
/*
@@ -1490,15 +1490,15 @@ H5D_contig_write(hsize_t nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5
done:
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
@@ -1697,7 +1697,7 @@ UNUSED
for (smine_start=0; smine_start<chunk_info->chunk_points; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
- assert(H5S_select_iter_nelmts(&file_iter)==(chunk_info->chunk_points-smine_start));
+ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start));
smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start));
/*
@@ -1771,17 +1771,17 @@ UNUSED
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -1793,15 +1793,15 @@ UNUSED
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
@@ -2046,7 +2046,7 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
for (smine_start=0; smine_start<chunk_info->chunk_points; smine_start+=smine_nelmts) {
/* Go figure out how many elements to read from the file */
- assert(H5S_select_iter_nelmts(&file_iter)==(chunk_info->chunk_points-smine_start));
+ assert(H5S_SELECT_ITER_NELMTS(&file_iter)==(chunk_info->chunk_points-smine_start));
smine_nelmts = MIN(request_nelmts, (chunk_info->chunk_points-smine_start));
/*
@@ -2122,17 +2122,17 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
/* Release selection iterators */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
file_iter_init=0;
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
mem_iter_init=0;
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HGOTO_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
bkg_iter_init=0;
} /* end if */
@@ -2144,15 +2144,15 @@ nelmts, H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
done:
/* Release selection iterators, if necessary */
if(file_iter_init) {
- if(H5S_select_iter_release(&file_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(mem_iter_init) {
- if(H5S_select_iter_release(&mem_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
if(bkg_iter_init) {
- if(H5S_select_iter_release(&bkg_iter)<0)
+ if(H5S_SELECT_ITER_RELEASE(&bkg_iter)<0)
HDONE_ERROR (H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
} /* end if */
@@ -2318,7 +2318,7 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp
fm->layout = &(dataset->layout);
/* Check if the memory space is scalar & make equivalent memory space */
- if((sm_ndims = H5S_get_simple_extent_ndims(mem_space))<0)
+ if((sm_ndims = H5S_GET_SIMPLE_EXTENT_NDIMS(mem_space))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number")
if(sm_ndims==0) {
hsize_t dims[H5O_LAYOUT_NDIMS]; /* Temporary dimension information */
@@ -2382,9 +2382,9 @@ H5D_create_chunk_map(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *file_sp
fm->mem_space_copy=equiv_mspace_init; /* Make certain to copy memory dataspace if necessary */
/* Get type of selection on disk & in memory */
- if((fsel_type=H5S_get_select_type(file_space))<0)
+ if((fsel_type=H5S_GET_SELECT_TYPE(file_space))<0)
HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
- if((fm->msel_type=H5S_get_select_type(equiv_mspace))<0)
+ if((fm->msel_type=H5S_GET_SELECT_TYPE(equiv_mspace))<0)
HGOTO_ERROR (H5E_DATASET, H5E_BADSELECT, FAIL, "unable to convert from file to memory data space")
/* Check if file selection is a point selection */
@@ -2534,7 +2534,7 @@ done:
HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template")
} /* end if */
if(iter_init) {
- if (H5S_select_iter_release(&(fm->mem_iter))<0)
+ if (H5S_SELECT_ITER_RELEASE(&(fm->mem_iter))<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator")
}
if(f_tid!=(-1)) {
@@ -2666,11 +2666,11 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
assert(fm->f_ndims>0);
/* Get number of elements selected in file */
- if((sel_points=H5S_get_select_npoints(fm->file_space))<0)
+ if((sel_points=H5S_GET_SELECT_NPOINTS(fm->file_space))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
/* Get bounding box for selection (to reduce the number of chunks to iterate over) */
- if(H5S_get_select_bounds(fm->file_space, sel_start, sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Set initial chunk location & hyperslab size */
@@ -2755,7 +2755,7 @@ H5D_create_chunk_file_map_hyper(fm_map *fm)
} /* end if */
/* Get number of elements selected in chunk */
- if((schunk_points=H5S_get_select_npoints(tmp_fchunk))<0)
+ if((schunk_points=H5S_GET_SELECT_NPOINTS(tmp_fchunk))<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection # of elements")
H5_ASSIGN_OVERFLOW(new_chunk_info->chunk_points,schunk_points,hssize_t,size_t);
@@ -2879,11 +2879,11 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
} /* end if */
else {
/* Get bounding box for file selection */
- if(H5S_get_select_bounds(fm->file_space, file_sel_start, file_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Get bounding box for memory selection */
- if(H5S_get_select_bounds(fm->mem_space, mem_sel_start, mem_sel_end)<0)
+ if(H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info")
/* Calculate the adjustment for memory selection from file selection */
@@ -2923,7 +2923,7 @@ H5D_create_chunk_mem_map_hyper(const fm_map *fm)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space")
/* Release the current selection */
- if(H5S_select_release(chunk_info->mspace)<0)
+ if(H5S_SELECT_RELEASE(chunk_info->mspace)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection")
/* Copy the file chunk's selection */
@@ -3176,7 +3176,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_
} /* end else */
/* Get coordinates of selection iterator for memory */
- if(H5S_select_iter_coords(&fm->mem_iter,coords_in_mem)<0)
+ if(H5S_SELECT_ITER_COORDS(&fm->mem_iter,coords_in_mem)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator coordinates")
/* Add point to memory selection for chunk */
@@ -3190,7 +3190,7 @@ H5D_chunk_mem_cb(void UNUSED *elem, hid_t UNUSED type_id, hsize_t ndims, hssize_
} /* end else */
/* Move memory selection iterator to next element in selection */
- if(H5S_select_iter_next(&fm->mem_iter,1)<0)
+ if(H5S_SELECT_ITER_NEXT(&fm->mem_iter,1)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to move to next iterator location")
done:
diff --git a/src/H5R.c b/src/H5R.c
index a1d3281..df1041a 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -12,10 +12,7 @@
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* $Id$ */
-
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#define H5S_PACKAGE /*suppress error about including H5Spkg */
#include "H5private.h" /* Generic Functions */
#include "H5Iprivate.h" /* ID Functions */
@@ -26,7 +23,7 @@
#include "H5HGprivate.h" /* Global Heaps */
#include "H5MMprivate.h" /* Memory Management */
#include "H5Rprivate.h" /* References */
-#include "H5Spkg.h" /* Dataspaces */
+#include "H5Sprivate.h" /* Dataspace functions */
#include "H5Tprivate.h" /* Datatypes */
/* Interface initialization */
@@ -192,7 +189,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
HDmemset(ref->heapid,H5R_DSET_REG_REF_BUF_SIZE,0);
/* Get the amount of space required to serialize the selection */
- if ((buf_size = (*space->select.serial_size)(space)) < 0)
+ if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "Invalid amount of space for serializing selection");
/* Increase buffer size to allow for the dataset OID */
@@ -208,7 +205,7 @@ H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type,
H5F_addr_encode(loc->file,&p,sb.objno);
/* Serialize the selection */
- if ((*space->select.serialize)(space,p) < 0)
+ if (H5S_SELECT_SERIALIZE(space,p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection");
/* Save the serialized buffer for later */
diff --git a/src/H5S.c b/src/H5S.c
index c183be7..ebde0a1 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -450,7 +450,7 @@ H5S_close(H5S_t *ds)
assert(ds);
/* Release selection (this should come before the extent release) */
- H5S_select_release(ds);
+ H5S_SELECT_RELEASE(ds);
/* Release extent */
H5S_extent_release(&ds->extent);
@@ -912,7 +912,7 @@ H5Sget_simple_extent_ndims(hid_t space_id)
if (NULL == (ds = H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
- ret_value = H5S_get_simple_extent_ndims(ds);
+ ret_value = H5S_GET_SIMPLE_EXTENT_NDIMS(ds);
done:
FUNC_LEAVE_API(ret_value);
@@ -932,6 +932,10 @@ done:
* Programmer: Robb Matzke
* Thursday, December 11, 1997
*
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
* Modifications:
*
*-------------------------------------------------------------------------
@@ -949,9 +953,6 @@ H5S_get_simple_extent_ndims(const H5S_t *ds)
switch (ds->extent.type) {
case H5S_NULL:
case H5S_SCALAR:
- ret_value = 0;
- break;
-
case H5S_SIMPLE:
ret_value = ds->extent.u.simple.rank;
break;
@@ -1382,9 +1383,6 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims,
assert(rank<=H5S_MAX_RANK);
assert(0==rank || dims);
- /* Set offset to zeros */
- HDmemset(space->select.offset,0,sizeof(hssize_t)*rank);
-
/* shift out of the previous state to a "simple" dataspace. */
if(H5S_extent_release(&space->extent)<0)
HGOTO_ERROR (H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent");
@@ -1416,6 +1414,16 @@ H5S_set_extent_simple (H5S_t *space, unsigned rank, const hsize_t *dims,
} /* end if */
}
+ /* Selection related cleanup */
+
+ /* Set offset to zeros */
+ HDmemset(space->select.offset,0,sizeof(hssize_t)*rank);
+
+ /* If the selection is 'all', update the number of elements selected */
+ if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
+ if(H5S_select_all(space, FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection");
+
done:
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -1636,6 +1644,11 @@ H5S_extend (H5S_t *space, const hsize_t *size)
nelem*=space->extent.u.simple.size[u];
}
space->extent.nelem = nelem;
+
+ /* If the selection is 'all', update the number of elements selected */
+ if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
+ if(H5S_select_all(space, FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection");
}
done:
@@ -1773,6 +1786,10 @@ done:
* Programmer: Quincey Koziol
* Thursday, September 28, 2000
*
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
* Modifications:
*
*-------------------------------------------------------------------------
@@ -1824,7 +1841,7 @@ H5Sget_simple_extent_type(hid_t sid)
if (NULL == (space = H5I_object_verify(sid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace");
- ret_value=H5S_get_simple_extent_type(space);
+ ret_value=H5S_GET_SIMPLE_EXTENT_TYPE(space);
done:
FUNC_LEAVE_API(ret_value);
@@ -1992,6 +2009,11 @@ H5S_set_extent_real( H5S_t *space, const hsize_t *size )
} /* end for */
space->extent.nelem = nelem;
+ /* If the selection is 'all', update the number of elements selected */
+ if(H5S_GET_SELECT_TYPE(space)==H5S_SEL_ALL)
+ if(H5S_select_all(space, FALSE)<0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection");
+
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5S_set_extent_real() */
diff --git a/src/H5Sall.c b/src/H5Sall.c
index edff4ba..19a0a02 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -71,7 +71,7 @@ H5S_all_iter_init (H5S_sel_iter_t *iter, const H5S_t *space)
assert (iter);
/* Initialize the number of elements to iterate over */
- iter->elmt_left=H5S_get_simple_extent_npoints(space);
+ iter->elmt_left=H5S_GET_SELECT_NPOINTS(space);
/* Start at the upper left location */
iter->u.all.elmt_offset=0;
@@ -342,6 +342,9 @@ H5S_all_release (H5S_t UNUSED * space)
/* Check args */
assert (space);
+ /* Reset the number of elements in the selection */
+ space->select.num_elem=0;
+
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* H5S_all_release() */
@@ -349,37 +352,39 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_all_npoints
+ H5S_all_copy
PURPOSE
- Compute number of elements in current selection
+ Copy a selection from one dataspace to another
USAGE
- hsize_t H5S_all_npoints(space)
- H5S_t *space; IN: Pointer to dataspace
+ herr_t H5S_all_copy(dst, src)
+ H5S_t *dst; OUT: Pointer to the destination dataspace
+ H5S_t *src; IN: Pointer to the source dataspace
RETURNS
- The number of elements in selection on success, 0 on failure
+ Non-negative on success/Negative on failure
DESCRIPTION
- Compute number of elements in current selection. For "all" selections,
- this is the same as the number of points in the extent.
+ Copies the 'all' selection information from the source
+ dataspace to the destination dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hsize_t
-H5S_all_npoints (const H5S_t *space)
+herr_t
+H5S_all_copy (H5S_t *dst, const H5S_t *src)
{
- hsize_t ret_value;
+ herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5S_all_npoints, 0);
+ FUNC_ENTER_NOAPI(H5S_all_copy, FAIL);
- /* Check args */
- assert (space);
+ assert(src);
+ assert(dst);
+
+ /* Set number of elements in selection */
+ dst->select.num_elem=(hsize_t)H5S_get_simple_extent_npoints(dst);
- ret_value=(hsize_t)H5S_get_simple_extent_npoints(space);
-
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_all_npoints() */
+} /* end H5S_all_copy() */
/*--------------------------------------------------------------------------
@@ -714,15 +719,17 @@ H5S_select_all (H5S_t *space, unsigned rel_prev)
/* Remove current selection first */
if(rel_prev)
- if((*space->select.release)(space)<0)
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection");
+ /* Set number of elements in selection */
+ space->select.num_elem=(hsize_t)H5S_get_simple_extent_npoints(space);
+
/* Set selection type */
space->select.type=H5S_SEL_ALL;
/* Set selection methods */
space->select.get_seq_list=H5S_all_get_seq_list;
- space->select.get_npoints=H5S_all_npoints;
space->select.release=H5S_all_release;
space->select.is_valid=H5S_all_is_valid;
space->select.serial_size=H5S_all_serial_size;
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index acc78c9..c259316 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -984,41 +984,6 @@ H5S_hyper_iter_release (H5S_sel_iter_t *iter)
/*--------------------------------------------------------------------------
NAME
- H5S_hyper_npoints
- PURPOSE
- Compute number of elements in current selection
- USAGE
- hsize_t H5S_hyper_npoints(space)
- H5S_t *space; IN: Pointer to dataspace
- RETURNS
- The number of elements in selection on success, 0 on failure
- DESCRIPTION
- Compute number of elements in current selection.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-hsize_t
-H5S_hyper_npoints (const H5S_t *space)
-{
- hsize_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5S_hyper_npoints, 0);
-
- /* Check args */
- assert (space);
-
- /* Set return value */
- ret_value=space->select.num_elem;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_hyper_npoints() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S_hyper_new_span
PURPOSE
Make a new hyperslab span node
@@ -3396,7 +3361,6 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, hssize_t *coords)
/* Set selection methods */
space->select.get_seq_list=H5S_hyper_get_seq_list;
- space->select.get_npoints=H5S_hyper_npoints;
space->select.release=H5S_hyper_release;
space->select.is_valid=H5S_hyper_is_valid;
space->select.serial_size=H5S_hyper_serial_size;
@@ -5754,7 +5718,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
if(op==H5S_SELECT_SET) {
/* If we are setting a new selection, remove current selection first */
- if((*space->select.release)(space)<0)
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab");
/* Save the diminfo */
@@ -5802,7 +5766,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Set selection methods */
space->select.get_seq_list=H5S_hyper_get_seq_list;
- space->select.get_npoints=H5S_hyper_npoints;
space->select.release=H5S_hyper_release;
space->select.is_valid=H5S_hyper_is_valid;
space->select.serial_size=H5S_hyper_serial_size;
@@ -5858,9 +5821,9 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
- if (H5S_SCALAR==H5S_get_simple_extent_type(space))
+ if (H5S_SCALAR==H5S_GET_SIMPLE_EXTENT_TYPE(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space");
- if (H5S_NULL==H5S_get_simple_extent_type(space))
+ if (H5S_NULL==H5S_GET_SIMPLE_EXTENT_TYPE(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space");
if(start==NULL || count==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified");
@@ -6134,7 +6097,7 @@ H5S_generate_hyperslab (H5S_t *space, H5S_seloper_t op,
space->select.sel_info.hslab.span_lst=NULL;
/* Reset the other dataspace selection information */
- if((*space->select.release)(space)<0)
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection");
} /* end if */
@@ -6316,7 +6279,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
if(op==H5S_SELECT_SET) {
/* If we are setting a new selection, remove current selection first */
- if((*space->select.release)(space)<0)
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab");
/* Save the diminfo */
@@ -6362,7 +6325,6 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Set selection methods */
space->select.get_seq_list=H5S_hyper_get_seq_list;
- space->select.get_npoints=H5S_hyper_npoints;
space->select.release=H5S_hyper_release;
space->select.is_valid=H5S_hyper_is_valid;
space->select.serial_size=H5S_hyper_serial_size;
@@ -6417,9 +6379,9 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hssize_t start[],
/* Check args */
if (NULL == (space=H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
- if (H5S_SCALAR==H5S_get_simple_extent_type(space))
+ if (H5S_SCALAR==H5S_GET_SIMPLE_EXTENT_TYPE(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space");
- if (H5S_NULL==H5S_get_simple_extent_type(space))
+ if (H5S_NULL==H5S_GET_SIMPLE_EXTENT_TYPE(space))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space");
if(start==NULL || count==NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified");
@@ -6553,7 +6515,7 @@ H5S_combine_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to copy data space");
/* Free the current selection for the new dataspace */
- if((*new_space->select.release)(new_space)<0)
+ if(H5S_SELECT_RELEASE(new_space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, NULL, "can't release selection");
/* Combine space1 & space2, with the result in new_space */
@@ -6678,7 +6640,7 @@ H5S_select_select (H5S_t *space1, H5S_seloper_t op, H5S_t *space2)
space1->select.sel_info.hslab.span_lst=NULL;
/* Reset the other dataspace selection information */
- if((*space1->select.release)(space1)<0)
+ if(H5S_SELECT_RELEASE(space1)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection");
/* Combine tmp_spans (from space1) & spans from space2, with the result in space1 */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 4b1a41b..2fc3eea 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -485,7 +485,7 @@ empty:
done:
/* Release selection iterator */
if(sel_iter_init) {
- if (H5S_select_iter_release(&sel_iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&sel_iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
@@ -837,8 +837,8 @@ H5S_mpio_opt_possible( const H5S_t *mem_space, const H5S_t *file_space, const un
HGOTO_DONE(FALSE);
/* Check whether both selections are "regular" */
- c1=(*file_space->select.is_regular)(file_space);
- c2=(*mem_space->select.is_regular)(mem_space);
+ c1=H5S_SELECT_IS_REGULAR(file_space);
+ c2=H5S_SELECT_IS_REGULAR(mem_space);
if(c1==FAIL || c2==FAIL)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for single selection blocks");
if(c1==FALSE || c2==FALSE)
diff --git a/src/H5Snone.c b/src/H5Snone.c
index 1e6a1d5..4409d2b 100644
--- a/src/H5Snone.c
+++ b/src/H5Snone.c
@@ -320,35 +320,39 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_none_npoints
+ H5S_none_copy
PURPOSE
- Compute number of elements in current selection
+ Copy a selection from one dataspace to another
USAGE
- hsize_t H5S_none_npoints(space)
- H5S_t *space; IN: Pointer to dataspace
+ herr_t H5S_none_copy(dst, src)
+ H5S_t *dst; OUT: Pointer to the destination dataspace
+ H5S_t *src; IN: Pointer to the source dataspace
RETURNS
- The number of elements in selection on success, 0 on failure
+ Non-negative on success/Negative on failure
DESCRIPTION
- Compute number of elements in current selection. For "none" selections,
- this is always 0.
+ Copies the 'none' selection information from the source
+ dataspace to the destination dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-hsize_t
-H5S_none_npoints (const H5S_t UNUSED *space)
+herr_t
+H5S_none_copy (H5S_t *dst, const H5S_t *src)
{
- hsize_t ret_value=0; /* Return value */
+ herr_t ret_value=SUCCEED; /* return value */
- FUNC_ENTER_NOAPI(H5S_none_npoints, 0);
+ FUNC_ENTER_NOAPI(H5S_none_copy, FAIL);
- /* Check args */
- assert (space);
+ assert(src);
+ assert(dst);
+
+ /* Set number of elements in selection */
+ dst->select.num_elem=0;
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_none_npoints() */
+} /* end H5S_none_copy() */
/*--------------------------------------------------------------------------
@@ -666,15 +670,17 @@ herr_t H5S_select_none (H5S_t *space)
assert(space);
/* Remove current selection first */
- if((*space->select.release)(space)<0)
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab");
+ /* Set number of elements in selection */
+ space->select.num_elem=0;
+
/* Set selection type */
space->select.type=H5S_SEL_NONE;
/* Set selection methods */
space->select.get_seq_list=H5S_none_get_seq_list;
- space->select.get_npoints=H5S_none_npoints;
space->select.release=H5S_none_release;
space->select.is_valid=H5S_none_is_valid;
space->select.serial_size=H5S_none_serial_size;
diff --git a/src/H5Spkg.h b/src/H5Spkg.h
index d062854..48548e7 100644
--- a/src/H5Spkg.h
+++ b/src/H5Spkg.h
@@ -117,8 +117,6 @@ typedef struct {
typedef herr_t (*H5S_sel_get_seq_list_func_t)(const H5S_t *space, unsigned flags,
H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
-/* Method to compute number of elements in current selection */
-typedef hsize_t (*H5S_sel_get_npoints_func_t)(const H5S_t *space);
/* Method to release current selection */
typedef herr_t (*H5S_sel_release_func_t)(H5S_t *space);
/* Method to determine if current selection is valid for dataspace */
@@ -149,7 +147,6 @@ typedef struct {
H5S_hyper_sel_t hslab; /* Info about new-style hyperslab selections */
} sel_info;
H5S_sel_get_seq_list_func_t get_seq_list; /* Method to retrieve a list of offset/length sequences for selection */
- H5S_sel_get_npoints_func_t get_npoints; /* Method to compute number of elements in current selection */
H5S_sel_release_func_t release; /* Method to release current selection */
H5S_sel_is_valid_func_t is_valid; /* Method to determine if current selection is valid for dataspace */
H5S_sel_serial_size_func_t serial_size; /* Method to determine number of bytes required to store current selection */
@@ -179,7 +176,6 @@ H5_DLL herr_t H5S_point_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Point selection functions */
H5_DLL herr_t H5S_point_release(H5S_t *space);
-H5_DLL hsize_t H5S_point_npoints(const H5S_t *space);
H5_DLL herr_t H5S_point_copy(H5S_t *dst, const H5S_t *src);
H5_DLL htri_t H5S_point_is_valid(const H5S_t *space);
H5_DLL hssize_t H5S_point_serial_size(const H5S_t *space);
@@ -198,7 +194,7 @@ H5_DLL herr_t H5S_all_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* "All" selection functions */
H5_DLL herr_t H5S_all_release(H5S_t *space);
-H5_DLL hsize_t H5S_all_npoints(const H5S_t *space);
+H5_DLL herr_t H5S_all_copy(H5S_t *dst, const H5S_t *src);
H5_DLL htri_t H5S_all_is_valid(const H5S_t *space);
H5_DLL hssize_t H5S_all_serial_size(const H5S_t *space);
H5_DLL herr_t H5S_all_serialize(const H5S_t *space, uint8_t *buf);
@@ -216,7 +212,6 @@ H5_DLL herr_t H5S_hyper_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* Hyperslab selection functions */
H5_DLL herr_t H5S_hyper_release(H5S_t *space);
-H5_DLL hsize_t H5S_hyper_npoints(const H5S_t *space);
H5_DLL herr_t H5S_hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
H5_DLL htri_t H5S_hyper_is_valid(const H5S_t *space);
H5_DLL hssize_t H5S_hyper_serial_size(const H5S_t *space);
@@ -235,7 +230,7 @@ H5_DLL herr_t H5S_none_iter_init(H5S_sel_iter_t *iter, const H5S_t *space);
/* "None" selection functions */
H5_DLL herr_t H5S_none_release(H5S_t *space);
-H5_DLL hsize_t H5S_none_npoints(const H5S_t *space);
+H5_DLL herr_t H5S_none_copy(H5S_t *dst, const H5S_t *src);
H5_DLL htri_t H5S_none_is_valid(const H5S_t *space);
H5_DLL hssize_t H5S_none_serial_size(const H5S_t *space);
H5_DLL herr_t H5S_none_serialize(const H5S_t *space, uint8_t *buf);
diff --git a/src/H5Spoint.c b/src/H5Spoint.c
index fa26f99..9becfb9 100644
--- a/src/H5Spoint.c
+++ b/src/H5Spoint.c
@@ -399,8 +399,11 @@ H5S_point_add (H5S_t *space, H5S_seloper_t op, size_t num_elem, const hssize_t *
space->select.sel_info.pnt_lst->head=top;
} /* end else */
- /* Add the number of elements in the new selection */
- space->select.num_elem+=num_elem;
+ /* Set the number of elements in the new selection */
+ if(op==H5S_SELECT_SET)
+ space->select.num_elem=num_elem;
+ else
+ space->select.num_elem+=num_elem;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -458,40 +461,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_point_npoints
- PURPOSE
- Compute number of elements in current selection
- USAGE
- hsize_t H5S_point_npoints(space)
- H5S_t *space; IN: Pointer to dataspace
- RETURNS
- The number of elements in selection on success, 0 on failure
- DESCRIPTION
- Compute number of elements in current selection.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-hsize_t
-H5S_point_npoints (const H5S_t *space)
-{
- hsize_t ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5S_point_npoints, 0);
-
- /* Check args */
- assert (space);
-
- /* Set return value */
- ret_value=space->select.num_elem;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5S_point_npoints() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5S_select_elements
PURPOSE
Specify a series of elements in the dataspace to select
@@ -535,8 +504,8 @@ H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem,
assert(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND);
/* If we are setting a new selection, remove current selection first */
- if(op==H5S_SELECT_SET) {
- if((*space->select.release)(space)<0)
+ if(op==H5S_SELECT_SET || space->select.type!=H5S_SEL_POINTS) {
+ if(H5S_SELECT_RELEASE(space)<0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection");
} /* end if */
@@ -555,7 +524,6 @@ H5S_select_elements (H5S_t *space, H5S_seloper_t op, size_t num_elem,
/* Set selection methods */
space->select.get_seq_list=H5S_point_get_seq_list;
- space->select.get_npoints=H5S_point_npoints;
space->select.release=H5S_point_release;
space->select.is_valid=H5S_point_is_valid;
space->select.serial_size=H5S_point_serial_size;
@@ -687,38 +655,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5S_get_select_elem_npoints
- PURPOSE
- Get the number of points in current element selection
- USAGE
- hssize_t H5S_get_select_elem_npoints(space)
- H5S_t *space; IN: Dataspace ptr of selection to query
- RETURNS
- The number of element points in selection on success, negative on failure
- DESCRIPTION
- Returns the number of element points in current selection for dataspace.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-static hssize_t
-H5S_get_select_elem_npoints(H5S_t *space)
-{
- hssize_t ret_value=FAIL; /* return value */
-
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_get_select_elem_npoints);
-
- assert(space);
-
- ret_value = space->select.num_elem;
-
- FUNC_LEAVE_NOAPI(ret_value);
-} /* H5Sget_select_elem_npoints() */
-
-
-/*--------------------------------------------------------------------------
- NAME
H5Sget_select_elem_npoints
PURPOSE
Get the number of points in current element selection
@@ -749,7 +685,7 @@ H5Sget_select_elem_npoints(hid_t spaceid)
if(space->select.type!=H5S_SEL_POINTS)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection");
- ret_value = H5S_get_select_elem_npoints(space);
+ ret_value = H5S_GET_SELECT_NPOINTS(space);
done:
FUNC_LEAVE_API(ret_value);
@@ -1282,15 +1218,15 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem,
/* Check args */
if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space");
- if (H5S_SCALAR==H5S_get_simple_extent_type(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space");
- if (H5S_NULL==H5S_get_simple_extent_type(space))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space");
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
+ if (H5S_SCALAR==H5S_GET_SIMPLE_EXTENT_TYPE(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space");
+ if (H5S_NULL==H5S_GET_SIMPLE_EXTENT_TYPE(space))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_NULL space");
if(coord==NULL || num_elem==0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified");
if(!(op==H5S_SELECT_SET || op==H5S_SELECT_APPEND || op==H5S_SELECT_PREPEND))
- HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operations other than H5S_SELECT_SET not supported currently");
+ HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted");
/* Call the real element selection routine */
if((ret_value=H5S_select_elements(space,op,num_elem,coord))<0)
diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h
index e766b52..0bc6dc7 100644
--- a/src/H5Sprivate.h
+++ b/src/H5Sprivate.h
@@ -172,6 +172,52 @@ typedef struct H5S_conv_t {
#endif
} H5S_conv_t;
+/* If the module using this macro is allowed access to the private variables, access them directly */
+#ifdef H5S_PACKAGE
+#define H5S_GET_SIMPLE_EXTENT_TYPE(S) ((S)->extent.type)
+#define H5S_GET_SIMPLE_EXTENT_NDIMS(S) ((S)->extent.u.simple.rank)
+#define H5S_GET_SELECT_NPOINTS(S) ((S)->select.num_elem)
+#define H5S_GET_SELECT_TYPE(S) ((S)->select.type)
+#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) ((*(S)->select.get_seq_list)(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
+#define H5S_SELECT_VALID(S) ((*(S)->select.is_valid)(S))
+#define H5S_SELECT_RELEASE(S) ((*(S)->select.release)(S))
+#define H5S_SELECT_SERIAL_SIZE(S) ((*(S)->select.serial_size)(S))
+#define H5S_SELECT_SERIALIZE(S,BUF) ((*(S)->select.serialize)(S,BUF))
+#define H5S_SELECT_BOUNDS(S,START,END) ((*(S)->select.bounds)(S,START,END))
+#define H5S_SELECT_IS_CONTIGUOUS(S) ((*(S)->select.is_contiguous)(S))
+#define H5S_SELECT_IS_SINGLE(S) ((*(S)->select.is_single)(S))
+#define H5S_SELECT_IS_REGULAR(S) ((*(S)->select.is_regular)(S))
+#define H5S_SELECT_ITER_COORDS(ITER,COORDS) ((*(ITER)->iter_coords)(ITER,COORDS))
+#define H5S_SELECT_ITER_BLOCK(ITER,START,END) ((*(ITER)->iter_block)(ITER,START,END))
+#define H5S_SELECT_ITER_NELMTS(ITER) ((*(ITER)->iter_nelmts)(ITER))
+#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) ((*(ITER)->iter_has_next_block)(ITER))
+#define H5S_SELECT_ITER_NEXT(ITER,NELEM)((*(ITER)->iter_next)(ITER,NELEM))
+#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) ((*(ITER)->iter_next_block)(ITER))
+#define H5S_SELECT_ITER_RELEASE(ITER) ((*(ITER)->iter_release)(ITER))
+#else /* H5S_PACKAGE */
+#define H5S_GET_SIMPLE_EXTENT_TYPE(S) (H5S_get_simple_extent_type(S))
+#define H5S_GET_SIMPLE_EXTENT_NDIMS(S) (H5S_get_simple_extent_ndims(S))
+#define H5S_GET_SELECT_NPOINTS(S) (H5S_get_select_npoints(S))
+#define H5S_GET_SELECT_TYPE(S) (H5S_get_select_type(S))
+#define H5S_SELECT_GET_SEQ_LIST(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN) (H5S_select_get_seq_list(S,FLAGS,ITER,MAXSEQ,MAXBYTES,NSEQ,NBYTES,OFF,LEN))
+#define H5S_SELECT_VALID(S) (H5S_select_valid(S))
+#define H5S_SELECT_RELEASE(S) (H5S_select_release(S))
+#define H5S_SELECT_SERIAL_SIZE(S) (H5S_select_serial_size(S))
+#define H5S_SELECT_SERIALIZE(S,BUF) (H5S_select_serialize(S,BUF))
+#define H5S_SELECT_BOUNDS(S,START,END) (H5S_get_select_bounds(S,START,END))
+#define H5S_SELECT_IS_CONTIGUOUS(S) (H5S_select_is_contiguous(S))
+#define H5S_SELECT_IS_SINGLE(S) (H5S_select_is_single(S))
+#define H5S_SELECT_IS_REGULAR(S) (H5S_select_is_regular(S))
+#define H5S_SELECT_ITER_COORDS(ITER,COORDS) (H5S_select_iter_coords(ITER,COORDS))
+#define H5S_SELECT_ITER_BLOCK(ITER,START,END) (H5S_select_iter_block(ITER,START,END))
+#define H5S_SELECT_ITER_NELMTS(ITER) (H5S_select_iter_nelmts(ITER))
+#define H5S_SELECT_ITER_HAS_NEXT_BLOCK(ITER) (H5S_select_iter_has_next_block(ITER))
+#define H5S_SELECT_ITER_NEXT(ITER,NELEM)(H5S_select_iter_next(ITER,NELEM))
+#define H5S_SELECT_ITER_NEXT_BLOCK(ITER) (H5S_select_iter_next_block(ITER))
+#define H5S_SELECT_ITER_RELEASE(ITER) (H5S_select_iter_release(ITER))
+#endif /* H5S_PACKAGE */
+
+
/* Operations on dataspaces */
H5_DLL H5S_t *H5S_copy(const H5S_t *src, hbool_t share_selection);
H5_DLL herr_t H5S_close(H5S_t *ds);
@@ -231,6 +277,12 @@ H5_DLL herr_t H5S_select_offset(H5S_t *space, const hssize_t *offset);
H5_DLL herr_t H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection);
H5_DLL htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2);
H5_DLL herr_t H5S_select_release(H5S_t *ds);
+H5_DLL herr_t H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len);
+H5_DLL htri_t H5S_select_is_contiguous(const H5S_t *space);
+H5_DLL htri_t H5S_select_is_single(const H5S_t *space);
+H5_DLL htri_t H5S_select_is_regular(const H5S_t *space);
/* Operations on all selections */
H5_DLL herr_t H5S_select_all(H5S_t *space, unsigned rel_prev);
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index daf40cd..e5edeee 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -144,8 +144,11 @@ H5S_select_copy (H5S_t *dst, const H5S_t *src, hbool_t share_selection)
/* Deep copy extra stuff */
switch(src->select.type) {
case H5S_SEL_NONE:
+ ret_value=H5S_none_copy(dst,src);
+ break;
+
case H5S_SEL_ALL:
- /*nothing needed */
+ ret_value=H5S_all_copy(dst,src);
break;
case H5S_SEL_POINTS:
@@ -186,6 +189,10 @@ done:
* Programmer: Quincey Koziol
* Friday, May 30, 2003
*
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
* Modifications:
*
*-------------------------------------------------------------------------
@@ -207,6 +214,120 @@ done:
} /* end H5S_select_release() */
+/*-------------------------------------------------------------------------
+ * Function: H5S_select_get_seq_list
+ *
+ * Purpose: Retrieves the next sequence of offset/length pairs for an
+ * iterator on a dataspace
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, May 18, 2004
+ *
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_select_get_seq_list(const H5S_t *space, unsigned flags,
+ H5S_sel_iter_t *iter, size_t maxseq, size_t maxbytes,
+ size_t *nseq, size_t *nbytes, hsize_t *off, size_t *len)
+{
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_get_seq_list, FAIL);
+
+ assert(space);
+
+ /* Call the selection type's get_seq_list function */
+ (*space->select.get_seq_list)(space,flags,iter,maxseq,maxbytes,nseq,nbytes,off,len);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5S_select_get_seq_list() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5S_select_serial_size
+ *
+ * Purpose: Determines the number of bytes required to store the current
+ * selection
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, May 18, 2004
+ *
+ * Note: This routine participates in the "Inlining C function pointers"
+ * pattern, don't call it directly, use the appropriate macro
+ * defined in H5Sprivate.h.
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5S_select_serial_size(const H5S_t *space)
+{
+ hssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_serial_size, FAIL);
+
+ assert(space);
+
+ /* Call the selection type's serial_size function */
+ ret_value=(*space->select.serial_size)(space);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5S_select_serial_size() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_serialize
+ PURPOSE
+ Serialize the selection for a dataspace into a buffer
+ USAGE
+ herr_t H5S_select_serialize(space, buf)
+ const H5S_t *space; IN: Dataspace with selection to serialize
+ uint8_t *buf; OUT: Buffer to put serialized selection
+ RETURNS
+ Non-negative on success/Negative on failure
+ DESCRIPTION
+ Calls the appropriate dataspace selection callback to serialize the
+ current selection into a buffer.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+herr_t
+H5S_select_serialize(const H5S_t *space, uint8_t *buf)
+{
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_serialize, FAIL);
+
+ assert(space);
+ assert(buf);
+
+ /* Call the selection type's serialize function */
+ ret_value=(*space->select.serialize)(space,buf);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5S_select_serialize() */
+
+
/*--------------------------------------------------------------------------
NAME
H5Sget_select_npoints
@@ -237,7 +358,7 @@ H5Sget_select_npoints(hid_t spaceid)
if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
- ret_value = H5S_get_select_npoints(space);
+ ret_value = H5S_GET_SELECT_NPOINTS(space);
done:
FUNC_LEAVE_API(ret_value);
@@ -258,6 +379,9 @@ done:
Returns the number of elements in current selection for dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -271,7 +395,8 @@ H5S_get_select_npoints(const H5S_t *space)
/* Check args */
assert(space);
- ret_value = (*space->select.get_npoints)(space);
+ /* Set return value */
+ ret_value=space->select.num_elem;
done:
FUNC_LEAVE_NOAPI(ret_value);
@@ -311,7 +436,7 @@ H5Sselect_valid(hid_t spaceid)
if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace");
- ret_value = H5S_select_valid(space);
+ ret_value = H5S_SELECT_VALID(space);
done:
FUNC_LEAVE_API(ret_value);
@@ -335,6 +460,9 @@ done:
extent for the dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -439,6 +567,9 @@ done:
selection within the dataspace extent.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -457,7 +588,7 @@ H5Sget_select_bounds(hid_t spaceid, hssize_t *start, hssize_t *end)
if (NULL == (space=H5I_object_verify(spaceid, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
- ret_value = H5S_get_select_bounds(space,start,end);
+ ret_value = H5S_SELECT_BOUNDS(space,start,end);
done:
FUNC_LEAVE_API(ret_value);
@@ -512,6 +643,120 @@ done:
/*--------------------------------------------------------------------------
NAME
+ H5S_select_is_contiguous
+ PURPOSE
+ Determines if a selection is contiguous in the dataspace
+ USAGE
+ htri_t H5S_select_is_contiguous(space)
+ const H5S_t *space; IN: Dataspace of selection to query
+ RETURNS
+ Non-negative (TRUE/FALSE) on success, negative on failure
+ DESCRIPTION
+ Checks the selection to determine if the points to iterated over will be
+ contiguous in the particular dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_select_is_contiguous(const H5S_t *space)
+{
+ herr_t ret_value; /* return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_is_contiguous, FAIL);
+
+ /* Check args */
+ assert(space);
+
+ ret_value = (*space->select.is_contiguous)(space);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5S_select_is_contiguous() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_is_single
+ PURPOSE
+ Determines if a selection is a single block in the dataspace
+ USAGE
+ htri_t H5S_select_is_single(space)
+ const H5S_t *space; IN: Dataspace of selection to query
+ RETURNS
+ Non-negative (TRUE/FALSE) on success, negative on failure
+ DESCRIPTION
+ Checks the selection to determine if it occupies a single block in the
+ particular dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_select_is_single(const H5S_t *space)
+{
+ herr_t ret_value; /* return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_is_single, FAIL);
+
+ /* Check args */
+ assert(space);
+
+ ret_value = (*space->select.is_single)(space);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5S_select_is_single() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
+ H5S_select_is_regular
+ PURPOSE
+ Determines if a selection is "regular" in the dataspace
+ USAGE
+ htri_t H5S_select_is_regular(space)
+ const H5S_t *space; IN: Dataspace of selection to query
+ RETURNS
+ Non-negative (TRUE/FALSE) on success, negative on failure
+ DESCRIPTION
+ Checks the selection to determine if it is "regular" (i.e. a single
+ block or a strided pattern) in the particular dataspace.
+ GLOBAL VARIABLES
+ COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
+ EXAMPLES
+ REVISION LOG
+--------------------------------------------------------------------------*/
+htri_t
+H5S_select_is_regular(const H5S_t *space)
+{
+ herr_t ret_value; /* return value */
+
+ FUNC_ENTER_NOAPI(H5S_select_is_regular, FAIL);
+
+ /* Check args */
+ assert(space);
+
+ ret_value = (*space->select.is_regular)(space);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5S_select_is_regular() */
+
+
+/*--------------------------------------------------------------------------
+ NAME
H5S_select_iter_init
PURPOSE
Initializes iteration information for a selection.
@@ -577,6 +822,9 @@ done:
the COORDS array.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -616,6 +864,9 @@ done:
the COORDS array.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -652,6 +903,9 @@ H5S_select_iter_block (const H5S_sel_iter_t *iter, hssize_t *start, hssize_t *en
Returns the number of elements in current selection for dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -688,6 +942,9 @@ done:
iterator.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -724,6 +981,9 @@ H5S_select_iter_has_next_block (const H5S_sel_iter_t *iter)
element in the selection.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -755,7 +1015,7 @@ done:
PURPOSE
Advance selection iterator to next block
USAGE
- herr_t H5S_select_iter_next(iter)
+ herr_t H5S_select_iter_next_block(iter)
H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change
RETURNS
Non-negative on success, negative on failure.
@@ -765,6 +1025,10 @@ done:
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
Doesn't maintain the 'elmt_left' field of the selection iterator.
+
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -799,6 +1063,9 @@ H5S_select_iter_next_block(H5S_sel_iter_t *iter)
Returns the number of elements in current selection for dataspace.
GLOBAL VARIABLES
COMMENTS, BUGS, ASSUMPTIONS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
@@ -894,7 +1161,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
iter_init=1; /* Selection iteration info has been initialized */
/* Get the number of elements in selection */
- if((nelmts = H5S_get_select_npoints(space))<0)
+ if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected");
/* Get the rank of the dataspace */
@@ -913,7 +1180,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
/* Loop, while elements left in selection */
while(max_elem>0 && user_ret==0) {
/* Get the sequences of bytes */
- if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Loop, while sequences left to process */
@@ -956,7 +1223,7 @@ H5S_select_iterate(void *buf, hid_t type_id, const H5S_t *space, H5D_operator_t
done:
/* Release selection iterator */
if(iter_init) {
- if (H5S_select_iter_release(&iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
@@ -993,7 +1260,7 @@ H5Sget_select_type(hid_t space_id)
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, H5S_SEL_ERROR, "not a dataspace");
/* Set return value */
- ret_value=H5S_get_select_type(space);
+ ret_value=H5S_GET_SELECT_TYPE(space);
done:
FUNC_LEAVE_API(ret_value);
@@ -1014,6 +1281,10 @@ done:
DESCRIPTION
This function retrieves the type of selection currently defined for
a dataspace.
+ COMMENTS
+ This routine participates in the "Inlining C function pointers"
+ pattern, don't call it directly, use the appropriate macro
+ defined in H5Sprivate.h.
--------------------------------------------------------------------------*/
H5S_sel_type
H5S_get_select_type(const H5S_t *space)
@@ -1077,15 +1348,28 @@ HDfprintf(stderr,"%s: Entering\n",FUNC);
if (space1->extent.u.simple.rank!=space2->extent.u.simple.rank)
HGOTO_DONE(FALSE);
+#ifdef QAK
+HDfprintf(stderr,"%s: Check 0.5\n",FUNC);
+HDfprintf(stderr,"%s: space1 selection type=%d\n",FUNC,(int)space1->select.type);
+HDfprintf(stderr,"%s: space1->select.num_elem=%Hd\n",FUNC,space1->select.num_elem);
+HDfprintf(stderr,"%s: space2 selection type=%d\n",FUNC,(int)space2->select.type);
+HDfprintf(stderr,"%s: space2->select.num_elem=%Hd\n",FUNC,space2->select.num_elem);
+#endif /* QAK */
/* Check for different number of elements selected */
- if(H5S_get_select_npoints(space1)!=H5S_get_select_npoints(space2))
+ if(H5S_GET_SELECT_NPOINTS(space1)!=H5S_GET_SELECT_NPOINTS(space2))
HGOTO_DONE(FALSE);
+#ifdef QAK
+HDfprintf(stderr,"%s: Check 1.0\n",FUNC);
+#endif /* QAK */
/* Check for "easy" cases before getting into generalized block iteration code */
if(space1->select.type==H5S_SEL_ALL && space2->select.type==H5S_SEL_ALL) {
hsize_t dims1[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #1 */
hsize_t dims2[H5O_LAYOUT_NDIMS]; /* End point of selection block in dataspace #2 */
+#ifdef QAK
+HDfprintf(stderr,"%s: Check 2.0\n",FUNC);
+#endif /* QAK */
if(H5S_get_simple_extent_dims(space1, dims1, NULL)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality");
if(H5S_get_simple_extent_dims(space2, dims2, NULL)<0)
@@ -1097,11 +1381,17 @@ HDfprintf(stderr,"%s: Entering\n",FUNC);
HGOTO_DONE(FALSE);
} /* end if */
else if(space1->select.type==H5S_SEL_NONE || space2->select.type==H5S_SEL_NONE) {
+#ifdef QAK
+HDfprintf(stderr,"%s: Check 3.0\n",FUNC);
+#endif /* QAK */
HGOTO_DONE(TRUE);
} /* end if */
else if((space1->select.type==H5S_SEL_HYPERSLABS && space1->select.sel_info.hslab.diminfo_valid)
&& (space2->select.type==H5S_SEL_HYPERSLABS && space2->select.sel_info.hslab.diminfo_valid)) {
+#ifdef QAK
+HDfprintf(stderr,"%s: Check 4.0\n",FUNC);
+#endif /* QAK */
/* Check that the shapes are the same */
for (u=0; u<space1->extent.u.simple.rank; u++) {
if(space1->select.sel_info.hslab.opt_diminfo[u].stride!=space2->select.sel_info.hslab.opt_diminfo[u].stride)
@@ -1159,7 +1449,7 @@ else {
/* Iterate over all the blocks in each selection */
while(1) {
/* Get the current block for each selection iterator */
- if(H5S_select_iter_block(&iter1,start1,end1)<0)
+ if(H5S_SELECT_ITER_BLOCK(&iter1,start1,end1)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block");
#ifdef QAK
{
@@ -1171,7 +1461,7 @@ else {
HDfprintf(stderr,"%Hd%s",end1[u],(u<(space1->extent.u.simple.rank-1) ? ", " : "}\n"));
}
#endif /* QAK */
- if(H5S_select_iter_block(&iter2,start2,end2)<0)
+ if(H5S_SELECT_ITER_BLOCK(&iter2,start2,end2)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block");
#ifdef QAK
{
@@ -1213,9 +1503,9 @@ else {
} /* end else */
/* Check if we are able to advance to the next selection block */
- if((status1=H5S_select_iter_has_next_block(&iter1))<0)
+ if((status1=H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter1))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block");
- if((status2=H5S_select_iter_has_next_block(&iter2))<0)
+ if((status2=H5S_SELECT_ITER_HAS_NEXT_BLOCK(&iter2))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block");
#ifdef QAK
HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2);
@@ -1229,9 +1519,9 @@ HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2);
} /* end if */
else {
/* Advance to next block in selection iterators */
- if(H5S_select_iter_next_block(&iter1)<0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(&iter1)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block");
- if(H5S_select_iter_next_block(&iter2)<0)
+ if(H5S_SELECT_ITER_NEXT_BLOCK(&iter2)<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to advance to next iterator block");
} /* end else */
} /* end while */
@@ -1239,11 +1529,11 @@ HDfprintf(stderr,"%s: status1=%d, status2=%d\n",FUNC,(int)status1,(int)status2);
done:
if(iter1_init) {
- if (H5S_select_iter_release(&iter1)<0)
+ if (H5S_SELECT_ITER_RELEASE(&iter1)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
if(iter2_init) {
- if (H5S_select_iter_release(&iter2)<0)
+ if (H5S_SELECT_ITER_RELEASE(&iter2)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
#ifdef QAK
@@ -1312,7 +1602,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf)
iter_init=1; /* Selection iteration info has been initialized */
/* Get the number of elements in selection */
- if((nelmts = H5S_get_select_npoints(space))<0)
+ if((nelmts = H5S_GET_SELECT_NPOINTS(space))<0)
HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected");
/* Compute the number of bytes to process */
@@ -1321,7 +1611,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf)
/* Loop, while elements left in selection */
while(max_elem>0) {
/* Get the sequences of bytes */
- if((*space->select.get_seq_list)(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,0,&iter,H5D_XFER_HYPER_VECTOR_SIZE_DEF,max_elem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Loop over sequences */
@@ -1341,7 +1631,7 @@ H5S_select_fill(void *_fill, size_t fill_size, const H5S_t *space, void *_buf)
done:
/* Release selection iterator */
if(iter_init) {
- if (H5S_select_iter_release(&iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
@@ -1422,7 +1712,7 @@ H5S_select_fscat (H5F_t *f, struct H5O_layout_t *layout,
/* Loop until all elements are written */
while(maxelem>0) {
/* Get list of sequences for selection to write */
- if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Reset the current sequence information */
@@ -1525,7 +1815,7 @@ H5S_select_fgath (H5F_t *f, const struct H5O_layout_t *layout,
/* Loop until all elements are written */
while(maxelem>0) {
/* Get list of sequences for selection to write */
- if((*space->select.get_seq_list)(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,H5S_GET_SEQ_LIST_SORTED,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed");
/* Reset the current sequence information */
@@ -1617,7 +1907,7 @@ H5S_select_mscat (const void *_tscat_buf, const H5S_t *space,
/* Loop until all elements are written */
while(maxelem>0) {
/* Get list of sequences for selection to write */
- if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed");
/* Loop, while sequences left to process */
@@ -1710,7 +2000,7 @@ H5S_select_mgath (const void *_buf, const H5S_t *space,
/* Loop until all elements are written */
while(maxelem>0) {
/* Get list of sequences for selection to write */
- if((*space->select.get_seq_list)(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(space,0,iter,dxpl_cache->vec_size,maxelem,&nseq,&nelem,off,len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed");
/* Loop, while sequences left to process */
@@ -1826,7 +2116,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc
/* Check if more file sequences are needed */
if(curr_file_seq>=file_nseq) {
/* Get sequences for file selection */
- if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Start at the beginning of the sequences again */
@@ -1836,7 +2126,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, const H5D_dcpl_cache_t *dc
/* Check if more memory sequences are needed */
if(curr_mem_seq>=mem_nseq) {
/* Get sequences for memory selection */
- if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Start at the beginning of the sequences again */
@@ -1864,13 +2154,13 @@ HDfprintf(stderr,"%s: mem_off[%Zu]=%Hu, mem_len[%Zu]=%Zu\n",FUNC,curr_mem_seq,me
done:
/* Release file selection iterator */
if(file_iter_init) {
- if (H5S_select_iter_release(&file_iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
/* Release memory selection iterator */
if(mem_iter_init) {
- if (H5S_select_iter_release(&mem_iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
@@ -1994,7 +2284,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca
#endif /* QAK */
if(curr_file_seq>=file_nseq) {
/* Get sequences for file selection */
- if((*file_space->select.get_seq_list)(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(file_space,H5S_GET_SEQ_LIST_SORTED,&file_iter,dxpl_cache->vec_size,nelmts,&file_nseq,&file_nelem,file_off,file_len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Start at the beginning of the sequences again */
@@ -2013,7 +2303,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, const H5D_dcpl_cache_t *dcpl_ca
/* Check if more memory sequences are needed */
if(curr_mem_seq>=mem_nseq) {
/* Get sequences for memory selection */
- if((*mem_space->select.get_seq_list)(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0)
+ if(H5S_SELECT_GET_SEQ_LIST(mem_space,0,&mem_iter,dxpl_cache->vec_size,nelmts,&mem_nseq,&mem_nelem,mem_off,mem_len)<0)
HGOTO_ERROR (H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed");
/* Start at the beginning of the sequences again */
@@ -2056,13 +2346,13 @@ for(u=curr_mem_seq; u<mem_nseq; u++)
done:
/* Release file selection iterator */
if(file_iter_init) {
- if (H5S_select_iter_release(&file_iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&file_iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */
/* Release memory selection iterator */
if(mem_iter_init) {
- if (H5S_select_iter_release(&mem_iter)<0)
+ if (H5S_SELECT_ITER_RELEASE(&mem_iter)<0)
HDONE_ERROR (H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator");
} /* end if */