• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FUNC_ENTER_NOAPI函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FUNC_ENTER_NOAPI函数的典型用法代码示例。如果您正苦于以下问题:C++ FUNC_ENTER_NOAPI函数的具体用法?C++ FUNC_ENTER_NOAPI怎么用?C++ FUNC_ENTER_NOAPI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FUNC_ENTER_NOAPI函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: H5I_search

/*-------------------------------------------------------------------------
 * Function:  H5I_search
 *
 * Purpose:  Apply function FUNC to each member of group GRP and return a
 *    pointer to the first object for which FUNC returns non-zero.
 *    The FUNC should take a pointer to the object and the KEY as
 *    arguments and return non-zero to terminate the search (zero
 *    to continue).
 *
 * Limitation:  Currently there is no way to start searching from where a
 *    previous search left off.
 *
 * Return:  Success:  The first object in the group for which FUNC
 *        returns non-zero. NULL if FUNC returned zero
 *        for every object in the group.
 *
 *    Failure:  NULL
 *
 * Programmer:  Robb Matzke
 *    Friday, February 19, 1999
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void *
H5I_search(H5I_type_t grp, H5I_search_func_t func, void *key)
{
    H5I_id_group_t  *grp_ptr = NULL;  /*ptr to the group  */
    H5I_id_info_t  *id_ptr = NULL;    /*ptr to the new ID  */
    H5I_id_info_t  *next_id = NULL;  /*ptr to the next ID  */
    unsigned    i;      /*counter    */
    void    *ret_value = NULL;  /*return value    */

    FUNC_ENTER_NOAPI(H5I_search, NULL);

    /* Check arguments */
    if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number");
    grp_ptr = H5I_id_group_list_g[grp];
    if (grp_ptr == NULL || grp_ptr->count <= 0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");

    /* Only iterate through hash table if there are IDs in group */
    if(grp_ptr->ids > 0) {
        /* Start at the beginning of the array */
        for (i=0; i<grp_ptr->hash_size; i++) {
            id_ptr = grp_ptr->id_list[i];
            while (id_ptr) {
                next_id= id_ptr->next;      /* Protect against ID being deleted in callback */
                if ((*func)(id_ptr->obj_ptr, id_ptr->id, key))
                    HGOTO_DONE(id_ptr->obj_ptr);  /*found the item*/
                id_ptr = next_id;
            } /* end while */
        } /* end for */
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5I_search() */
开发者ID:gang-liu,项目名称:paraview,代码行数:60,代码来源:H5I.c


示例2: H5I_get_ref

/*-------------------------------------------------------------------------
 * Function:  H5I_get_ref
 *
 * Purpose:  Retrieve the reference count for an object.
 *
 * Return:  Success:  The reference count.
 *
 *    Failure:  Negative
 *
 * Programmer:  Quincey Koziol
 *              Saturday, Decemeber  6, 2003
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
int
H5I_get_ref(hid_t id)
{
    H5I_type_t    grp;    /*group the object is in*/
    H5I_id_group_t  *grp_ptr;  /*ptr to the group  */
    H5I_id_info_t  *id_ptr;  /*ptr to the ID    */
    int ret_value;                      /* Return value */

    FUNC_ENTER_NOAPI(H5I_get_ref, FAIL);

    /* Sanity check */
    assert(id>=0);

    /* Check arguments */
    grp = H5I_GROUP(id);
    if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number");
    grp_ptr = H5I_id_group_list_g[grp];
    if (!grp_ptr || grp_ptr->count<=0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group");

    /* General lookup of the ID */
    if (NULL==(id_ptr=H5I_find_id(id)))
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't locate ID");

    /* Set return value */
    ret_value=id_ptr->count;

done:
    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5I_get_ref() */
开发者ID:gang-liu,项目名称:paraview,代码行数:47,代码来源:H5I.c


示例3: H5MF_realloc

/*-------------------------------------------------------------------------
 * Function:	H5MF_realloc
 *
 * Purpose:	Changes the size of an allocated chunk, possibly moving it to
 *		a new address.  The chunk to change is at address OLD_ADDR
 *		and is exactly OLD_SIZE bytes (if these are H5F_ADDR_UNDEF
 *		and zero then this function acts like H5MF_alloc).  The new
 *		size will be NEW_SIZE and its address is the return value (if
 *		NEW_SIZE is zero then this function acts like H5MF_free and
 *		an undefined address is returned).
 *
 *		If the new size is less than the old size then the new
 *		address will be the same as the old address (except for the
 *		special case where the new size is zero).
 *
 *		If the new size is more than the old size then most likely a
 *		new address will be returned.  However, under certain
 *		circumstances the library may return the same address.
 *
 * Return:	Success:	The relative file address of the new block.
 *
 * 		Failure:	HADDR_UNDEF
 *
 * Programmer:	Robb Matzke
 *              Thursday, April 16, 1998
 *
 * Modifications:
 *		Robb Matzke, 1999-07-28
 *		The ORIG_ADDR is passed by value. The name of NEW_ADDR has
 *		been changed to NEW_ADDR_P
 *
 * 		Robb Matzke, 1999-08-04
 *		Modified to work with the virtual file layer.
 *-------------------------------------------------------------------------
 */
haddr_t
H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr, hsize_t old_size,
	     hsize_t new_size)
{
    haddr_t	ret_value;

    FUNC_ENTER_NOAPI(H5MF_realloc, HADDR_UNDEF);

    /* Convert old relative address to absolute address */
    old_addr += f->shared->base_addr;

    /* Check that the file can address the new space. */
    /* In the worst case, this means adding new_size bytes to the end of the file. */
    if( H5MF_alloc_overflow(f, new_size) )
            HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "not enough address space in file");

    /* Reallocate memory from the virtual file layer */
    ret_value = H5FD_realloc(f->shared->lf, type, dxpl_id, old_addr, old_size,
			     new_size);
    if (HADDR_UNDEF==ret_value)
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "unable to allocate new file memory");

    /* Convert return value to relative address */
    assert(ret_value>=f->shared->base_addr);

    /* Set return value */
    ret_value -= f->shared->base_addr;

done:
    FUNC_LEAVE_NOAPI(ret_value);
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:66,代码来源:H5MF.c


示例4: H5HL_dblk_dest

/*-------------------------------------------------------------------------
 * Function:	H5HL_dblk_dest
 *
 * Purpose:	Destroy a local heap data block object
 *
 * Return:	Success:	Non-negative
 *		Failure:	Negative
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Oct 12 2008
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HL_dblk_dest(H5HL_dblk_t *dblk)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5HL_dblk_dest, FAIL)

    /* check arguments */
    HDassert(dblk);

    /* Check if data block was initialized */
    if(dblk->heap) {
        /* Unlink data block from heap */
        dblk->heap->dblk = NULL;

        /* Unpin the local heap prefix */
        if(H5AC_unpin_entry(dblk->heap->prfx) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "can't unpin local heap prefix")

        /* Decrement ref. count on heap data structure */
        if(H5HL_dec_rc(dblk->heap) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")

        /* Unlink heap from data block */
        dblk->heap = NULL;
    } /* end if */
开发者ID:151706061,项目名称:ITK,代码行数:40,代码来源:H5HLint.c


示例5: H5D__layout_set_version

/*-------------------------------------------------------------------------
 * Function:    H5D__layout_set_version
 *
 * Purpose:     Set the version to encode a layout with.
 *
 * Return:      Non-negative on success/Negative on failure
 *
 * Programmer:  Vailin Choi; December 2017
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
{
    unsigned version;           /* Message version */
    herr_t ret_value = SUCCEED; /* Return value */

    FUNC_ENTER_NOAPI(FAIL)

    /* Sanity check */
    HDassert(layout);
    HDassert(f);

    /* Upgrade to the version indicated by the file's low bound if higher */
    version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]);

    /* Version bounds check */
    if(version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)])
        HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds")

    /* Set the message version */
    layout->version = version;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__layout_set_version() */
开发者ID:soumagne,项目名称:hdf5,代码行数:36,代码来源:H5Dlayout.c


示例6: H5HP_incr

/*--------------------------------------------------------------------------
 NAME
    H5HP_incr
 PURPOSE
    Increment the priority of an object on a heap
 USAGE
    herr_t H5HP_incr(heap, amt, obj)
        H5HP_t *heap;           IN/OUT: Pointer to heap to modify
        unsigned amt;           IN: Amount to increase priority by
        void *obj;              IN: Pointer to object to modify

 RETURNS
    Returns non-negative on success, negative on failure.
 DESCRIPTION
    Increments the priority of an object on a heap by one.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_incr(H5HP_t *heap, unsigned amt, void *_obj)
{
    H5HP_info_t *obj=(H5HP_info_t *)_obj;       /* Alias for object */
    size_t obj_loc;             /* Location of object in heap */
    herr_t ret_value=SUCCEED;   /* Return value */

    FUNC_ENTER_NOAPI(FAIL)

    /* Check args */
    HDassert(heap);
    HDassert(obj);

    /* Check internal consistency */
    /* (Pre-condition) */
    HDassert(heap->nobjs<heap->nalloc);
    HDassert(heap->heap);
    HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
        (heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
    HDassert(heap->heap[0].obj==NULL);

    /* Get the location of the object in the heap */
    obj_loc = obj->heap_loc;
    HDassert(obj_loc > 0 && obj_loc <= heap->nobjs);

    /* Change the heap object's priority */
    heap->heap[obj_loc].val += (int)amt;

    /* Restore heap condition */
    if(H5HP_MAX_HEAP == heap->type) {
        if(H5HP_swim_max(heap, obj_loc) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTRESTORE, FAIL, "unable to restore heap condition")
    } /* end if */
    else {
        if(H5HP_sink_min(heap, obj_loc) < 0)
开发者ID:Andy-Sun,项目名称:VTK,代码行数:55,代码来源:H5HP.c


示例7: H5I_destroy_group

/*-------------------------------------------------------------------------
 * Function:  H5I_destroy_group
 *
 * Purpose:  Decrements the reference count on an entire group of IDs.
 *    If the group reference count becomes zero then the group is
 *    destroyed along with all atoms in that group regardless of
 *    their reference counts.   Destroying IDs involves calling
 *    the free-func for each ID's object and then adding the ID
 *    struct to the ID free list.
 *
 * Return:  Non-negative on success/Negative on failure
 *
 * Programmer:  Unknown
 *
 * Modifications:
 *
 *  Robb Matzke, 25 Feb 1998
 *  IDs are freed when a group is destroyed.
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5I_destroy_group(H5I_type_t grp)
{
    H5I_id_group_t  *grp_ptr = NULL;  /* ptr to the atomic group */
    int    ret_value = SUCCEED;

    FUNC_ENTER_NOAPI(H5I_destroy_group, FAIL);

    if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number");

    grp_ptr = H5I_id_group_list_g[grp];
    if (grp_ptr == NULL || grp_ptr->count <= 0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, FAIL, "invalid group");

    /*
     * Decrement the number of users of the atomic group.  If this is the
     * last user of the group then release all atoms from the group.  The
     * free function is invoked for each atom being freed.
     */
    if (1==grp_ptr->count) {
        H5I_clear_group(grp, TRUE);
        H5E_clear(); /*don't care about errors*/
        H5MM_xfree(grp_ptr->id_list);
        HDmemset (grp_ptr, 0, sizeof(*grp_ptr));
    } else {
        --(grp_ptr->count);
    }

  done:
    FUNC_LEAVE_NOAPI(ret_value);
}
开发者ID:gang-liu,项目名称:paraview,代码行数:53,代码来源:H5I.c


示例8: H5G_link_to_loc

/*-------------------------------------------------------------------------
 * Function:	H5G_link_to_loc
 *
 * Purpose:	Build group location from group and link object
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Quincey Koziol
 *              Monday, November 20 2006
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5G_link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk,
    H5G_loc_t *obj_loc)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5G_link_to_loc, FAIL)

    /* Sanity check */
    HDassert(grp_loc);
    HDassert(lnk);
    HDassert(obj_loc);

    /*
     * Build location from the link
     */

    /* Check for unknown library-internal link */
    if(lnk->type > H5L_TYPE_BUILTIN_MAX && lnk->type < H5L_TYPE_UD_MIN)
        HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type")

    /* Build object's group hier. location */
    if(H5G_name_set(grp_loc->path, obj_loc->path, lnk->name) < 0)
        HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name")

    /* Set the object location, if it's a hard link set the address also */
    obj_loc->oloc->file = grp_loc->oloc->file;
    obj_loc->oloc->holding_file = FALSE;
    if(lnk->type == H5L_TYPE_HARD)
        obj_loc->oloc->addr = lnk->u.hard.addr;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_link_to_loc() */
开发者ID:151706061,项目名称:VTK,代码行数:46,代码来源:H5Glink.c


示例9: H5HP_insert

/*--------------------------------------------------------------------------
 NAME
    H5HP_insert
 PURPOSE
    Insert an object into a heap, with an initial value
 USAGE
    herr_t H5HP_insert(heap, val, obj)
        H5HP_t *heap;           IN/OUT: Pointer to heap to modify
        int val;                IN: Initial value for object in heap
        void *obj;              IN: Pointer to object to insert into heap

 RETURNS
    Returns non-negative on success, negative on failure.
 DESCRIPTION
    Inserts a OBJ into a HEAP, with an initial VALue.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
herr_t
H5HP_insert(H5HP_t *heap, int val, void *obj)
{
    herr_t ret_value=SUCCEED;   /* Return value */

    FUNC_ENTER_NOAPI(FAIL)

    /* Check args */
    HDassert(heap);
    HDassert(obj);

    /* Check internal consistency */
    /* (Pre-condition) */
    HDassert(heap->nobjs<heap->nalloc);
    HDassert(heap->heap);
    HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
        (heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
    HDassert(heap->heap[0].obj==NULL);

    /* Increment number of objects in heap */
    heap->nobjs++;

    /* Check if we need to allocate more room for heap array */
    if(heap->nobjs>=heap->nalloc) {
        size_t n = MAX(H5HP_START_SIZE, 2*(heap->nalloc-1)) + 1;
        H5HP_ent_t *new_heap = H5FL_SEQ_REALLOC(H5HP_ent_t,heap->heap, n);

        if (!new_heap)
            HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend heap array");
        heap->heap = new_heap;
        heap->nalloc = n;
    } /* end if */

    /* Insert new object at end of heap */
    heap->heap[heap->nobjs].val = val;
    heap->heap[heap->nobjs].obj = (H5HP_info_t *)obj;
    heap->heap[heap->nobjs].obj->heap_loc = heap->nobjs;

    /* Restore heap condition */
    if(heap->type==H5HP_MAX_HEAP) {
        if(H5HP_swim_max(heap,heap->nobjs)<0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
    } /* end if */
    else {
        if(H5HP_swim_min(heap,heap->nobjs)<0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to restore heap condition");
    } /* end else */

done:

    /* Check internal consistency */
    /* (Post-condition) */
    HDassert(heap->nobjs<heap->nalloc);
    HDassert(heap->heap);
    HDassert((heap->type==H5HP_MAX_HEAP && heap->heap[0].val==INT_MAX) ||
        (heap->type==H5HP_MIN_HEAP && heap->heap[0].val==INT_MIN));
    HDassert(heap->heap[0].obj==NULL);

    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_insert() */
开发者ID:Andy-Sun,项目名称:VTK,代码行数:80,代码来源:H5HP.c


示例10: H5HL_new

/*-------------------------------------------------------------------------
 * Function:	H5HL_new
 *
 * Purpose:	Create a new local heap object
 *
 * Return:	Success:	non-NULL pointer to new local heap
 *		Failure:	NULL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Jan  5 2010
 *
 *-------------------------------------------------------------------------
 */
H5HL_t *
H5HL_new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size)
{
    H5HL_t *heap = NULL;        /* New local heap */
    H5HL_t *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI(H5HL_new, NULL)

    /* check arguments */
    HDassert(sizeof_size > 0);
    HDassert(sizeof_addr > 0);
    HDassert(prfx_size > 0);

    /* Allocate new local heap structure */
    if(NULL == (heap = H5FL_CALLOC(H5HL_t)))
	HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")

    /* Initialize non-zero fields */
    heap->sizeof_size = sizeof_size;
    heap->sizeof_addr = sizeof_addr;
    heap->prfx_size = prfx_size;

    /* Set the return value */
    ret_value = heap;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_new() */
开发者ID:151706061,项目名称:ITK,代码行数:42,代码来源:H5HLint.c


示例11: H5C_log_set_up

/*-------------------------------------------------------------------------
 * Function:    H5C_log_set_up
 *
 * Purpose:     Setup for metadata cache logging.
 *
 * Return:      SUCCEED/FAIL
 *
 * Programmer:  Dana Robinson
 *              Fall 2018
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately)
{
    int mpi_rank = -1;              /* -1 indicates serial (no MPI rank) */
    herr_t ret_value = SUCCEED;     /* Return value */

    FUNC_ENTER_NOAPI(FAIL)

    /* Sanity checks */
    HDassert(cache);
    HDassert(log_location);

    /* Check logging flags */
    if(cache->log_info->enabled)
        HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up")

    /* Get the rank when MPI is in use. Logging clients will usually
     * use that to create per-process logs.
     */
#ifdef H5_HAVE_PARALLEL
    if(NULL != cache->aux_ptr)
        mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank;
#endif /*H5_HAVE_PARALLEL*/

    /* Set up logging */
    if(H5C_LOG_STYLE_JSON == style) {
        if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
            HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging")
    }
    else if(H5C_LOG_STYLE_TRACE == style) {
开发者ID:GATB,项目名称:gatb-core,代码行数:42,代码来源:H5Clog.c


示例12: H5B2_size

/*-------------------------------------------------------------------------
 * Function:    H5B2_size
 *
 * Purpose:     Iterate over all the records in the B-tree, collecting
 *              storage info.
 *
 * Return:      non-negative on success, negative on error
 *
 * Programmer:  Vailin Choi
 *              June 19 2007
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
{
    H5B2_hdr_t	*hdr;                   /* Pointer to the B-tree header */
    herr_t      ret_value = SUCCEED;    /* Return value */

    FUNC_ENTER_NOAPI(FAIL)

    /* Check arguments. */
    HDassert(bt2);
    HDassert(btree_size);

    /* Set the shared v2 B-tree header's file context for this operation */
    bt2->hdr->f = bt2->f;

    /* Get the v2 B-tree header */
    hdr = bt2->hdr;

    /* Add size of header to B-tree metadata total */
    *btree_size += hdr->hdr_size;

    /* Iterate through records */
    if(hdr->root.node_nrec > 0) {
        /* Check for root node being a leaf */
        if(hdr->depth == 0)
            *btree_size += hdr->node_size;
        else
            /* Iterate through nodes */
            if(H5B2_node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0)
                HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_size() */
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:48,代码来源:H5B2stat.c


示例13: H5MF_aggr_vfd_alloc

/*-------------------------------------------------------------------------
 * Function:    H5MF_aggr_vfd_alloc
 *
 * Purpose:     Allocate SIZE bytes of file memory via H5MF_aggr_alloc()
 *		and return the relative address where that contiguous chunk
 *		of file memory exists.
 *		The TYPE argument describes the purpose for which the storage
 *		is being requested.
 *
 * Return:      Success:        The file address of new chunk.
 *              Failure:        HADDR_UNDEF
 *
 * Programmer:  Vailin Choi; July 1st, 2009
 *		(The coding is from H5MF_alloc().)
 *
 *-------------------------------------------------------------------------
 */
haddr_t
H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, hsize_t size)
{
    haddr_t	ret_value;              /* Return value */

    FUNC_ENTER_NOAPI(HADDR_UNDEF)
#ifdef H5MF_ALLOC_DEBUG
HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size);
#endif /* H5MF_ALLOC_DEBUG */

    /* check arguments */
    HDassert(f);
    HDassert(f->shared);
    HDassert(f->shared->lf);
    HDassert(size > 0);

    /* Couldn't find anything from the free space manager, go allocate some */
    if(alloc_type != H5FD_MEM_DRAW && alloc_type != H5FD_MEM_GHEAP) {
        /* Handle metadata differently from "raw" data */
        if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size)))
            HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata")
    } /* end if */
    else {
        /* Allocate "raw" data: H5FD_MEM_DRAW and H5FD_MEM_GHEAP */
        if(HADDR_UNDEF == (ret_value = H5MF_aggr_alloc(f, dxpl_id, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size)))
开发者ID:asteever,项目名称:thirdparty_hdf5,代码行数:42,代码来源:H5MFaggr.c


示例14: H5HL_prfx_dest

/*-------------------------------------------------------------------------
 * Function:	H5HL_prfx_dest
 *
 * Purpose:	Destroy a local heap prefix object
 *
 * Return:	Success:	Non-negative
 *		Failure:	Negative
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Oct 12 2008
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5HL_prfx_dest(H5HL_prfx_t *prfx)
{
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5HL_prfx_dest, FAIL)

    /* check arguments */
    HDassert(prfx);

    /* Check if prefix was initialized */
    if(prfx->heap) {
        /* Unlink prefix from heap */
        prfx->heap->prfx = NULL;

        /* Decrement ref. count on heap data structure */
        if(H5HL_dec_rc(prfx->heap) < 0)
            HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count")

        /* Unlink heap from prefix */
        prfx->heap = NULL;
    } /* end if */

    /* Free local heap prefix */
    prfx = H5FL_FREE(H5HL_prfx_t, prfx);

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_prfx_dest() */
开发者ID:151706061,项目名称:ITK,代码行数:43,代码来源:H5HLint.c


示例15: H5HL_dblk_new

/*-------------------------------------------------------------------------
 * Function:	H5HL_dblk_new
 *
 * Purpose:	Create a new local heap data block object
 *
 * Return:	Success:	non-NULL pointer to new local heap data block
 *		Failure:	NULL
 *
 * Programmer:	Quincey Koziol
 *		[email protected]
 *		Oct 12 2008
 *
 *-------------------------------------------------------------------------
 */
H5HL_dblk_t *
H5HL_dblk_new(H5HL_t *heap)
{
    H5HL_dblk_t *dblk = NULL;       /* New local heap data block */
    H5HL_dblk_t *ret_value;         /* Return value */

    FUNC_ENTER_NOAPI(H5HL_dblk_new, NULL)

    /* check arguments */
    HDassert(heap);

    /* Allocate new local heap data block */
    if(NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t)))
	HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed")

    /* Increment ref. count on heap data structure */
    if(H5HL_inc_rc(heap) < 0)
	HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count")

    /* Link the heap & the data block */
    dblk->heap = heap;
    heap->dblk = dblk;

    /* Set the return value */
    ret_value = dblk;

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HL_dblk_new() */
开发者ID:151706061,项目名称:ITK,代码行数:43,代码来源:H5HLint.c


示例16: H5MF_alloc

/*-------------------------------------------------------------------------
 * Function:    H5MF_alloc
 *
 * Purpose:     Allocate SIZE bytes of file memory and return the relative
 *		address where that contiguous chunk of file memory exists.
 *		The TYPE argument describes the purpose for which the storage
 *		is being requested.
 *
 * Return:      Success:        The file address of new chunk.
 *
 *              Failure:        HADDR_UNDEF
 *
 * Programmer:  Robb Matzke
 *              [email protected]
 *              Jul 11 1997
 *
 * Modifications:
 *		Robb Matzke, 1999-08-04
 *		Modified to work with the virtual file layer.
 *-------------------------------------------------------------------------
 */
haddr_t
H5MF_alloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, hsize_t size)
{
    haddr_t	ret_value;

    FUNC_ENTER_NOAPI(H5MF_alloc, HADDR_UNDEF);

    /* check arguments */
    assert(f);
    assert(size > 0);

    /* Fail if we don't have write access */
    if (0==(f->intent & H5F_ACC_RDWR))
	HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "file is read-only");

    /* Check that the file can address the new space */
    if( H5MF_alloc_overflow(f, size) )
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "not enough address space in file");

    /* Allocate space from the virtual file layer */
    if (HADDR_UNDEF==(ret_value=H5FD_alloc(f->shared->lf, type, dxpl_id, size)))
        HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed");

    /* Convert absolute file address to relative file address */
    assert(ret_value>=f->shared->base_addr);

    /* Set return value */
    ret_value -= f->shared->base_addr;

done:
    FUNC_LEAVE_NOAPI(ret_value);
}
开发者ID:MattNapsAlot,项目名称:rHDF5,代码行数:53,代码来源:H5MF.c


示例17: H5HG_load

/*-------------------------------------------------------------------------
 * Function:	H5HG_load
 *
 * Purpose:	Loads a global heap collection from disk.
 *
 * Return:	Success:	Ptr to a global heap collection.
 *
 *		Failure:	NULL
 *
 * Programmer:	Robb Matzke
 *              Friday, March 27, 1998
 *
 *-------------------------------------------------------------------------
 */
static H5HG_heap_t *
H5HG_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
	   void UNUSED * udata2)
{
    H5HG_heap_t	*heap = NULL;
    uint8_t	*p = NULL;
    size_t	nalloc, need;
    size_t      max_idx = 0;            /* The maximum index seen */
    H5HG_heap_t	*ret_value = NULL;      /* Return value */

    FUNC_ENTER_NOAPI(H5HG_load, NULL)

    /* check arguments */
    HDassert(f);
    HDassert(H5F_addr_defined(addr));
    HDassert(!udata1);
    HDassert(!udata2);

    /* Read the initial 4k page */
    if(NULL == (heap = H5FL_CALLOC(H5HG_heap_t)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
    heap->addr = addr;
    if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, (size_t)H5HG_MINSIZE)))
	HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
    if(H5F_block_read(f, H5FD_MEM_GHEAP, addr, (size_t)H5HG_MINSIZE, dxpl_id, heap->chunk) < 0)
	HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection")

    /* Magic number */
    if(HDmemcmp(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC))
	HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad global heap collection signature")
    p = heap->chunk + H5_SIZEOF_MAGIC;

    /* Version */
    if(H5HG_VERSION != *p++)
	HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong version number in global heap")

    /* Reserved */
    p += 3;

    /* Size */
    H5F_DECODE_LENGTH(f, p, heap->size);
    HDassert(heap->size >= H5HG_MINSIZE);

    /*
     * If we didn't read enough in the first try, then read the rest of the
     * collection now.
     */
    if(heap->size > H5HG_MINSIZE) {
	haddr_t next_addr = addr + (hsize_t)H5HG_MINSIZE;

	if(NULL == (heap->chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, heap->size)))
	    HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
	if(H5F_block_read(f, H5FD_MEM_GHEAP, next_addr, (heap->size - H5HG_MINSIZE), dxpl_id, heap->chunk + H5HG_MINSIZE) < 0)
	    HGOTO_ERROR(H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection")
    } /* end if */
开发者ID:jackygrahamez,项目名称:DrugDiscovery-Home,代码行数:69,代码来源:H5HGcache.c


示例18: H5HP_create

/*--------------------------------------------------------------------------
 NAME
    H5HP_create
 PURPOSE
    Create a heap
 USAGE
    H5HP_t *H5HP_create(heap_type)
        H5HP_type_t heap_type;          IN: Type of heap to create

 RETURNS
    Returns a pointer to a heap on success, NULL on failure.
 DESCRIPTION
    Create a priority queue.  The SIZE is used to set the initial number of
    entries allocated.
 GLOBAL VARIABLES
 COMMENTS, BUGS, ASSUMPTIONS
 EXAMPLES
 REVISION LOG
--------------------------------------------------------------------------*/
H5HP_t *
H5HP_create(H5HP_type_t heap_type)
{
    H5HP_t *new_heap=NULL;      /* Pointer to new heap object created */
    H5HP_t *ret_value;          /* Return value */

    FUNC_ENTER_NOAPI(NULL)

    /* Check args */
    HDassert(heap_type==H5HP_MIN_HEAP || heap_type==H5HP_MAX_HEAP);

    /* Allocate ref-counted string structure */
    if((new_heap=H5FL_MALLOC(H5HP_t))==NULL)
        HGOTO_ERROR(H5E_HEAP,H5E_NOSPACE,NULL,"memory allocation failed");

    /* Allocate the array to store the heap entries */
    if((new_heap->heap = H5FL_SEQ_MALLOC(H5HP_ent_t, (size_t)(H5HP_START_SIZE + 1)))==NULL)
        HGOTO_ERROR(H5E_HEAP,H5E_NOSPACE,NULL,"memory allocation failed");

    /* Set the internal fields */
    new_heap->type=heap_type;
    new_heap->nobjs=0;
    new_heap->nalloc=H5HP_START_SIZE+1;

    /* Set the information in the 0'th location based on the type of heap */
    if(heap_type==H5HP_MIN_HEAP) {
        /* Set the value in the '0' location to be the minimum value, to
         * simplify the algorithms
         */
        new_heap->heap[0].val=INT_MIN;
        new_heap->heap[0].obj=NULL;
    } /* end if */
    else {
        /* Set the value in the '0' location to be the maximum value, to
         * simplify the algorithms
         */
        new_heap->heap[0].val=INT_MAX;
        new_heap->heap[0].obj=NULL;
    } /* end else */

    /* Set the return value */
    ret_value=new_heap;

done:
    /* Error cleanup */
    if(NULL ==ret_value) {
        if(NULL != new_heap) {
            if(NULL != new_heap->heap)
                new_heap->heap = H5FL_SEQ_FREE(H5HP_ent_t, new_heap->heap);
            new_heap = H5FL_FREE(H5HP_t, new_heap);
        } /* end if */
    } /* end if */

    FUNC_LEAVE_NOAPI(ret_value);
} /* end H5HP_create() */
开发者ID:Andy-Sun,项目名称:VTK,代码行数:74,代码来源:H5HP.c


示例19: H5I_init_group

/*-------------------------------------------------------------------------
 * Function:  H5I_init_group
 *
 * Purpose:  Initialize an ID group whose ID number is specified by GRP,
 *    If the group has already been initialized, this routine just
 *    increments the count of number of initializations and returns
 *    without trying to change the size of the hash table.  A
 *    specific number (RESERVED) of group entries may be reserved
 *    to enable "constant" values to be handed out which are valid
 *    IDs in the group, but which do not map to any data structures
 *    and are not allocated dynamicly later. HASH_SIZE is the
 *    minimum hash table size to use for the group. FREE_FUNC is
 *    called with an object pointer when the object is removed from
 *    the group.
 *
 * Return:  Success:  Non-negative
 *
 *    Failure:  Negative
 *
 * Programmer:  Robb Matzke
 *    Friday, February 19, 1999
 *
 * Modifications:
 *     Bill Wendling, 2000-05-05
 *     Instead of the ugly test of whether hash_size is a power of
 *     two, I placed it in a macro POWER_OF_TWO which uses the fact
 *     that a number that is a power of two has only 1 bit set.
 *
 *     Bill Wendling, 2000-05-09
 *     Changed POWER_OF_TWO macro to allow 1 as a valid power of two.
 *     Changed test below accordingly.
 *
 *-------------------------------------------------------------------------
 */
int
H5I_init_group(H5I_type_t grp, size_t hash_size, unsigned reserved,
         H5I_free_t free_func)
{
    H5I_id_group_t  *grp_ptr = NULL;  /*ptr to the atomic group*/
    int    ret_value = SUCCEED;  /*return value    */

    FUNC_ENTER_NOAPI(H5I_init_group, FAIL);

    /* Check arguments */
    if ((grp <= H5I_BADID || grp >= H5I_NGROUPS) && hash_size > 0)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid group number");
#ifdef HASH_SIZE_POWER_2
    if (!POWER_OF_TWO(hash_size) || hash_size == 1)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid hash size");
#endif /* HASH_SIZE_POWER_2 */

    if (H5I_id_group_list_g[grp] == NULL) {
  /* Allocate the group information for new group */
  if (NULL==(grp_ptr = H5MM_calloc(sizeof(H5I_id_group_t))))
      HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
  H5I_id_group_list_g[grp] = grp_ptr;
    } else {
  /* Get the pointer to the existing group */
  grp_ptr = H5I_id_group_list_g[grp];
    }

    if (grp_ptr->count == 0) {
  /* Initialize the ID group structure for new groups */
  grp_ptr->hash_size = hash_size;
  grp_ptr->reserved = reserved;
  grp_ptr->wrapped = 0;
  grp_ptr->ids = 0;
  grp_ptr->nextid = reserved;
  grp_ptr->free_func = free_func;
  grp_ptr->id_list = H5MM_calloc(hash_size*sizeof(H5I_id_info_t *));
  if (NULL==grp_ptr->id_list)
      HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed");
    }

    /* Increment the count of the times this group has been initialized */
    grp_ptr->count++;

done:
    if (ret_value<0) {
  /* Error condition cleanup */
  if (grp_ptr != NULL) {
      H5MM_xfree(grp_ptr->id_list);
      H5MM_xfree(grp_ptr);
  }
    }

    FUNC_LEAVE_NOAPI(ret_value);
}
开发者ID:gang-liu,项目名称:paraview,代码行数:88,代码来源:H5I.c


示例20: H5I_remove

/*-------------------------------------------------------------------------
 * Function:  H5I_remove
 *
 * Purpose:  Removes the specified ID from its group.
 *
 * Return:  Success:  A pointer to the object that was removed, the
 *        same pointer which would have been found by
 *        calling H5I_object().
 *
 *    Failure:  NULL
 *
 * Programmer:
 *
 * Modifications:
 *
 *-------------------------------------------------------------------------
 */
void *
H5I_remove(hid_t id)
{
    H5I_id_group_t  *grp_ptr = NULL;/*ptr to the atomic group  */
    H5I_id_info_t  *curr_id;  /*ptr to the current atom  */
    H5I_id_info_t  *last_id;  /*ptr to the last atom    */
    H5I_type_t    grp;    /*atom's atomic group    */
    unsigned    hash_loc;  /*atom's hash table location  */
    void *        ret_value = NULL;  /*return value      */

    FUNC_ENTER_NOAPI(H5I_remove, NULL);

    /* Check arguments */
    grp = H5I_GROUP(id);
    if (grp <= H5I_BADID || grp >= H5I_NGROUPS)
  HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid group number");
    grp_ptr = H5I_id_group_list_g[grp];
    if (grp_ptr == NULL || grp_ptr->count <= 0)
  HGOTO_ERROR(H5E_ATOM, H5E_BADGROUP, NULL, "invalid group");

    /* Get the bucket in which the ID is located */
    hash_loc = (unsigned) H5I_LOC(id, grp_ptr->hash_size);
    curr_id = grp_ptr->id_list[hash_loc];
    if (curr_id == NULL)
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID");

    last_id = NULL;
    while (curr_id != NULL) {
        if (curr_id->id == id)
            break;
        last_id = curr_id;
        curr_id = curr_id->next;
    }

    if (curr_id != NULL) {
        if (last_id == NULL) {
            /* ID is the first in the chain */
            grp_ptr->id_list[hash_loc] = curr_id->next;
        } else {
            last_id->next = curr_id->next;
        }
        ret_value = curr_id->obj_ptr;
        H5FL_FREE(H5I_id_info_t,curr_id);
    } else {
        /* couldn't find the ID in the proper place */
  HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, NULL, "invalid ID");
    }

    /* Decrement the number of IDs in the group */
    (grp_ptr-> 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FUNC_EXIT_RC函数代码示例发布时间:2022-05-30
下一篇:
C++ FUNC_ENTER_API函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap