diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-01 21:24:03 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1997-08-01 21:24:03 (GMT) |
commit | ace2983e763db689eb7c0a8b8cd84aff46d755c2 (patch) | |
tree | 71cdb1e4cb39502598665888f94623851e9d92a2 /src | |
parent | 12ebf40c4e8ce421b103a7443428d13c7f2f23b6 (diff) | |
download | hdf5-ace2983e763db689eb7c0a8b8cd84aff46d755c2.zip hdf5-ace2983e763db689eb7c0a8b8cd84aff46d755c2.tar.gz hdf5-ace2983e763db689eb7c0a8b8cd84aff46d755c2.tar.bz2 |
[svn-r9] Added framework code for creating datasets and hooked them into the
"meta-object" interface
Diffstat (limited to 'src')
-rw-r--r-- | src/H5D.c | 162 | ||||
-rw-r--r-- | src/H5Dprivate.h | 29 | ||||
-rw-r--r-- | src/H5Dproto.h | 40 |
3 files changed, 231 insertions, 0 deletions
diff --git a/src/H5D.c b/src/H5D.c new file mode 100644 index 0000000..cd73c8f --- /dev/null +++ b/src/H5D.c @@ -0,0 +1,162 @@ +/**************************************************************************** +* 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$ */ + +/*LINTLIBRARY */ +/*+ + FILE + H5D.c + HDF5 Dataset routines + + EXPORTED ROUTINES + H5Dcreate -- Create a dataset + H5Drelease -- Release access to a dataset + + LIBRARY-SCOPED ROUTINES + + LOCAL ROUTINES + H5P_init_interface -- initialize the interface + + */ + +#include "hdf5.h" +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Dataset functions */ + +/*--------------------- Locally scoped variables -----------------------------*/ + +/* Whether we've installed the library termination function yet for this interface */ +static intn interface_initialize = FALSE; + +/*-------------------------------------------------------------------------- +NAME + H5D_init_interface -- Initialize interface-specific information +USAGE + herr_t H5D_init_interface() + +RETURNS + SUCCEED/FAIL +DESCRIPTION + Initializes any interface-specific data or routines. + +--------------------------------------------------------------------------*/ +static herr_t H5D_init_interface(void) +{ +#ifdef LATER + CONSTR(FUNC, "H5D_init_interface"); /* For HERROR */ +#endif /* LATER */ + herr_t ret_value = SUCCEED; + + /* Don't use "FUNC_ENTER" macro, to avoid potential infinite recursion */ + PABLO_TRACE_ON(H5D_mask, ID_H5D_init_interface); + + /* Don't call this routine again... */ + interface_initialize = TRUE; + + /* Initialize the atom group for the file IDs */ + ret_value=H5Ainit_group(H5_DATASET,HDF5_DATASETID_HASHSIZE,H5D_RESERVED_ATOMS); + + FUNC_LEAVE(H5D_mask, ID_H5D_init_interface, ret_value); +} /* H5D_init_interface */ + +/*-------------------------------------------------------------------------- + NAME + H5D_create + PURPOSE + Create a new HDF5 dataset object + USAGE + hatom_t H5D_create(owner_id, type, name) + hatom_t owner_id; IN: Group/file which owns this object + hobjtype_t type; IN: Type of object to create + const char *name; IN: Name of the object + RETURNS + Returns ID (atom) on success, FAIL on failure + DESCRIPTION + This function actually creates the dataset object. +--------------------------------------------------------------------------*/ +hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name) +{ + CONSTR(FUNC, "H5D_create"); /* for HERROR */ + H5D_dataset_t *new_dataset; /* new dataset object to create */ + hatom_t ret_value = SUCCEED; + + FUNC_ENTER(H5D_mask, ID_H5D_create, H5D_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + + /* Allocate space for the new data-type */ + if((new_dataset=HDmalloc(sizeof(H5D_dataset_t)))==NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL); + + /* Initialize the dimensionality object */ + + /* Register the new datatype and get an ID for it */ + if((ret_value=H5Aregister_atom(H5_DATASET, (const VOIDP)new_dataset))==FAIL) + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(H5D_mask, ID_H5D_create, ret_value); +} /* end H5D_create() */ + +/*-------------------------------------------------------------------------- + NAME + H5D_release + PURPOSE + Release access to an HDF5 dataset object. + USAGE + herr_t H5D_release(oid) + hatom_t oid; IN: Object to release access to + RETURNS + SUCCEED/FAIL + DESCRIPTION + This function releases a dataset from active use by a user. +--------------------------------------------------------------------------*/ +herr_t H5D_release(hatom_t oid) +{ + CONSTR(FUNC, "H5D_release"); /* for HERROR */ + H5D_dataset_t *dataset; /* dataset object to release */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER(H5D_mask, ID_H5Drelease, H5D_init_interface, FAIL); + + /* Clear errors and check args and all the boring stuff. */ + H5ECLEAR; + + /* Chuck the object! :-) */ + if((dataset=H5Aremove_atom(oid))==NULL) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL); + HDfree(dataset); + +done: + if(ret_value == FAIL) + { /* Error condition cleanup */ + + } /* end if */ + + /* Normal function cleanup */ + + FUNC_LEAVE(H5D_mask, ID_H5D_release, ret_value); +} /* end H5D_release() */ + + diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h new file mode 100644 index 0000000..1def360 --- /dev/null +++ b/src/H5Dprivate.h @@ -0,0 +1,29 @@ +/**************************************************************************** + * 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. * + * * + ****************************************************************************/ + +/* $Id$ */ + +/* + * This file contains private information about the H5D module + */ + +#ifndef H5DPRIVATE_H +#define H5DPRIVATE_H + +#include "H5Dproto.h" +#define H5D_RESERVED_ATOMS 0 + +/*------------------_-- Local function prototypes ----------------------------*/ +static herr_t H5D_init_interface(void); + +#endif /* H5DPRIVATE_H */ + diff --git a/src/H5Dproto.h b/src/H5Dproto.h new file mode 100644 index 0000000..5ffe8a9 --- /dev/null +++ b/src/H5Dproto.h @@ -0,0 +1,40 @@ +/**************************************************************************** + * 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. * + * * + ****************************************************************************/ + +/* $Id$ */ + +/* + * This file contains function prototypes for each exported function in the H5D module + */ + +#ifndef H5DPROTO_H +#define H5DPROTO_H + +typedef struct { + int foo; /* stop compiler from whining right now */ + } H5D_dataset_t; + +#if defined c_plusplus || defined __cplusplus +extern "C" +{ +#endif /* c_plusplus || __cplusplus */ + +/* Functions in H5D.c */ +hatom_t H5D_create(hatom_t owner_id, hobjtype_t type, const char *name); +herr_t H5D_release(hatom_t oid); + +#if defined c_plusplus || defined __cplusplus +} +#endif /* c_plusplus || __cplusplus */ + +#endif /* H5PPROTO_H */ + |