本文整理汇总了C++中HDassert函数的典型用法代码示例。如果您正苦于以下问题:C++ HDassert函数的具体用法?C++ HDassert怎么用?C++ HDassert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HDassert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: H5O_sdspace_free
/*-------------------------------------------------------------------------
* Function: H5O_sdsdpace_free
*
* Purpose: Free's the message
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, March 30, 2000
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_sdspace_free(void *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(mesg);
mesg = H5FL_FREE(H5S_extent_t, mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_sdspace_free() */
示例2: H5O__ginfo_free
/*-------------------------------------------------------------------------
* Function: H5O__ginfo_free
*
* Purpose: Frees the message
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, August 30, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O__ginfo_free(void *mesg)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(mesg);
mesg = H5FL_FREE(H5O_ginfo_t, mesg);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O__ginfo_free() */
示例3: H5D__single_idx_init
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_init
*
* Purpose: Initialize the indexing information for a dataset.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Vailin Choi
* July, 2011
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info,
const H5S_t H5_ATTR_UNUSED *space, haddr_t H5_ATTR_UNUSED dset_ohdr_addr)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(idx_info);
HDassert(idx_info->f);
HDassert(idx_info->pline);
HDassert(idx_info->layout);
HDassert(idx_info->storage);
if(idx_info->pline->nused)
idx_info->layout->flags |= H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER;
else
idx_info->layout->flags = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_init() */
示例4: H5G_traverse_ud
/*-------------------------------------------------------------------------
* Function: H5G_traverse_link_ud
*
* Purpose: Callback for user-defined link traversal. Sets up a
* location ID and passes it to the user traversal callback.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Tuesday, September 13, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk,
H5G_loc_t *obj_loc/*in,out*/, size_t *nlinks/*in,out*/, hid_t _lapl_id,
hid_t dxpl_id)
{
const H5L_class_t *link_class; /* User-defined link class */
hid_t cb_return = -1; /* The ID the user-defined callback returned */
H5G_loc_t grp_loc_copy;
H5G_name_t grp_path_copy;
H5O_loc_t grp_oloc_copy;
H5O_loc_t *new_oloc = NULL;
H5F_t *temp_file = NULL;
H5G_t *grp;
hid_t lapl_id = (-1); /* LAPL local to this routine */
H5P_genplist_t *lapl; /* LAPL with nlinks set */
hid_t cur_grp = (-1);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_ud)
/* Sanity check */
HDassert(grp_loc);
HDassert(lnk);
HDassert(lnk->type >= H5L_TYPE_UD_MIN);
HDassert(obj_loc);
HDassert(nlinks);
HDassert(_lapl_id >= 0);
/* Reset the object's path information, because we can't detect any changes
* in the "path" the user-defined callback takes */
H5G_name_free(obj_loc->path);
/* Get the link class for this type of link. */
if(NULL == (link_class = H5L_find_class(lnk->type)))
HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get UD link class")
/* Set up location for user-defined callback. Use a copy of our current
* grp_loc. */
grp_loc_copy.path = &grp_path_copy;
grp_loc_copy.oloc = &grp_oloc_copy;
H5G_loc_reset(&grp_loc_copy);
if(H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
/* Create a group to pass to the user-defined callback */
if((grp = H5G_open(&grp_loc_copy, dxpl_id)) == NULL)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group")
if((cur_grp = H5I_register(H5I_GROUP, grp)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group")
/* Check for generic default property list and use link access default if so */
if(_lapl_id == H5P_DEFAULT) {
HDassert(H5P_LINK_ACCESS_DEFAULT != -1);
if(NULL == (lapl = H5I_object(H5P_LINK_ACCESS_DEFAULT)))
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "unable to get default property list")
} /* end if */
示例5: H5HF_man_iter_ready
/*-------------------------------------------------------------------------
* Function: H5HF_man_iter_ready
*
* Purpose: Query if iterator is ready to use
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* [email protected]
* Apr 25 2006
*
*-------------------------------------------------------------------------
*/
hbool_t
H5HF_man_iter_ready(H5HF_block_iter_t *biter)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_man_iter_ready)
/*
* Check arguments.
*/
HDassert(biter);
FUNC_LEAVE_NOAPI(biter->ready)
} /* end H5HF_man_iter_ready() */
示例6: H5O_name_debug
/*-------------------------------------------------------------------------
* Function: H5O_name_debug
*
* Purpose: Prints debugging info for the message.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* [email protected]
* Aug 12 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_name_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void *_mesg, FILE *stream,
int indent, int fwidth)
{
const H5O_name_t *mesg = (const H5O_name_t *)_mesg;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(f);
HDassert(mesg);
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth,
"Name:",
mesg->s);
FUNC_LEAVE_NOAPI(SUCCEED)
}
示例7: H5HF_man_iter_next
/*-------------------------------------------------------------------------
* Function: H5HF_man_iter_next
*
* Purpose: Advance to the next block within the current block of the heap
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* [email protected]
* Apr 24 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_man_iter_next)
/*
* Check arguments.
*/
HDassert(biter);
HDassert(biter->curr);
HDassert(biter->curr->context);
HDassert(biter->curr->row < biter->curr->context->nrows);
/* Advance entry in current block */
biter->curr->entry += nentries;
biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width;
biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width;
/* HDassert(biter->curr->row <= biter->curr->context->nrows); */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_man_iter_next() */
示例8: H5D__single_idx_size
/*-------------------------------------------------------------------------
* Function: H5D__single_idx_size
*
* Purpose: Retrieve the amount of index storage for the chunked dataset
*
* Return: Success: Non-negative
* Failure: negative
*
* Programmer: Vailin Choi; Sept 2011
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *index_size)
{
FUNC_ENTER_STATIC_NOERR
/* Check args */
HDassert(index_size);
*index_size = 0;
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__single_idx_size() */
示例9: H5O_mtime_encode
/*-------------------------------------------------------------------------
* Function: H5O_mtime_encode
*
* Purpose: Encodes a modification time message.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* [email protected]
* Jul 24 1998
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, const void *_mesg)
{
const time_t *mesg = (const time_t *) _mesg;
struct tm *tm;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* check args */
HDassert(f);
HDassert(p);
HDassert(mesg);
/* encode */
tm = HDgmtime(mesg);
sprintf((char*)p, "%04d%02d%02d%02d%02d%02d",
1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
FUNC_LEAVE_NOAPI(SUCCEED)
}
示例10: h5_clean_files
/*-------------------------------------------------------------------------
* Function: h5_clean_files
*
* Purpose: Cleanup temporary test files (always).
* base_name contains the list of test file names.
*
* Return: void
*
* Programmer: Neil Fortner
* June 1, 2015
*
*-------------------------------------------------------------------------
*/
void
h5_clean_files(const char *base_name[], hid_t fapl)
{
int i;
for(i = 0; base_name[i]; i++) {
char filename[1024];
char temp[2048];
hid_t driver;
if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
continue;
driver = H5Pget_driver(fapl);
if(driver == H5FD_FAMILY) {
int j;
for(j = 0; /*void*/; j++) {
HDsnprintf(temp, sizeof temp, filename, j);
if(HDaccess(temp, F_OK) < 0)
break;
HDremove(temp);
} /* end for */
} else if(driver == H5FD_CORE) {
hbool_t backing; /* Whether the core file has backing store */
H5Pget_fapl_core(fapl, NULL, &backing);
/* If the file was stored to disk with bacing store, remove it */
if(backing)
HDremove(filename);
} else if (driver == H5FD_MULTI) {
H5FD_mem_t mt;
HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
HDremove(temp); /*don't care if it fails*/
} /* end for */
} else {
HDremove(filename);
}
} /* end for */
/* Close the FAPL used to access the file */
H5Pclose(fapl);
return;
} /* end h5_clean_files() */
示例11: H5G_compact_build_table
/*-------------------------------------------------------------------------
* Function: H5G_compact_build_table
*
* Purpose: Builds a table containing a sorted (alphabetically) list of
* links for a group
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Sep 6, 2005
*
*-------------------------------------------------------------------------
*/
static herr_t
H5G_compact_build_table(const H5O_loc_t *oloc, hid_t dxpl_id, const H5O_linfo_t *linfo,
H5_index_t idx_type, H5_iter_order_t order, H5G_link_table_t *ltable)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5G_compact_build_table)
/* Sanity check */
HDassert(oloc);
HDassert(linfo);
HDassert(ltable);
/* Set size of table */
H5_CHECK_OVERFLOW(linfo->nlinks, hsize_t, size_t);
ltable->nlinks = (size_t)linfo->nlinks;
/* Allocate space for the table entries */
if(ltable->nlinks > 0) {
H5G_iter_bt_t udata; /* User data for iteration callback */
H5O_mesg_operator_t op; /* Message operator */
/* Allocate the link table */
if((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Set up user data for iteration */
udata.ltable = ltable;
udata.curr_lnk = 0;
/* Iterate through the link messages, adding them to the table */
op.op_type = H5O_MESG_OP_APP;
op.u.app_op = H5G_compact_build_table_cb;
if(H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata, dxpl_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages")
/* Sort link table in correct iteration order */
if(H5G_link_sort_table(ltable, idx_type, order) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages")
} /* end if */
示例12: H5F_cwfs_add
/*-------------------------------------------------------------------------
* Function: H5F_cwfs_add
*
* Purpose: Add a global heap collection to the CWFS for a file.
*
* Return: Success: Non-negative
* Failure: Negative
*
* Programmer: Quincey Koziol
* Tuesday, July 19, 2011
*
*-------------------------------------------------------------------------
*/
herr_t
H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args */
HDassert(f);
HDassert(f->shared);
HDassert(heap);
/*
* Add the new heap to the CWFS list, removing some other entry if
* necessary to make room. We remove the right-most entry that has less
* free space than this heap.
*/
if(NULL == f->shared->cwfs) {
if(NULL == (f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5F_NCWFS * sizeof(H5HG_heap_t *))))
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate CWFS for file")
f->shared->cwfs[0] = heap;
f->shared->ncwfs = 1;
} else if(H5F_NCWFS == f->shared->ncwfs) {
int i; /* Local index variable */
for(i = H5F_NCWFS - 1; i >= 0; --i)
if(H5HG_FREE_SIZE(f->shared->cwfs[i]) < H5HG_FREE_SIZE(heap)) {
HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, (size_t)i * sizeof(H5HG_heap_t *));
f->shared->cwfs[0] = heap;
break;
} /* end if */
} else {
HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *));
f->shared->cwfs[0] = heap;
f->shared->ncwfs += 1;
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_cwfs_add() */
示例13: H5O_layout_delete
/*-------------------------------------------------------------------------
* Function: H5O_layout_delete
*
* Purpose: Free file space referenced by message
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Wednesday, March 19, 2003
*
*-------------------------------------------------------------------------
*/
static herr_t
H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
{
H5O_layout_t *mesg = (H5O_layout_t *) _mesg;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* check args */
HDassert(f);
HDassert(open_oh);
HDassert(mesg);
/* Perform different actions, depending on the type of storage */
switch(mesg->type) {
case H5D_COMPACT: /* Compact data storage */
/* Nothing required */
break;
case H5D_CONTIGUOUS: /* Contiguous block on disk */
/* Free the file space for the raw data */
if(H5D__contig_delete(f, dxpl_id, &mesg->storage) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
case H5D_CHUNKED: /* Chunked blocks on disk */
/* Free the file space for the index & chunk raw data */
if(H5D__chunk_delete(f, dxpl_id, open_oh, &mesg->storage) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type")
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_layout_delete() */
示例14: H5D__scatter_file
/*-------------------------------------------------------------------------
* Function: H5D__scatter_file
*
* Purpose: Scatters dataset elements from the type conversion buffer BUF
* to the file F where the data points are arranged according to
* the file dataspace FILE_SPACE and stored according to
* LAYOUT and EFL. Each element is ELMT_SIZE bytes.
* The caller is requesting that NELMTS elements are copied.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, June 20, 2002
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__scatter_file(const H5D_io_info_t *_io_info,
const H5S_t *space, H5S_sel_iter_t *iter, size_t nelmts,
const void *_buf)
{
H5D_io_info_t tmp_io_info; /* Temporary I/O info object */
hsize_t _off[H5D_IO_VECTOR_SIZE]; /* Array to store sequence offsets */
hsize_t *off = NULL; /* Pointer to sequence offsets */
hsize_t mem_off; /* Offset in memory */
size_t mem_curr_seq; /* "Current sequence" in memory */
size_t dset_curr_seq; /* "Current sequence" in dataset */
size_t _len[H5D_IO_VECTOR_SIZE]; /* Array to store sequence lengths */
size_t *len = NULL; /* Array to store sequence lengths */
size_t orig_mem_len, mem_len; /* Length of sequence in memory */
size_t nseq; /* Number of sequences generated */
size_t nelem; /* Number of elements used in sequences */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check args */
HDassert(_io_info);
HDassert(space);
HDassert(iter);
HDassert(nelmts > 0);
HDassert(_buf);
/* Set up temporary I/O info object */
HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info));
tmp_io_info.op_type = H5D_IO_OP_WRITE;
tmp_io_info.u.wbuf = _buf;
/* Allocate the vector I/O arrays */
if(tmp_io_info.dxpl_cache->vec_size > H5D_IO_VECTOR_SIZE) {
if(NULL == (len = H5FL_SEQ_MALLOC(size_t, tmp_io_info.dxpl_cache->vec_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O length vector array")
if(NULL == (off = H5FL_SEQ_MALLOC(hsize_t, tmp_io_info.dxpl_cache->vec_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate I/O offset vector array")
} /* end if */
else {
示例15: H5HF_man_iter_down
/*-------------------------------------------------------------------------
* Function: H5HF_man_iter_down
*
* Purpose: Move iterator down one level
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* [email protected]
* Apr 24 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock)
{
H5HF_block_loc_t *down_loc = NULL; /* Pointer to new 'down' block location */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_down)
/*
* Check arguments.
*/
HDassert(biter);
HDassert(biter->ready);
HDassert(biter->curr);
HDassert(biter->curr->context);
/* Create new location to move down to */
if(NULL == (down_loc = H5FL_MALLOC(H5HF_block_loc_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct block free list section")
/* Initialize down location */
down_loc->row = 0;
down_loc->col = 0;
down_loc->entry = 0;
down_loc->context = iblock;
down_loc->up = biter->curr;
/* Increment reference count on indirect block */
if(H5HF_iblock_incr(down_loc->context) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block")
/* Make down location the current location */
biter->curr = down_loc;
done:
if(ret_value < 0 && down_loc)
down_loc = H5FL_FREE(H5HF_block_loc_t, down_loc);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_man_iter_down() */