1998-10-08 05:04:51 +08:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
* NCSA HDF *
|
|
|
|
|
* Software Development Group *
|
|
|
|
|
* National Center for Supercomputing Applications *
|
|
|
|
|
* University of Illinois at Urbana-Champaign *
|
|
|
|
|
* 605 E. Springfield, Champaign IL 61820 *
|
|
|
|
|
* *
|
|
|
|
|
* For conditions of distribution and use, see the accompanying *
|
|
|
|
|
* hdf/COPYING file. *
|
|
|
|
|
* *
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef RCSID
|
|
|
|
|
static char RcsId[] = "@(#)$Revision$";
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
1998-10-14 05:28:53 +08:00
|
|
|
|
#include <H5private.h> /* Generic Functions */
|
|
|
|
|
#include <H5Iprivate.h> /* ID Functions */
|
|
|
|
|
#include <H5Dprivate.h> /* Datasets */
|
|
|
|
|
#include <H5Eprivate.h> /* Error handling */
|
1998-10-23 06:49:16 +08:00
|
|
|
|
#include <H5Fprivate.h> /* Files */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
#include <H5Gprivate.h> /* Groups */
|
|
|
|
|
#include <H5Rprivate.h> /* References */
|
|
|
|
|
#include <H5Sprivate.h> /* Dataspaces */
|
1998-10-08 05:04:51 +08:00
|
|
|
|
|
|
|
|
|
/* Interface initialization */
|
|
|
|
|
#define PABLO_MASK H5R_mask
|
|
|
|
|
#define INTERFACE_INIT H5R_init_interface
|
|
|
|
|
static intn interface_initialize_g = FALSE;
|
|
|
|
|
static herr_t H5R_init_interface(void);
|
|
|
|
|
static void H5R_term_interface(void);
|
|
|
|
|
|
1998-10-14 05:28:53 +08:00
|
|
|
|
/* Static functions */
|
1998-10-23 06:49:16 +08:00
|
|
|
|
static herr_t H5R_create(void *ref, H5G_entry_t *loc, const char *name,
|
1998-10-14 05:28:53 +08:00
|
|
|
|
H5R_type_t ref_type, H5S_t *space);
|
1998-10-23 06:49:16 +08:00
|
|
|
|
static hid_t H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref);
|
1998-10-27 01:14:00 +08:00
|
|
|
|
static H5S_t * H5R_get_region(void *ref);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
1998-10-08 05:04:51 +08:00
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5R_init_interface -- Initialize interface-specific information
|
|
|
|
|
USAGE
|
|
|
|
|
herr_t H5R_init_interface()
|
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Non-negative on success/Negative on failure
|
1998-10-08 05:04:51 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Initializes any interface-specific data or routines.
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
static herr_t
|
|
|
|
|
H5R_init_interface(void)
|
|
|
|
|
{
|
|
|
|
|
herr_t ret_value = SUCCEED;
|
|
|
|
|
FUNC_ENTER(H5R_init_interface, FAIL);
|
|
|
|
|
|
|
|
|
|
/* Initialize the atom group for the file IDs */
|
|
|
|
|
if ((ret_value = H5I_init_group(H5I_REFERENCE, H5I_REFID_HASHSIZE,
|
1998-10-27 05:18:54 +08:00
|
|
|
|
H5R_RESERVED_ATOMS, (herr_t (*)(void *)) NULL)) >= 0) {
|
1998-10-08 05:04:51 +08:00
|
|
|
|
ret_value = H5_add_exit(&H5R_term_interface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
|
|
|
} /* end H5R_init_interface() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5R_term_interface
|
|
|
|
|
PURPOSE
|
|
|
|
|
Terminate various H5R objects
|
|
|
|
|
USAGE
|
|
|
|
|
void H5R_term_interface()
|
|
|
|
|
RETURNS
|
1998-10-14 05:28:53 +08:00
|
|
|
|
void
|
1998-10-08 05:04:51 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Release the atom group and any other resources allocated.
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
Can't report errors...
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
static void
|
|
|
|
|
H5R_term_interface(void)
|
|
|
|
|
{
|
|
|
|
|
/* Free ID group */
|
|
|
|
|
H5I_destroy_group(H5I_REFERENCE);
|
|
|
|
|
} /* end H5R_term_interface() */
|
|
|
|
|
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5R_create
|
|
|
|
|
PURPOSE
|
|
|
|
|
Creates a particular kind of reference for the user
|
|
|
|
|
USAGE
|
|
|
|
|
herr_t H5R_create(ref, loc, name, ref_type, space)
|
1998-10-23 06:49:16 +08:00
|
|
|
|
void *ref; OUT: Reference created
|
1998-10-14 05:28:53 +08:00
|
|
|
|
H5G_entry_t *loc; IN: File location used to locate object pointed to
|
|
|
|
|
const char *name; IN: Name of object at location LOC_ID of object
|
|
|
|
|
pointed to
|
|
|
|
|
H5R_type_t ref_type; IN: Type of reference to create
|
|
|
|
|
H5S_t *space; IN: Dataspace ID with selection, used for Dataset
|
|
|
|
|
Region references.
|
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Non-negative on success/Negative on failure
|
1998-10-14 05:28:53 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Creates a particular type of reference specified with REF_TYPE, in the
|
|
|
|
|
space pointed to by REF. The LOC_ID and NAME are used to locate the object
|
|
|
|
|
pointed to and the SPACE_ID is used to choose the region pointed to (for
|
|
|
|
|
Dataset Region references).
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
static herr_t
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5R_create(void *_ref, H5G_entry_t *loc, const char *name, H5R_type_t ref_type, H5S_t __unused__ *space)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
|
|
|
|
H5G_stat_t sb; /* Stat buffer for retrieving OID */
|
|
|
|
|
herr_t ret_value = FAIL;
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER(H5R_create, FAIL);
|
|
|
|
|
|
1998-10-23 06:49:16 +08:00
|
|
|
|
assert(_ref);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
assert(loc);
|
|
|
|
|
assert(name);
|
|
|
|
|
assert(ref_type>H5R_BADTYPE || ref_type<H5R_MAXTYPE);
|
|
|
|
|
|
|
|
|
|
if (H5G_get_objinfo (loc, name, 0, &sb)<0)
|
|
|
|
|
HGOTO_ERROR (H5E_REFERENCE, H5E_NOTFOUND, FAIL, "unable to stat object");
|
|
|
|
|
|
1998-10-23 06:49:16 +08:00
|
|
|
|
switch(ref_type) {
|
|
|
|
|
case H5R_OBJECT:
|
|
|
|
|
{
|
1998-10-29 02:51:20 +08:00
|
|
|
|
haddr_t addr;
|
1998-10-23 06:49:16 +08:00
|
|
|
|
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Get pointer to correct type of reference struct */
|
|
|
|
|
uint8 *p; /* Pointer to OID to store */
|
|
|
|
|
|
|
|
|
|
/* Set information for reference */
|
|
|
|
|
p=(uint8 *)ref->oid;
|
1998-10-29 02:51:20 +08:00
|
|
|
|
H5F_addr_pack(loc->file,&addr,&sb.objno[0]);
|
|
|
|
|
H5F_addr_encode(loc->file,&p,&addr);
|
1998-10-23 06:49:16 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case H5R_DATASET_REGION:
|
|
|
|
|
case H5R_INTERNAL:
|
|
|
|
|
HRETURN_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL,
|
|
|
|
|
"Dataset region and internal references are not supported yet");
|
|
|
|
|
|
|
|
|
|
case H5R_BADTYPE:
|
|
|
|
|
case H5R_MAXTYPE:
|
|
|
|
|
assert("unknown reference type" && 0);
|
|
|
|
|
HRETURN_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL,
|
|
|
|
|
"internal error (unknown reference type)");
|
|
|
|
|
} /* end switch */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/* Return success */
|
|
|
|
|
ret_value=SUCCEED;
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
|
|
|
} /* end H5R_create() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5Rcreate
|
|
|
|
|
PURPOSE
|
|
|
|
|
Creates a particular kind of reference for the user
|
|
|
|
|
USAGE
|
|
|
|
|
herr_t H5Rcreate(ref, loc_id, name, ref_type, space_id)
|
1998-10-23 06:49:16 +08:00
|
|
|
|
void *ref; OUT: Reference created
|
1998-10-14 05:28:53 +08:00
|
|
|
|
hid_t loc_id; IN: Location ID used to locate object pointed to
|
|
|
|
|
const char *name; IN: Name of object at location LOC_ID of object
|
|
|
|
|
pointed to
|
|
|
|
|
H5R_type_t ref_type; IN: Type of reference to create
|
|
|
|
|
hid_t space_id; IN: Dataspace ID with selection, used for Dataset
|
|
|
|
|
Region references.
|
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Non-negative on success/Negative on failure
|
1998-10-14 05:28:53 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Creates a particular type of reference specified with REF_TYPE, in the
|
|
|
|
|
space pointed to by REF. The LOC_ID and NAME are used to locate the object
|
|
|
|
|
pointed to and the SPACE_ID is used to choose the region pointed to (for
|
|
|
|
|
Dataset Region references).
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
herr_t
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
|
|
|
|
H5G_entry_t *loc = NULL; /* File location */
|
|
|
|
|
H5S_t *space = NULL; /* Pointer to dataspace containing region */
|
|
|
|
|
herr_t ret_value = FAIL;
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER(H5Rcreate, FAIL);
|
1998-10-26 22:49:52 +08:00
|
|
|
|
H5TRACE5("e","xisRti",ref,loc_id,name,ref_type,space_id);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/* Check args */
|
|
|
|
|
if(ref==NULL)
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
|
|
|
|
|
if (NULL==(loc=H5G_loc (loc_id)))
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
|
|
|
|
|
if (!name || !*name)
|
|
|
|
|
HRETURN_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given");
|
|
|
|
|
if(ref_type<=H5R_BADTYPE || ref_type>=H5R_MAXTYPE)
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
|
|
|
|
|
if(ref_type!=H5R_OBJECT)
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_UNSUPPORTED, FAIL, "reference type not supported");
|
|
|
|
|
if (space_id!=(-1) && (H5I_DATASPACE!=H5I_get_type (space_id) || NULL==(space=H5I_object (space_id))))
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace");
|
|
|
|
|
|
|
|
|
|
/* Create reference */
|
|
|
|
|
if ((ret_value=H5R_create(ref,loc,name,ref_type,space))<0)
|
|
|
|
|
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to create reference");
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
|
|
|
} /* end H5Rcreate() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5R_dereference
|
|
|
|
|
PURPOSE
|
|
|
|
|
Opens the HDF5 object referenced.
|
|
|
|
|
USAGE
|
|
|
|
|
hid_t H5R_dereference(ref)
|
1998-10-20 06:25:03 +08:00
|
|
|
|
H5D_t *dset; IN: Dataset reference object is in.
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5R_type_t ref_type; IN: Type of reference
|
|
|
|
|
void *ref; IN: Reference to open.
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Valid ID on success, Negative on failure
|
1998-10-14 05:28:53 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Given a reference to some object, open that object and return an ID for
|
|
|
|
|
that object.
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
Currently only set up to work with references to datasets
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
static hid_t
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5R_dereference(H5D_t *dset, H5R_type_t ref_type, void *_ref)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
|
|
|
|
H5D_t *dataset; /* Pointer to dataset to open */
|
1998-10-23 06:49:16 +08:00
|
|
|
|
hobj_ref_t *ref=(hobj_ref_t *)_ref; /* Only object references currently supported */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
H5G_entry_t ent; /* Symbol table entry */
|
1998-10-23 06:49:16 +08:00
|
|
|
|
uint8 *p; /* Pointer to OID to store */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
hid_t ret_value = FAIL;
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER(H5R_dereference, FAIL);
|
|
|
|
|
|
|
|
|
|
assert(ref);
|
1998-10-23 06:49:16 +08:00
|
|
|
|
assert(ref_type==H5R_OBJECT);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Switch on object type, when we implement that feature, always try to
|
|
|
|
|
* open a dataset for now
|
|
|
|
|
*/
|
|
|
|
|
/* Initialize the symbol table entry */
|
|
|
|
|
HDmemset(&ent,0,sizeof(H5G_entry_t));
|
|
|
|
|
ent.type=H5G_NOTHING_CACHED;
|
1998-10-23 06:49:16 +08:00
|
|
|
|
ent.file=H5D_get_file(dset);
|
|
|
|
|
p=(uint8 *)ref->oid;
|
|
|
|
|
H5F_addr_decode(ent.file,(const uint8 **)&p,&(ent.header));
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/* Open the dataset object */
|
1998-10-27 01:23:29 +08:00
|
|
|
|
if ((dataset=H5D_open_oid(&ent)) == NULL) {
|
1998-10-15 03:35:08 +08:00
|
|
|
|
HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found");
|
1998-10-14 05:28:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Create an atom for the dataset */
|
|
|
|
|
if ((ret_value = H5I_register(H5I_DATASET, dataset)) < 0) {
|
|
|
|
|
H5D_close(dataset);
|
|
|
|
|
HRETURN_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL,
|
|
|
|
|
"can't register dataset");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
|
|
|
} /* end H5R_dereference() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
|
|
|
|
H5Rdereference
|
|
|
|
|
PURPOSE
|
|
|
|
|
Opens the HDF5 object referenced.
|
|
|
|
|
USAGE
|
|
|
|
|
hid_t H5Rdereference(ref)
|
1998-10-20 06:25:03 +08:00
|
|
|
|
hid_t dataset; IN: Dataset reference object is in.
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5R_type_t ref_type; IN: Type of reference to create
|
|
|
|
|
void *ref; IN: Reference to open.
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Valid ID on success, Negative on failure
|
1998-10-14 05:28:53 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Given a reference to some object, open that object and return an ID for
|
|
|
|
|
that object.
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
hid_t
|
1998-10-23 06:49:16 +08:00
|
|
|
|
H5Rdereference(hid_t dataset, H5R_type_t ref_type, void *_ref)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
1998-10-20 06:25:03 +08:00
|
|
|
|
H5D_t *dset = NULL; /* dataset object */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
hid_t ret_value = FAIL;
|
|
|
|
|
|
|
|
|
|
FUNC_ENTER(H5Rdereference, FAIL);
|
1998-10-26 22:49:52 +08:00
|
|
|
|
H5TRACE3("i","iRtx",dataset,ref_type,_ref);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/* Check args */
|
1998-10-20 06:25:03 +08:00
|
|
|
|
if (H5I_DATASET != H5I_get_type(dataset) || NULL == (dset = H5I_object(dataset)))
|
|
|
|
|
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
|
1998-10-23 06:49:16 +08:00
|
|
|
|
if(ref_type<=H5R_BADTYPE || ref_type>=H5R_MAXTYPE)
|
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type");
|
|
|
|
|
if(_ref==NULL)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
|
|
|
|
|
|
|
|
|
|
/* Create reference */
|
1998-10-23 06:49:16 +08:00
|
|
|
|
if ((ret_value=H5R_dereference(dset, ref_type, _ref))<0)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object");
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
|
|
|
|
} /* end H5Rdereference() */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
1998-10-27 01:14:00 +08:00
|
|
|
|
H5R_get_region
|
1998-10-14 05:28:53 +08:00
|
|
|
|
PURPOSE
|
|
|
|
|
Retrieves a dataspace with the region pointed to selected.
|
|
|
|
|
USAGE
|
1998-10-27 01:14:00 +08:00
|
|
|
|
H5S_t *H5R_get_region(ref)
|
1998-10-23 06:49:16 +08:00
|
|
|
|
void *ref; IN: Reference to open.
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
|
Pointer to the dataspace on success, NULL on failure
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
Given a reference to some object, creates a copy of the dataset pointed
|
|
|
|
|
to's dataspace and defines a selection in the copy which is the region
|
|
|
|
|
pointed to.
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
static H5S_t *
|
1998-10-27 01:14:00 +08:00
|
|
|
|
H5R_get_region(void __unused__ *ref)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
|
|
|
|
H5S_t *ret_value = NULL;
|
|
|
|
|
|
1998-10-27 01:14:00 +08:00
|
|
|
|
FUNC_ENTER(H5R_get_region, NULL);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
assert(ref);
|
|
|
|
|
|
|
|
|
|
#ifdef LATER
|
|
|
|
|
done:
|
|
|
|
|
#endif /* LATER */
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1998-10-27 01:14:00 +08:00
|
|
|
|
} /* end H5R_get_region() */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
|
NAME
|
1998-10-27 01:14:00 +08:00
|
|
|
|
H5Rget_region
|
1998-10-14 05:28:53 +08:00
|
|
|
|
PURPOSE
|
|
|
|
|
Retrieves a dataspace with the region pointed to selected.
|
|
|
|
|
USAGE
|
1998-10-27 01:14:00 +08:00
|
|
|
|
hid_t H5Rget_region(ref)
|
1998-10-23 06:49:16 +08:00
|
|
|
|
void *ref; IN: Reference to open.
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
RETURNS
|
1998-10-27 05:18:54 +08:00
|
|
|
|
Valid ID on success, Negative on failure
|
1998-10-14 05:28:53 +08:00
|
|
|
|
DESCRIPTION
|
|
|
|
|
Given a reference to some object, creates a copy of the dataset pointed
|
|
|
|
|
to's dataspace and defines a selection in the copy which is the region
|
|
|
|
|
pointed to.
|
|
|
|
|
GLOBAL VARIABLES
|
|
|
|
|
COMMENTS, BUGS, ASSUMPTIONS
|
|
|
|
|
EXAMPLES
|
|
|
|
|
REVISION LOG
|
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
|
hid_t
|
1998-10-27 01:14:00 +08:00
|
|
|
|
H5Rget_region(hid_t dset, H5R_type_t rtype, void *ref)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
{
|
|
|
|
|
H5S_t *space = NULL;
|
|
|
|
|
hid_t ret_value = FAIL;
|
|
|
|
|
|
1998-10-27 01:14:00 +08:00
|
|
|
|
FUNC_ENTER(H5Rget_region, FAIL);
|
1998-10-27 03:55:54 +08:00
|
|
|
|
H5TRACE3("i","iRtx",dset,rtype,ref);
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|
|
|
|
|
/* Check args */
|
|
|
|
|
if(ref==NULL)
|
|
|
|
|
HGOTO_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer");
|
|
|
|
|
|
|
|
|
|
/* Create reference */
|
1998-10-27 01:14:00 +08:00
|
|
|
|
if ((space=H5R_get_region(ref))==NULL)
|
1998-10-14 05:28:53 +08:00
|
|
|
|
HGOTO_ERROR (H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace");
|
|
|
|
|
|
|
|
|
|
/* Atomize */
|
|
|
|
|
if ((ret_value=H5I_register (H5I_DATASPACE, space))<0)
|
|
|
|
|
HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register dataspace atom");
|
|
|
|
|
|
|
|
|
|
done:
|
|
|
|
|
FUNC_LEAVE(ret_value);
|
1998-10-27 01:14:00 +08:00
|
|
|
|
} /* end H5Rget_region() */
|
1998-10-14 05:28:53 +08:00
|
|
|
|
|