mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
[svn-r5170]
Purpose: New feature Description: Fill-value's behaviors for contiguous dataset have been redefined. Basicly, dataset won't allocate space until it's necessary. Full details are available at http://hdf.ncsa.uiuc.edu/RFC/Fill_Value, at this moment. Platforms tested: Linux 2.2.
This commit is contained in:
parent
19c8cfa861
commit
ce920c6c04
@ -156,6 +156,10 @@ Documentation
|
||||
New Features
|
||||
============
|
||||
|
||||
* Fill-value's behaviors for contiguous dataset have been redefined.
|
||||
Basicly, dataset won't allocate space until it's necessary. Full details
|
||||
are available at http://hdf.ncsa.uiuc.edu/RFC/Fill_Value, at this moment.
|
||||
SLU - 2002/04/11
|
||||
* Added new routine "H5Dfill" to fill a selection with a particular value
|
||||
in memory. QAK - 2002/04/09
|
||||
* A new query function H5Tget_member_index has been added for compound
|
||||
|
@ -55,10 +55,19 @@
|
||||
#define H5D_CRT_CHUNK_SIZE_SIZE sizeof(hsize_t[32])
|
||||
#define H5D_CRT_CHUNK_SIZE_DEF {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,\
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}
|
||||
/* Definitions for fill value */
|
||||
#define H5D_CRT_FILL_VALUE_NAME "fill"
|
||||
/* Definitions for fill value. size=0 means fill value will be 0 as
|
||||
* library default; size=-1 means fill value is undefined. */
|
||||
#define H5D_CRT_FILL_VALUE_NAME "fill_value"
|
||||
#define H5D_CRT_FILL_VALUE_SIZE sizeof(H5O_fill_t)
|
||||
#define H5D_CRT_FILL_VALUE_DEF {NULL, 0, NULL}
|
||||
/* Definitions for space allocation time */
|
||||
#define H5D_CRT_SPACE_TIME_NAME "space_time"
|
||||
#define H5D_CRT_SPACE_TIME_SIZE sizeof(H5D_space_time_t)
|
||||
#define H5D_CRT_SPACE_TIME_DEF H5D_SPACE_ALLOC_LATE
|
||||
/* Definitions for time of fill value writing */
|
||||
#define H5D_CRT_FILL_TIME_NAME "fill_time"
|
||||
#define H5D_CRT_FILL_TIME_SIZE sizeof(H5D_fill_time_t)
|
||||
#define H5D_CRT_FILL_TIME_DEF H5D_FILL_TIME_ALLOC
|
||||
/* Definitions for external file list */
|
||||
#define H5D_CRT_EXT_FILE_LIST_NAME "efl"
|
||||
#define H5D_CRT_EXT_FILE_LIST_SIZE sizeof(H5O_efl_t)
|
||||
|
@ -27,10 +27,39 @@ typedef enum H5D_layout_t {
|
||||
H5D_COMPACT = 0, /*raw data is very small */
|
||||
H5D_CONTIGUOUS = 1, /*the default */
|
||||
H5D_CHUNKED = 2, /*slow and fancy */
|
||||
|
||||
H5D_NLAYOUTS = 3 /*this one must be last! */
|
||||
} H5D_layout_t;
|
||||
|
||||
/* Values for the space allocation time property */
|
||||
typedef enum H5D_space_time_t {
|
||||
H5D_SPACE_ALLOC_ERROR =-1,
|
||||
H5D_SPACE_ALLOC_LATE =0,
|
||||
H5D_SPACE_ALLOC_EARLY =1
|
||||
} H5D_space_time_t;
|
||||
|
||||
/* Values for the status of space allocation */
|
||||
typedef enum H5D_space_status_t {
|
||||
H5D_SPACE_STATUS_ERROR =-1,
|
||||
H5D_SPACE_STATUS_NOT_ALLOCATED =0,
|
||||
H5D_SPACE_STATUS_PART_ALLOCATED =1,
|
||||
H5D_SPACE_STATUS_ALLOCATED =2
|
||||
} H5D_space_status_t;
|
||||
|
||||
/* Values for time of writing fill value property */
|
||||
typedef enum H5D_fill_time_t {
|
||||
H5D_FILL_TIME_ERROR =-1,
|
||||
H5D_FILL_TIME_ALLOC =0,
|
||||
H5D_FILL_TIME_NEVER =1
|
||||
} H5D_fill_time_t;
|
||||
|
||||
/* Values for fill value status */
|
||||
typedef enum H5D_fill_value_t {
|
||||
H5D_FILL_VALUE_ERROR =-1,
|
||||
H5D_FILL_VALUE_UNDEFINED =0,
|
||||
H5D_FILL_VALUE_DEFAULT =1,
|
||||
H5D_FILL_VALUE_USER_DEFINED =2
|
||||
} H5D_fill_value_t;
|
||||
|
||||
/* Define the operator function pointer for H5Diterate() */
|
||||
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, hsize_t ndim,
|
||||
hssize_t *point, void *operator_data);
|
||||
@ -44,6 +73,8 @@ __DLL__ hid_t H5Dcreate (hid_t file_id, const char *name, hid_t type_id,
|
||||
__DLL__ hid_t H5Dopen (hid_t file_id, const char *name);
|
||||
__DLL__ herr_t H5Dclose (hid_t dset_id);
|
||||
__DLL__ hid_t H5Dget_space (hid_t dset_id);
|
||||
__DLL__ herr_t H5Dget_space_status(hid_t dset_id,
|
||||
H5D_space_status_t *allocation);
|
||||
__DLL__ hid_t H5Dget_type (hid_t dset_id);
|
||||
__DLL__ hid_t H5Dget_create_plist (hid_t dset_id);
|
||||
__DLL__ hsize_t H5Dget_storage_size(hid_t dset_id);
|
||||
|
@ -63,8 +63,8 @@ static const H5O_class_t *const message_type_g[] = {
|
||||
H5O_SDSPACE, /*0x0001 Simple Dimensionality */
|
||||
NULL, /*0x0002 Data space (fiber bundle?) */
|
||||
H5O_DTYPE, /*0x0003 Data Type */
|
||||
H5O_FILL, /*0x0004 Data storage -- fill value */
|
||||
NULL, /*0x0005 Not assigned */
|
||||
H5O_FILL, /*0x0004 Old data storage -- fill value */
|
||||
H5O_FILL_NEW, /*0x0005 New Data storage -- fill value */
|
||||
NULL, /*0x0006 Data storage -- compact object */
|
||||
H5O_EFL, /*0x0007 Data storage -- external data files */
|
||||
H5O_LAYOUT, /*0x0008 Data Layout */
|
||||
|
476
src/H5Ofill.c
476
src/H5Ofill.c
@ -17,45 +17,146 @@
|
||||
|
||||
#define PABLO_MASK H5O_fill_mask
|
||||
|
||||
static void *H5O_fill_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh);
|
||||
static void *H5O_fill_new_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh);
|
||||
static herr_t H5O_fill_new_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_fill_new_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_fill_new_size(H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_fill_new_reset(void *_mesg);
|
||||
static herr_t H5O_fill_new_debug(H5F_t *f, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
static void *H5O_fill_decode(H5F_t *f, const uint8_t *p, H5O_shared_t *sh);
|
||||
static herr_t H5O_fill_encode(H5F_t *f, uint8_t *p, const void *_mesg);
|
||||
static void *H5O_fill_copy(const void *_mesg, void *_dest);
|
||||
static void *H5O_fill_copy(const void *_mesg, void *_dest);
|
||||
static size_t H5O_fill_size(H5F_t *f, const void *_mesg);
|
||||
static herr_t H5O_fill_reset(void *_mesg);
|
||||
static herr_t H5O_fill_debug(H5F_t *f, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth);
|
||||
|
||||
/* This message derives from H5O */
|
||||
/* This message derives from H5O, for old fill value before version 1.5 */
|
||||
const H5O_class_t H5O_FILL[1] = {{
|
||||
H5O_FILL_ID, /*message id number */
|
||||
"fill", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_fill_decode, /*decode message */
|
||||
H5O_fill_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
NULL, /* free method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_fill_debug, /*debug the message */
|
||||
H5O_FILL_ID, /*message id number */
|
||||
"fill", /*message name for debugging */
|
||||
sizeof(H5O_fill_t), /*native message size */
|
||||
H5O_fill_decode, /*decode message */
|
||||
H5O_fill_encode, /*encode message */
|
||||
H5O_fill_copy, /*copy the native value */
|
||||
H5O_fill_size, /*raw message size */
|
||||
H5O_fill_reset, /*free internal memory */
|
||||
NULL, /* free method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_fill_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
/* This message derives from H5O, for new fill value after version 1.4 */
|
||||
const H5O_class_t H5O_FILL_NEW[1] = {{
|
||||
H5O_FILL_NEW_ID, /*message id number */
|
||||
"fill_new", /*message name for debugging */
|
||||
sizeof(H5O_fill_new_t), /*native message size */
|
||||
H5O_fill_new_decode, /*decode message */
|
||||
H5O_fill_new_encode, /*encode message */
|
||||
H5O_fill_new_copy, /*copy the native value */
|
||||
H5O_fill_new_size, /*raw message size */
|
||||
H5O_fill_new_reset, /*free internal memory */
|
||||
NULL, /* free method */
|
||||
NULL, /*get share method */
|
||||
NULL, /*set share method */
|
||||
H5O_fill_new_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
#define H5O_FILL_VERSION 1
|
||||
|
||||
/* Interface initialization */
|
||||
static int interface_initialize_g = 0;
|
||||
#define INTERFACE_INIT NULL
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_decode
|
||||
* Function: H5O_fill_new_decode
|
||||
*
|
||||
* Purpose: Decode a fill value message.
|
||||
* Purpose: Decode a new fill value message. The new fill value
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Ptr to new message in native struct.
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_fill_new_decode(H5F_t UNUSED *f, const uint8_t *p,
|
||||
H5O_shared_t UNUSED *sh)
|
||||
{
|
||||
H5O_fill_new_t *mesg=NULL;
|
||||
int version;
|
||||
void *ret_value = NULL;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_decode, NULL);
|
||||
assert(f);
|
||||
assert(p);
|
||||
assert(!sh);
|
||||
|
||||
if (NULL==(mesg=H5MM_calloc(sizeof(H5O_fill_new_t)))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value message");
|
||||
}
|
||||
|
||||
/* Version */
|
||||
version = *p++;
|
||||
if( version != H5O_FILL_VERSION) {
|
||||
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
|
||||
"bad version number for fill value message");
|
||||
}
|
||||
|
||||
/* Space allocation time */
|
||||
mesg->space_time = *p++;
|
||||
|
||||
/* Fill value write time */
|
||||
mesg->fill_time = *p++;
|
||||
|
||||
/* Whether fill value is defined */
|
||||
mesg->fill_defined = *p++;
|
||||
|
||||
/* Does it handle undefined fill value? */
|
||||
UINT32DECODE(p, mesg->size);
|
||||
if (mesg->size>0) {
|
||||
H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
|
||||
if (NULL==(mesg->buf=H5MM_malloc((size_t)mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
HDmemcpy(mesg->buf, p, (size_t)mesg->size);
|
||||
}
|
||||
|
||||
ret_value = (void*)mesg;
|
||||
|
||||
done:
|
||||
if (!ret_value && mesg) {
|
||||
if(mesg->buf)
|
||||
H5MM_xfree(mesg->buf);
|
||||
H5MM_xfree(mesg);
|
||||
}
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_decode
|
||||
*
|
||||
* Purpose: Decode a fill value message.
|
||||
*
|
||||
* Return: Success: Ptr to new message in native struct.
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Wednesday, September 30, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -64,10 +165,10 @@ static int interface_initialize_g = 0;
|
||||
*/
|
||||
static void *
|
||||
H5O_fill_decode(H5F_t UNUSED *f, const uint8_t *p,
|
||||
H5O_shared_t UNUSED *sh)
|
||||
H5O_shared_t UNUSED *sh)
|
||||
{
|
||||
H5O_fill_t *mesg=NULL;
|
||||
void *ret_value = NULL;
|
||||
H5O_fill_t *mesg=NULL;
|
||||
void *ret_value = NULL;
|
||||
|
||||
FUNC_ENTER(H5O_fill_decode, NULL);
|
||||
assert(f);
|
||||
@ -75,37 +176,85 @@ H5O_fill_decode(H5F_t UNUSED *f, const uint8_t *p,
|
||||
assert(!sh);
|
||||
|
||||
if (NULL==(mesg=H5MM_calloc(sizeof(H5O_fill_t)))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value message");
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value message");
|
||||
}
|
||||
UINT32DECODE(p, mesg->size);
|
||||
if (mesg->size>0) {
|
||||
if (NULL==(mesg->buf=H5MM_malloc(mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
HDmemcpy(mesg->buf, p, mesg->size);
|
||||
if (NULL==(mesg->buf=H5MM_malloc(mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
HDmemcpy(mesg->buf, p, mesg->size);
|
||||
}
|
||||
|
||||
ret_value = (void*)mesg;
|
||||
|
||||
done:
|
||||
if (!ret_value && mesg) {
|
||||
H5MM_xfree(mesg->buf);
|
||||
H5MM_xfree(mesg);
|
||||
if(mesg->buf)
|
||||
H5MM_xfree(mesg->buf);
|
||||
H5MM_xfree(mesg);
|
||||
}
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_encode
|
||||
* Function: H5O_fill_new_encode
|
||||
*
|
||||
* Purpose: Encode a fill value message.
|
||||
* Purpose: Encode a new fill value message. The new fill value
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_fill_new_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
|
||||
{
|
||||
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_encode, FAIL);
|
||||
assert(f);
|
||||
assert(p);
|
||||
assert(mesg && NULL==mesg->type);
|
||||
|
||||
/* Version */
|
||||
*p++ = H5O_FILL_VERSION;
|
||||
/* Space allocation time */
|
||||
*p++ = mesg->space_time;
|
||||
/* Fill value writing time */
|
||||
*p++ = mesg->fill_time;
|
||||
/* Whether fill value is defined */
|
||||
*p++ = mesg->fill_defined;
|
||||
|
||||
/* Does it handle undefined fill value? */
|
||||
UINT32ENCODE(p, mesg->size);
|
||||
if(mesg->size>0)
|
||||
if(mesg->buf) {
|
||||
H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
|
||||
HDmemcpy(p, mesg->buf, (size_t)mesg->size);
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_encode
|
||||
*
|
||||
* Purpose: Encode a fill value message.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, October 1, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -115,7 +264,7 @@ H5O_fill_decode(H5F_t UNUSED *f, const uint8_t *p,
|
||||
static herr_t
|
||||
H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
|
||||
{
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_encode, FAIL);
|
||||
assert(f);
|
||||
@ -123,23 +272,94 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
|
||||
assert(mesg && NULL==mesg->type);
|
||||
|
||||
UINT32ENCODE(p, mesg->size);
|
||||
HDmemcpy(p, mesg->buf, mesg->size);
|
||||
if(mesg->buf)
|
||||
HDmemcpy(p, mesg->buf, mesg->size);
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_copy
|
||||
* Function: H5O_fill_new_copy
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
||||
* necessary.
|
||||
* necessary. The new fill value message is fill value plus
|
||||
* space allocation time and fill value writing time and
|
||||
* whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Programmer: Raymond Lu
|
||||
* Feb 26, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
H5O_fill_new_copy(const void *_mesg, void *_dest)
|
||||
{
|
||||
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
|
||||
H5O_fill_new_t *dest = (H5O_fill_new_t *)_dest;
|
||||
void *ret_value = NULL;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_copy, NULL);
|
||||
assert(mesg);
|
||||
|
||||
if (!dest && NULL==(dest=H5MM_calloc(sizeof(H5O_fill_new_t)))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill message");
|
||||
}
|
||||
/* Copy data type of fill value */
|
||||
if (mesg->type &&
|
||||
NULL==(dest->type=H5T_copy(mesg->type, H5T_COPY_TRANSIENT))) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
|
||||
"unable to copy fill value data type");
|
||||
}
|
||||
/* Copy fill value and its size */
|
||||
if (mesg->buf) {
|
||||
H5_CHECK_OVERFLOW(mesg->size,ssize_t,size_t);
|
||||
if (NULL==(dest->buf=H5MM_malloc((size_t)mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
dest->size = mesg->size;
|
||||
HDmemcpy(dest->buf, mesg->buf, (size_t)mesg->size);
|
||||
}
|
||||
|
||||
/* Copy three fill value attributes */
|
||||
dest->space_time = mesg->space_time;
|
||||
dest->fill_time = mesg->fill_time;
|
||||
dest->fill_defined = mesg->fill_defined;
|
||||
|
||||
ret_value = dest;
|
||||
|
||||
done:
|
||||
if (!ret_value && dest) {
|
||||
if(dest->buf)
|
||||
H5MM_xfree(dest->buf);
|
||||
if (dest->type)
|
||||
H5T_close(dest->type);
|
||||
if (!_dest)
|
||||
H5MM_xfree(dest);
|
||||
}
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_copy
|
||||
*
|
||||
* Purpose: Copies a message from _MESG to _DEST, allocating _DEST if
|
||||
* necessary.
|
||||
*
|
||||
* Return: Success: Ptr to _DEST
|
||||
*
|
||||
* Failure: NULL
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, October 1, 1998
|
||||
*
|
||||
* Modifications:
|
||||
@ -149,48 +369,53 @@ H5O_fill_encode(H5F_t UNUSED *f, uint8_t *p, const void *_mesg)
|
||||
static void *
|
||||
H5O_fill_copy(const void *_mesg, void *_dest)
|
||||
{
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
H5O_fill_t *dest = (H5O_fill_t *)_dest;
|
||||
void *ret_value = NULL;
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
H5O_fill_t *dest = (H5O_fill_t *)_dest;
|
||||
void *ret_value = NULL;
|
||||
|
||||
FUNC_ENTER(H5O_fill_copy, NULL);
|
||||
assert(mesg);
|
||||
|
||||
if (!dest && NULL==(dest=H5MM_calloc(sizeof(H5O_fill_t)))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill message");
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill message");
|
||||
}
|
||||
if (mesg->type &&
|
||||
NULL==(dest->type=H5T_copy(mesg->type, H5T_COPY_TRANSIENT))) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
|
||||
"unable to copy fill value data type");
|
||||
NULL==(dest->type=H5T_copy(mesg->type, H5T_COPY_TRANSIENT))) {
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL,
|
||||
"unable to copy fill value data type");
|
||||
}
|
||||
if (mesg->buf) {
|
||||
if (NULL==(dest->buf=H5MM_malloc(mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
dest->size = mesg->size;
|
||||
HDmemcpy(dest->buf, mesg->buf, mesg->size);
|
||||
if (NULL==(dest->buf=H5MM_malloc(mesg->size))) {
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
|
||||
"memory allocation failed for fill value");
|
||||
}
|
||||
dest->size = mesg->size;
|
||||
HDmemcpy(dest->buf, mesg->buf, mesg->size);
|
||||
}
|
||||
ret_value = dest;
|
||||
|
||||
done:
|
||||
done:
|
||||
if (!ret_value && dest) {
|
||||
H5MM_xfree(dest->buf);
|
||||
if (dest->type) H5T_close(dest->type);
|
||||
if (!_dest) H5MM_xfree(dest);
|
||||
if(dest->buf)
|
||||
H5MM_xfree(dest->buf);
|
||||
if (dest->type)
|
||||
H5T_close(dest->type);
|
||||
if (!_dest)
|
||||
H5MM_xfree(dest);
|
||||
}
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_size
|
||||
* Function: H5O_fill_new_size
|
||||
*
|
||||
* Purpose: Returns the size of the raw message in bytes not counting the
|
||||
* message type or size fields, but only the data fields. This
|
||||
* function doesn't take into account alignment.
|
||||
* function doesn't take into account alignment. The new fill
|
||||
* value message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Success: Message data size in bytes w/o alignment.
|
||||
*
|
||||
@ -204,9 +429,47 @@ H5O_fill_copy(const void *_mesg, void *_dest)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5O_fill_new_size(H5F_t UNUSED *f, const void *_mesg)
|
||||
{
|
||||
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
|
||||
size_t ret_value = 0;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_size, 0);
|
||||
assert(f);
|
||||
assert(mesg);
|
||||
|
||||
ret_value = 1 + /* Version number */
|
||||
1 + /* Space allocation time */
|
||||
1 + /* Fill value write time */
|
||||
1 + /* Fill value defined */
|
||||
4 + /* Fill value size */
|
||||
(mesg->size>0 ? mesg->size : 0); /* Size of fill value */
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_size
|
||||
*
|
||||
* Purpose: Returns the size of the raw message in bytes not counting the
|
||||
* message type or size fields, but only the data fields. This
|
||||
* function doesn't take into account alignment.
|
||||
*
|
||||
* Return: Success: Message data size in bytes w/o alignment.
|
||||
*
|
||||
* Failure: 0
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, October 1, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static size_t
|
||||
H5O_fill_size(H5F_t UNUSED *f, const void *_mesg)
|
||||
{
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
const H5O_fill_t *mesg = (const H5O_fill_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_size, 0);
|
||||
assert(f);
|
||||
@ -217,9 +480,11 @@ H5O_fill_size(H5F_t UNUSED *f, const void *_mesg)
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_reset
|
||||
* Function: H5O_fill_new_reset
|
||||
*
|
||||
* Purpose: Resets a message to an initial state
|
||||
* Purpose: Resets a new message to an initial state. The new fill value
|
||||
* message is fill value plus space allocation time and
|
||||
* fill value writing time and whether fill value is defined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
@ -231,18 +496,96 @@ H5O_fill_size(H5F_t UNUSED *f, const void *_mesg)
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_fill_new_reset(void *_mesg)
|
||||
{
|
||||
H5O_fill_new_t *mesg = (H5O_fill_new_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_reset, FAIL);
|
||||
assert(mesg);
|
||||
|
||||
if(mesg->buf)
|
||||
mesg->buf = H5MM_xfree(mesg->buf);
|
||||
mesg->size = -1;
|
||||
if (mesg->type) {
|
||||
H5T_close(mesg->type);
|
||||
mesg->type = NULL;
|
||||
}
|
||||
mesg->space_time = 0;
|
||||
mesg->fill_time = 0;
|
||||
mesg->fill_defined = 0;
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_reset
|
||||
*
|
||||
* Purpose: Resets a message to an initial state
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, October 1, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_fill_reset(void *_mesg)
|
||||
{
|
||||
H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
|
||||
H5O_fill_t *mesg = (H5O_fill_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_reset, FAIL);
|
||||
assert(mesg);
|
||||
|
||||
mesg->buf = H5MM_xfree(mesg->buf);
|
||||
if(mesg->buf)
|
||||
mesg->buf = H5MM_xfree(mesg->buf);
|
||||
mesg->size = 0;
|
||||
if (mesg->type) {
|
||||
H5T_close(mesg->type);
|
||||
mesg->type = NULL;
|
||||
H5T_close(mesg->type);
|
||||
mesg->type = NULL;
|
||||
}
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5O_fill_new_debug
|
||||
*
|
||||
* Purpose: Prints debugging info for the message.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Robb Matzke
|
||||
* Thursday, October 1, 1998
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
H5O_fill_new_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream,
|
||||
int indent, int fwidth)
|
||||
{
|
||||
const H5O_fill_new_t *mesg = (const H5O_fill_new_t *)_mesg;
|
||||
|
||||
FUNC_ENTER(H5O_fill_new_debug, FAIL);
|
||||
assert(f);
|
||||
assert(mesg);
|
||||
assert(stream);
|
||||
assert(indent>=0);
|
||||
assert(fwidth>=0);
|
||||
|
||||
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
|
||||
"Bytes:", mesg->size);
|
||||
fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:");
|
||||
if (mesg->type) {
|
||||
H5T_debug(mesg->type, stream);
|
||||
fprintf(stream, "\n");
|
||||
} else {
|
||||
fprintf(stream, "<dataset type>\n");
|
||||
}
|
||||
|
||||
FUNC_LEAVE(SUCCEED);
|
||||
@ -308,8 +651,9 @@ H5O_fill_debug(H5F_t UNUSED *f, const void *_mesg, FILE *stream,
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type)
|
||||
H5O_fill_convert(void *_fill, H5T_t *dset_type)
|
||||
{
|
||||
H5O_fill_new_t *fill = _fill;
|
||||
H5T_path_t *tpath=NULL; /*type conversion info */
|
||||
void *buf=NULL, *bkg=NULL; /*conversion buffers */
|
||||
hid_t src_id=-1, dst_id=-1; /*data type identifiers */
|
||||
|
@ -39,7 +39,10 @@ const H5O_class_t H5O_LAYOUT[1] = {{
|
||||
H5O_layout_debug, /*debug the message */
|
||||
}};
|
||||
|
||||
#define H5O_LAYOUT_VERSION 1
|
||||
/* For forward and backward compatibility. Version is 1 when space is
|
||||
* allocated; 2 when space is delayed for allocation. */
|
||||
#define H5O_LAYOUT_VERSION_1 1
|
||||
#define H5O_LAYOUT_VERSION_2 2
|
||||
|
||||
/* Interface initialization */
|
||||
#define PABLO_MASK H5O_layout_mask
|
||||
@ -67,6 +70,10 @@ H5FL_DEFINE(H5O_layout_t);
|
||||
* Robb Matzke, 1998-07-20
|
||||
* Rearranged the message to add a version number at the beginning.
|
||||
*
|
||||
* Raymond Lu, 2002-2-26
|
||||
* Added version number 2 case depends on if space has been allocated
|
||||
* at the moment when layout header message is updated.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void *
|
||||
@ -89,9 +96,9 @@ H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
|
||||
"memory allocation failed");
|
||||
}
|
||||
|
||||
/* Version */
|
||||
/* Version. 1 when space allocated; 2 when space allocation is delayed */
|
||||
version = *p++;
|
||||
if (version!=H5O_LAYOUT_VERSION) {
|
||||
if (version!=H5O_LAYOUT_VERSION_1 && version!=H5O_LAYOUT_VERSION_2) {
|
||||
HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL,
|
||||
"bad version number for layout message");
|
||||
}
|
||||
@ -136,6 +143,10 @@ H5O_layout_decode(H5F_t *f, const uint8_t *p, H5O_shared_t UNUSED *sh)
|
||||
* Robb Matzke, 1998-07-20
|
||||
* Rearranged the message to add a version number at the beginning.
|
||||
*
|
||||
* Raymond Lu, 2002-2-26
|
||||
* Added version number 2 case depends on if space has been allocated
|
||||
* at the moment when layout header message is updated.
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static herr_t
|
||||
@ -152,8 +163,14 @@ H5O_layout_encode(H5F_t *f, uint8_t *p, const void *_mesg)
|
||||
assert(mesg->ndims > 0 && mesg->ndims <= H5O_LAYOUT_NDIMS);
|
||||
assert(p);
|
||||
|
||||
/* Version */
|
||||
*p++ = H5O_LAYOUT_VERSION;
|
||||
/* Version: 1 when space allocated; 2 when space allocation is delayed */
|
||||
if(mesg->type==H5D_CONTIGUOUS) {
|
||||
if(mesg->addr==HADDR_UNDEF)
|
||||
*p++ = H5O_LAYOUT_VERSION_2;
|
||||
else
|
||||
*p++ = H5O_LAYOUT_VERSION_1;
|
||||
} else
|
||||
*p++ = H5O_LAYOUT_VERSION_1;
|
||||
|
||||
/* number of dimensions */
|
||||
*p++ = mesg->ndims;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define _H5Oprivate_H
|
||||
|
||||
#include "H5Opublic.h"
|
||||
#include "H5Dpublic.h"
|
||||
|
||||
/* Private headers needed by this file */
|
||||
#include "H5private.h"
|
||||
@ -136,17 +137,34 @@ __DLLVAR__ const H5O_class_t H5O_DTYPE[1];
|
||||
/* operates on an H5T_t struct */
|
||||
|
||||
/*
|
||||
* Fill Value Message.
|
||||
* Old Fill Value Message.
|
||||
*/
|
||||
#define H5O_FILL_ID 0x0004
|
||||
__DLLVAR__ const H5O_class_t H5O_FILL[1];
|
||||
#define H5O_FILL_ID 0x0004
|
||||
__DLLVAR__ const H5O_class_t H5O_FILL[1];
|
||||
|
||||
typedef struct H5O_fill_t {
|
||||
H5T_t *type; /*type. Null implies same as dataset */
|
||||
size_t size; /*number of bytes in the fill value */
|
||||
void *buf; /*the fill value */
|
||||
H5T_t *type; /*type. Null implies same as dataset */
|
||||
size_t size; /*number of bytes in the fill value */
|
||||
void *buf; /*the fill value */
|
||||
} H5O_fill_t;
|
||||
|
||||
/*
|
||||
* New Fill Value Message. The new fill value message is fill value plus
|
||||
* space allocation time and fill value writing time and whether fill
|
||||
* value is defined.
|
||||
*/
|
||||
#define H5O_FILL_NEW_ID 0x0005
|
||||
__DLLVAR__ const H5O_class_t H5O_FILL_NEW[1];
|
||||
|
||||
typedef struct H5O_fill_new_t {
|
||||
H5T_t *type; /*type. Null implies same as dataset */
|
||||
ssize_t size; /*number of bytes in the fill value */
|
||||
void *buf; /*the fill value */
|
||||
H5D_space_time_t space_time; /* time to allocate space */
|
||||
H5D_fill_time_t fill_time; /* time to write fill value */
|
||||
htri_t fill_defined; /* whether fill value is defined */
|
||||
} H5O_fill_new_t;
|
||||
|
||||
|
||||
/*
|
||||
* External File List Message
|
||||
@ -302,6 +320,6 @@ __DLL__ herr_t H5O_efl_write(H5F_t *f, const H5O_efl_t *efl, haddr_t addr,
|
||||
size_t size, const uint8_t *buf);
|
||||
|
||||
/* Fill value operators */
|
||||
__DLL__ herr_t H5O_fill_convert(H5O_fill_t *fill, H5T_t *type);
|
||||
__DLL__ herr_t H5O_fill_convert(void *_fill, H5T_t *type);
|
||||
|
||||
#endif
|
||||
|
322
src/H5P.c
322
src/H5P.c
@ -3210,7 +3210,9 @@ done:
|
||||
* VALUE is interpretted as being of type TYPE, which need not
|
||||
* be the same type as the dataset but the library must be able
|
||||
* to convert VALUE to the dataset type when the dataset is
|
||||
* created.
|
||||
* created. If VALUE is NULL, it will be interpreted as
|
||||
* undefining fill value. The fill value property will be
|
||||
* removed from property list.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
@ -3229,11 +3231,11 @@ done:
|
||||
herr_t
|
||||
H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
|
||||
{
|
||||
H5O_fill_t fill;
|
||||
H5O_fill_t fill;
|
||||
H5T_t *type = NULL;
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
|
||||
FUNC_ENTER(H5Pset_fill_value, FAIL);
|
||||
H5TRACE3("e","iix",plist_id,type_id,value);
|
||||
|
||||
@ -3245,26 +3247,36 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value)
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Get the "basic" fill value structure */
|
||||
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
|
||||
|
||||
if (H5I_DATATYPE!=H5I_get_type(type_id) || NULL==(type=H5I_object(type_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
|
||||
if (!value)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no fill value specified");
|
||||
/* Reset the fill structure */
|
||||
if(H5O_reset(H5O_FILL, &fill)<0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't reset fill value");
|
||||
|
||||
/* Set the fill value */
|
||||
H5O_reset(H5O_FILL, &fill);
|
||||
if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data type");
|
||||
fill.size = H5T_get_size(type);
|
||||
if (NULL==(fill.buf=H5MM_malloc(fill.size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value");
|
||||
HDmemcpy(fill.buf, value, fill.size);
|
||||
if(value) {
|
||||
if (H5I_DATATYPE!=H5I_get_type(type_id) ||
|
||||
NULL==(type=H5I_object(type_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
|
||||
|
||||
/* Set the fill value */
|
||||
if (NULL==(fill.type=H5T_copy(type, H5T_COPY_TRANSIENT)))
|
||||
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
|
||||
"unable to copy data type");
|
||||
fill.size = H5T_get_size(type);
|
||||
if (NULL==(fill.buf=H5MM_malloc(fill.size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL,
|
||||
"memory allocation failed for fill value");
|
||||
HDmemcpy(fill.buf, value, fill.size);
|
||||
} else {
|
||||
fill.type = fill.buf = NULL;
|
||||
fill.size = (size_t)-1;
|
||||
}
|
||||
|
||||
if(H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value");
|
||||
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
@ -3314,8 +3326,8 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
|
||||
if (H5I_DATATYPE!=H5I_get_type(type_id) || NULL==(type=H5I_object(type_id)))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
|
||||
if (!value)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no fill value output buffer");
|
||||
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,"no fill value output buffer");
|
||||
|
||||
/* Get the plist structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
@ -3323,14 +3335,20 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/)
|
||||
/*
|
||||
* If no fill value is defined then return an error. We can't even
|
||||
* return zero because we don't know the data type of the dataset and
|
||||
* data type conversion might not have resulted in zero.
|
||||
* data type conversion might not have resulted in zero. If fill value
|
||||
* is undefined, also return error.
|
||||
*/
|
||||
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
|
||||
if(NULL == fill.buf)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no fill value defined");
|
||||
if(fill.size == (size_t)-1)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL,
|
||||
"fill value is undefined");
|
||||
|
||||
/*
|
||||
if(fill.size == 0) {
|
||||
HDmemset(value, 0, H5T_get_size(type));
|
||||
HRETURN(SUCCEED);
|
||||
}
|
||||
/*
|
||||
* Can we convert between the source and destination data types?
|
||||
*/
|
||||
if(NULL==(tpath=H5T_path_find(fill.type, type, NULL, NULL)))
|
||||
@ -3374,6 +3392,266 @@ done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5P_fill_value_defined
|
||||
*
|
||||
* Purpose: Check if fill value is defined. Internal version of function
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status)
|
||||
{
|
||||
herr_t ret_value = SUCCEED;
|
||||
H5O_fill_t fill;
|
||||
|
||||
FUNC_ENTER(H5P_fill_value_defined, FAIL);
|
||||
|
||||
assert(plist);
|
||||
assert(status);
|
||||
|
||||
/* Get the fill value struct */
|
||||
if(H5P_get(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value");
|
||||
|
||||
/* Check if the fill value was never set */
|
||||
if(fill.size == (size_t)-1 && !fill.buf) {
|
||||
*status = H5D_FILL_VALUE_UNDEFINED;
|
||||
}
|
||||
/* Check if the fill value was set to the default fill value by the library */
|
||||
else if(fill.size == 0 && !fill.buf) {
|
||||
*status = H5D_FILL_VALUE_DEFAULT;
|
||||
}
|
||||
/* Check if the fill value was set by the application */
|
||||
else if(fill.size > 0 && fill.buf) {
|
||||
*status = H5D_FILL_VALUE_USER_DEFINED;
|
||||
}
|
||||
else {
|
||||
*status = H5D_FILL_VALUE_ERROR;
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info");
|
||||
}
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5P_fill_value_defined() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pfill_value_defined
|
||||
*
|
||||
* Purpose: Check if fill value is defined.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status)
|
||||
{
|
||||
H5P_genplist_t *plist;
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER(H5Pfill_value_defined, FAIL);
|
||||
|
||||
assert(status);
|
||||
|
||||
/* Check arguments */
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
|
||||
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation proprety list");
|
||||
|
||||
/* Get the plist structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Call the internal function */
|
||||
if(H5P_fill_value_defined(plist, status) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value info");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
} /* end H5Pfill_value_defined() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_space_time
|
||||
*
|
||||
* Purpose: Set space allocation time for dataset during creation.
|
||||
* Valid values are H5D_EARLY, H5D_LATE.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pset_space_time(hid_t plist_id, H5D_space_time_t alloc_time)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER(H5Pset_space_time, FAIL);
|
||||
|
||||
/* Check args */
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
|
||||
|
||||
/* Get the property list structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Set values */
|
||||
if(H5P_set(plist, H5D_CRT_SPACE_TIME_NAME, &alloc_time) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_space_time
|
||||
*
|
||||
* Purpose: Get space allocation time for dataset creation. Valid
|
||||
* values are H5D_EARLY, H5D_LATE.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pget_space_time(hid_t plist_id, H5D_space_time_t *alloc_time/*out*/)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER(H5Pget_space_time, FAIL);
|
||||
H5TRACE2("e","ix",plist_id,alloc_time);
|
||||
|
||||
/* Check args */
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
|
||||
|
||||
/* Get the property list structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Get values */
|
||||
if(!alloc_time || H5P_get(plist, H5D_CRT_SPACE_TIME_NAME, alloc_time) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_fill_time
|
||||
*
|
||||
* Purpose: Set fill value writing time for dataset. Valid values are
|
||||
* H5D_ALLOC and H5D_NEVER.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER(H5Pset_fill_time, FAIL);
|
||||
|
||||
/* Check args */
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
|
||||
|
||||
/* Get the property list structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Set values */
|
||||
if(H5P_set(plist, H5D_CRT_FILL_TIME_NAME, &fill_time) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pget_fill_time
|
||||
*
|
||||
* Purpose: Get fill value writing time. Valid values are H5D_NEVER
|
||||
* and H5D_ALLOC.
|
||||
*
|
||||
* Return: Non-negative on success/Negative on failure
|
||||
*
|
||||
* Programmer: Raymond Lu
|
||||
* Wednesday, January 16, 2002
|
||||
*
|
||||
* Modifications:
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
herr_t
|
||||
H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time/*out*/)
|
||||
{
|
||||
H5P_genplist_t *plist; /* Property list pointer */
|
||||
herr_t ret_value = SUCCEED; /* return value */
|
||||
|
||||
FUNC_ENTER(H5Pget_fill_time, FAIL);
|
||||
H5TRACE2("e","ix",plist_id,fill_time);
|
||||
|
||||
/* Check args */
|
||||
if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list");
|
||||
|
||||
/* Get the property list structure */
|
||||
if(NULL == (plist = H5I_object(plist_id)))
|
||||
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID");
|
||||
|
||||
/* Set values */
|
||||
if(!fill_time || H5P_get(plist, H5D_CRT_FILL_TIME_NAME, fill_time) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time");
|
||||
|
||||
done:
|
||||
FUNC_LEAVE(ret_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: H5Pset_gc_references
|
||||
|
@ -46,6 +46,8 @@ __DLL__ herr_t H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id,
|
||||
__DLL__ herr_t H5P_set_vlen_mem_manager(H5P_genplist_t *plist,
|
||||
H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func,
|
||||
void *free_info);
|
||||
__DLL__ herr_t H5P_fill_value_defined(H5P_genplist_t *plist,
|
||||
H5D_fill_value_t *status);
|
||||
|
||||
/* *SPECIAL* Don't make more of these! -QAK */
|
||||
__DLL__ htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id);
|
||||
|
@ -230,6 +230,14 @@ __DLL__ herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id,
|
||||
const void *value);
|
||||
__DLL__ herr_t H5Pget_fill_value(hid_t plist_id, hid_t type_id,
|
||||
void *value/*out*/);
|
||||
__DLL__ herr_t H5Pfill_value_defined(hid_t plist, H5D_fill_value_t *status);
|
||||
__DLL__ herr_t H5Pset_space_time(hid_t plist_id, H5D_space_time_t
|
||||
alloc_time);
|
||||
__DLL__ herr_t H5Pget_space_time(hid_t plist_id, H5D_space_time_t
|
||||
*alloc_time/*out*/);
|
||||
__DLL__ herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
|
||||
__DLL__ herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t
|
||||
*fill_time/*out*/);
|
||||
__DLL__ herr_t H5Pset_gc_references(hid_t fapl_id, unsigned gc_ref);
|
||||
__DLL__ herr_t H5Pget_gc_references(hid_t fapl_id, unsigned *gc_ref/*out*/);
|
||||
__DLL__ herr_t H5Pset_fclose_degree(hid_t fapl_id, H5F_close_degree_t degree);
|
||||
|
@ -1084,7 +1084,7 @@ H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t op
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5S_all_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf)
|
||||
H5S_all_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
|
||||
{
|
||||
hssize_t nelemts; /* Number of elements in dataspace */
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
@ -6590,7 +6590,7 @@ done:
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S_hyper_select_fill_gen(const void *fill, size_t fill_size, H5S_t *space, void *buf)
|
||||
H5S_hyper_select_fill_gen(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
|
||||
{
|
||||
H5S_hyper_span_info_t *spans=NULL; /* Pointer to copy of the span tree */
|
||||
H5S_hyper_span_info_t *tmp_spans; /* Temporary pointer to a span tree */
|
||||
@ -6794,7 +6794,7 @@ done:
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
static herr_t
|
||||
H5S_hyper_select_fill_opt(const void *fill, size_t fill_size, H5S_t *space, void *buf)
|
||||
H5S_hyper_select_fill_opt(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
|
||||
{
|
||||
H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */
|
||||
hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */
|
||||
@ -6935,7 +6935,7 @@ done:
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5S_hyper_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf)
|
||||
H5S_hyper_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
|
||||
{
|
||||
herr_t ret_value=SUCCEED; /* return value */
|
||||
|
||||
|
@ -139,7 +139,7 @@ __DLL__ herr_t H5S_select_elements (H5S_t *space, H5S_seloper_t op,
|
||||
__DLL__ herr_t H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
__DLL__ herr_t H5S_point_select_fill(const void *fill, size_t fill_size,
|
||||
H5S_t *space, void *buf);
|
||||
const H5S_t *space, void *buf);
|
||||
|
||||
/* "All" select functions */
|
||||
__DLL__ herr_t H5S_all_release(H5S_t *space);
|
||||
@ -162,7 +162,7 @@ __DLL__ herr_t H5S_all_write(H5F_t *f, const struct H5O_layout_t *layout,
|
||||
__DLL__ herr_t H5S_all_select_iterate(void *buf, hid_t type_id, H5S_t *space,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
__DLL__ herr_t H5S_all_select_fill(const void *fill, size_t fill_size,
|
||||
H5S_t *space, void *buf);
|
||||
const H5S_t *space, void *buf);
|
||||
__DLL__ htri_t H5S_all_opt_possible(const H5S_t *mem_space,
|
||||
const H5S_t *file_space, const unsigned flags);
|
||||
|
||||
@ -184,7 +184,7 @@ __DLL__ htri_t H5S_hyper_select_regular(const H5S_t *space);
|
||||
__DLL__ herr_t H5S_hyper_select_iterate(void *buf, hid_t type_id, H5S_t *space,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
__DLL__ herr_t H5S_hyper_select_fill(const void *fill, size_t fill_size,
|
||||
H5S_t *space, void *buf);
|
||||
const H5S_t *space, void *buf);
|
||||
|
||||
/* "None" selection functions */
|
||||
__DLL__ herr_t H5S_select_none(H5S_t *space);
|
||||
|
@ -1458,7 +1458,7 @@ H5S_point_select_iterate(void *buf, hid_t type_id, H5S_t *space, H5D_operator_t
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5S_point_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf)
|
||||
H5S_point_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *_buf)
|
||||
{
|
||||
hsize_t size[H5O_LAYOUT_NDIMS]; /* Total size of memory buf */
|
||||
uint8_t *buf=(uint8_t *)_buf; /* Alias for memory buffer */
|
||||
|
@ -222,11 +222,11 @@ __DLL__ htri_t H5S_select_single(const H5S_t *space);
|
||||
__DLL__ htri_t H5S_select_regular(const H5S_t *space);
|
||||
__DLL__ htri_t H5S_select_shape_same(const H5S_t *space1, const H5S_t *space2);
|
||||
__DLL__ herr_t H5S_select_iterate(void *buf, hid_t type_id, H5S_t *space,
|
||||
H5D_operator_t op, void *operator_data);
|
||||
H5D_operator_t op, void *operator_data);
|
||||
__DLL__ herr_t H5S_sel_iter_release(const H5S_t *space,
|
||||
H5S_sel_iter_t *sel_iter);
|
||||
__DLL__ herr_t H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space,
|
||||
void *buf);
|
||||
H5S_sel_iter_t *sel_iter);
|
||||
__DLL__ herr_t H5S_select_fill(const void *fill, size_t fill_size,
|
||||
const H5S_t *space, void *buf);
|
||||
|
||||
/* Needed for internal use of selections in H5Fistore code */
|
||||
__DLL__ herr_t H5S_select_all(H5S_t *space);
|
||||
|
@ -1565,7 +1565,7 @@ H5S_select_regular(const H5S_t *space)
|
||||
REVISION LOG
|
||||
--------------------------------------------------------------------------*/
|
||||
herr_t
|
||||
H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *buf)
|
||||
H5S_select_fill(const void *fill, size_t fill_size, const H5S_t *space, void *buf)
|
||||
{
|
||||
herr_t ret_value=FAIL; /* return value */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user