[svn-r2444] Checkpoint the Generic Property implementation. It's not active yet, but it's

close.  This shouldn't interfere with other development work.  (I think.. :-)
This commit is contained in:
Quincey Koziol 2000-07-25 12:35:17 -05:00
parent 2a14d16d80
commit 2c8c5f9692
10 changed files with 2639 additions and 337 deletions

View File

@ -19,6 +19,7 @@ static char RcsId[] = "@(#)$Revision$";
/* private headers */
#include <H5private.h> /*library */
#include <H5Bprivate.h> /*B-link trees */
#include <H5Dprivate.h> /*datasets */
#include <H5Eprivate.h> /*error handling */
#include <H5FDprivate.h> /*file driver */
#include <H5FLprivate.h> /*Free Lists */
@ -110,8 +111,11 @@ H5_init_library(void)
/*
* Initialize interfaces that might not be able to initialize themselves
* soon enough. The file interface must be initialized because calling
* H5Pcreate() might require the H5F_access_dflt to be initialized.
* soon enough. The file & dataset interfaces must be initialized because
* calling H5Pcreate() might require the file/dataset property classes to be
* initialized. The property lists are be initialized during the H5F/H5D
* init calls (because they call H5P functions, which initialize the H5P
* API, before using the properties).
*/
if (H5F_init()<0) {
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
@ -121,6 +125,10 @@ H5_init_library(void)
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
"unable to initialize type interface");
}
if (H5D_init()<0) {
HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
"unable to initialize file interface");
}
/* Debugging? */
H5_debug_mask("-all");

View File

@ -95,7 +95,7 @@
#include <H5FLprivate.h> /*Free Lists */
#include <H5MFprivate.h> /*file memory management */
#include <H5MMprivate.h> /*core memory management */
#include <H5Pprivate.h> /*property lists */
#include <H5Pprivate.h> /*property lists */
#include <H5FDmpio.h> /*for H5FD_mpio_tas_allsame() */

View File

@ -101,6 +101,31 @@ H5FL_BLK_DEFINE_STATIC(vlen_vl_buf);
/* Declare a free list to manage other blocks of VL data */
H5FL_BLK_DEFINE_STATIC(vlen_fl_buf);
/*-------------------------------------------------------------------------
* Function: H5D_init
*
* Purpose: Initialize the interface from some other layer.
*
* Return: Success: non-negative
*
* Failure: negative
*
* Programmer: Quincey Koziol
* Saturday, March 4, 2000
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
herr_t
H5D_init(void)
{
FUNC_ENTER(H5D_init, FAIL);
/* FUNC_ENTER() does all the work */
FUNC_LEAVE(SUCCEED);
}
/*--------------------------------------------------------------------------
NAME
@ -125,6 +150,8 @@ H5D_init_interface(void)
HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to initialize interface");
}
/* Register the default dataset creation & data xfer properties */
FUNC_LEAVE(SUCCEED);
}

View File

@ -55,6 +55,7 @@ typedef struct H5D_t H5D_t;
__DLLVAR__ const H5D_create_t H5D_create_dflt;
/* Functions defined in H5D.c */
__DLL__ herr_t H5D_init(void);
__DLL__ H5D_t *H5D_create(H5G_entry_t *loc, const char *name,
const H5T_t *type, const H5S_t *space,
const H5D_create_t *create_parms);

View File

@ -203,14 +203,14 @@ H5F_init_interface(void)
* which are pending completion because there are object headers still
* open within the file.
*/
if (H5I_init_group(H5I_FILE, H5I_FILEID_HASHSIZE, 0,
(H5I_free_t)H5F_close)<0 ||
H5I_init_group(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0,
(H5I_free_t)H5F_close)<0) {
HRETURN_ERROR (H5E_FILE, H5E_CANTINIT, FAIL,
if (H5I_init_group(H5I_FILE, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0 ||
H5I_init_group(H5I_FILE_CLOSING, H5I_FILEID_HASHSIZE, 0, (H5I_free_t)H5F_close)<0) {
HRETURN_ERROR (H5E_FILE, H5E_CANTINIT, FAIL,
"unable to initialize interface");
}
/* Register the default file creation & access properties */
/* Register predefined file drivers */
H5E_BEGIN_TRY {
if ((status=H5FD_SEC2)<0) goto end_registration;

View File

@ -38,6 +38,8 @@
#define H5I_RAGGED_HASHSIZE 64
#define H5I_REFID_HASHSIZE 64
#define H5I_VFL_HASHSIZE 64
#define H5I_GENPROPCLS_HASHSIZE 64
#define H5I_GENPROPOBJ_HASHSIZE 128
/*
* Function for freeing objects. This function will be called with an object

View File

@ -30,7 +30,7 @@ typedef enum {
H5I_BADID = (-1), /*invalid Group */
H5I_FILE = 1, /*group ID for File objects */
H5I_FILE_CLOSING, /*files pending close due to open objhdrs */
H5I_TEMPLATE_0, /*group ID for Template objects */
H5I_TEMPLATE_0, /*group ID for Template objects */
H5I_TEMPLATE_1, /*group ID for Template objects */
H5I_TEMPLATE_2, /*group ID for Template objects */
H5I_TEMPLATE_3, /*group ID for Template objects */
@ -39,17 +39,19 @@ typedef enum {
H5I_TEMPLATE_6, /*group ID for Template objects */
H5I_TEMPLATE_7, /*group ID for Template objects */
#ifndef NDEBUG
H5I_TEMPLATE_MAX, /*not really a group ID */
H5I_TEMPLATE_MAX, /*not really a group ID */
#endif
H5I_GROUP, /*group ID for Group objects */
H5I_DATATYPE, /*group ID for Datatype objects */
H5I_DATASPACE, /*group ID for Dataspace objects */
H5I_DATASET, /*group ID for Dataset objects */
H5I_ATTR, /*group ID for Attribute objects */
H5I_TEMPBUF, /*group ID for Temporary buffer objects */
H5I_TEMPBUF, /*group ID for Temporary buffer objects */
H5I_RAGGED, /*group ID for Ragged array objects */
H5I_REFERENCE, /*group ID for Reference objects */
H5I_VFL, /*group ID for virtual file layer */
H5I_VFL, /*group ID for virtual file layer */
H5I_GENPROP_CLS, /*group ID for generic property list classes */
H5I_GENPROP_LST, /*group ID for generic property lists */
H5I_NGROUPS /*number of valid groups, MUST BE LAST! */
} H5I_type_t;

2766
src/H5P.c

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,65 @@
#include <H5Fprivate.h>
#include <H5Dprivate.h>
/* Define enum for modifications to class */
typedef enum {
H5P_MOD_ERR=(-1), /* Indicate an error */
H5P_MOD_INC_CLS, /* Increment the dependant class count*/
H5P_MOD_DEC_CLS, /* Decrement the dependant class count*/
H5P_MOD_INC_LST, /* Increment the dependant list count*/
H5P_MOD_DEC_LST, /* Decrement the dependant list count*/
H5P_MOD_CHECK, /* Just check about deleting the class */
H5P_MOD_MAX /* Upper limit on class modifications */
} H5P_class_mod_t;
/* Define structure to hold property information */
typedef struct H5P_genprop_tag {
/* Values for this property */
uintn xor; /* XOR'ed version of the name, for faster comparisons */
char *name; /* Name of property */
size_t size; /* Size of property value */
void *value; /* Pointer to property value */
/* Callback function pointers & info */
H5P_prp_create_func_t create; /* Function to call when a property is created */
void *def_value; /* Pointer to default value to pass along to create callback */
H5P_prp_set_func_t set; /* Function to call when a property value is set */
H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */
H5P_prp_close_func_t close; /* Function to call when a property is closed */
struct H5P_genprop_tag *next; /* Pointer to the next property in this list */
} H5P_genprop_t;
/* Define structure to hold class information */
typedef struct H5P_genclass_tag {
struct H5P_genclass_tag *parent; /* Pointer to parent class */
char *name; /* Name of property list class */
uintn nprops; /* Number of properties in class */
uintn hashsize; /* Hash table size */
uintn plists; /* Number of property lists that have been created since the last modification to the class */
uintn classes; /* Number of classes that have been derived since the last modification to the class */
uintn internal:1; /* Whether this class is internal to the library or not */
uintn deleted:1; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */
/* Callback function pointers & info */
H5P_cls_create_func_t create_func; /* Function to call when a property list is created */
void *create_data; /* Pointer to user data to pass along to create callback */
H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */
void *close_data; /* Pointer to user data to pass along to close callback */
H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the class */
} H5P_genclass_t;
/* Define structure to hold property list information */
typedef struct H5P_genplist_tag {
H5P_genclass_t *pclass; /* Pointer to class info */
uintn nprops; /* Number of properties in class */
uintn class_init:1; /* Whether the class initialization callback finished successfully */
/* Hash size for a property list is same as class */
H5P_genprop_t *props[1]; /* Hash table of pointers to properties in the list */
} H5P_genplist_t;
/* Master property list structure */
typedef struct {
/* Union of all the different kinds of property lists */
@ -36,6 +95,28 @@ typedef struct {
H5P_class_t class; /* Property list class */
} H5P_t;
/* Private functions, not part of the publicly documented API */
__DLL__ H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, const char *name,
uintn hashsize, uintn internal,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_close_func_t cls_close, void *close_data);
__DLL__ H5P_genplist_t *H5P_create_list(H5P_genclass_t *class);
__DLL__ herr_t H5P_register(H5P_genclass_t *class, const char *name,
size_t size, void *def_value, H5P_prp_create_func_t prp_create,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_close_func_t prp_close);
__DLL__ herr_t H5P_insert(H5P_genplist_t *plist, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_close_func_t prp_close);
__DLL__ herr_t H5P_set(H5P_genplist_t *plist, const char *name, void *value);
__DLL__ herr_t H5P_exist(H5P_genplist_t *plist, const char *name);
__DLL__ herr_t H5P_get_size(H5P_genplist_t *plist, const char *name);
__DLL__ herr_t H5P_get(H5P_genplist_t *plist, const char *name, void *value);
__DLL__ herr_t H5P_remove(H5P_genplist_t *plist, const char *name);
__DLL__ herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name);
__DLL__ herr_t H5P_close_list(H5P_genplist_t *plist);
__DLL__ herr_t H5P_close_class(H5P_genclass_t *class);
__DLL__ herr_t H5P_init(void);
__DLL__ hid_t H5P_create(H5P_class_t type, H5P_t *plist);
__DLL__ void *H5P_copy(H5P_class_t type, const void *src);
__DLL__ herr_t H5P_close(void *plist);

View File

@ -29,25 +29,76 @@
/* Property list classes */
typedef enum H5P_class_t {
H5P_NO_CLASS = -1, /*error return value */
H5P_FILE_CREATE = 0, /*file creation properties */
H5P_FILE_ACCESS = 1, /*file access properties */
H5P_DATASET_CREATE = 2, /*dataset creation properties */
H5P_DATA_XFER = 3, /*data transfer properties */
H5P_MOUNT = 4, /*file mounting properties */
H5P_NO_CLASS = -1, /*error return value */
H5P_FILE_CREATE = 0, /*file creation properties */
H5P_FILE_ACCESS = 1, /*file access properties */
H5P_DATASET_CREATE = 2, /*dataset creation properties */
H5P_DATA_XFER = 3, /*data transfer properties */
H5P_MOUNT = 4, /*file mounting properties */
H5P_NCLASSES = 5 /*this must be last! */
H5P_NCLASSES = 5 /*this must be last! */
} H5P_class_t;
/* Alias for the previous H5P_DATASER_XFER property list */
/* This should eventually be publicly decommisioned - 10/6/99 - QAK */
#define H5P_DATASET_XFER H5P_DATA_XFER
/* Define property list class callback function pointer types */
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
/* Define property list callback function pointer types */
typedef herr_t (*H5P_prp_create_func_t)(const char *name, void **def_value);
typedef herr_t (*H5P_prp_set_func_t)(hid_t prop_id, const char *name, void **value);
typedef herr_t (*H5P_prp_get_func_t)(hid_t prop_id, const char *name, void *value);
typedef herr_t (*H5P_prp_close_func_t)(const char *name, void *value);
#ifdef __cplusplus
extern "C" {
#endif
/*
* The library created property list classes
*/
#define H5P_NO_CLASS_NEW (H5open(), H5P_NO_CLASS_g)
#define H5P_NO_CLASS_HASH_SIZE 0
#define H5P_FILE_CREATE_NEW (H5open(), H5P_FILE_CREATE_g)
#define H5P_FILE_CREATE_HASH_SIZE 17
#define H5P_FILE_ACCESS_NEW (H5open(), H5P_FILE_ACCESS_g)
#define H5P_FILE_ACCESS_HASH_SIZE 17
#define H5P_DATASET_CREATE_NEW (H5open(), H5P_DATASET_CREATE_g)
#define H5P_DATASET_CREATE_HASH_SIZE 17
#define H5P_DATA_XFER_NEW (H5open(), H5P_DATA_XFER_g)
#define H5P_DATA_XFER_HASH_SIZE 17
#define H5P_MOUNT_NEW (H5open(), H5P_MOUNT_g)
#define H5P_MOUNT_HASH_SIZE 17
__DLLVAR__ hid_t H5P_NO_CLASS_g;
__DLLVAR__ hid_t H5P_FILE_CREATE_g;
__DLLVAR__ hid_t H5P_FILE_ACCESS_g;
__DLLVAR__ hid_t H5P_DATASET_CREATE_g;
__DLLVAR__ hid_t H5P_DATA_XFER_g;
__DLLVAR__ hid_t H5P_MOUNT_g;
/* Public functions */
__DLL__ hid_t H5Pcreate_class(hid_t parent, const char *name, unsigned hashsize,
H5P_cls_create_func_t cls_create, void *create_data,
H5P_cls_close_func_t cls_close, void *close_data);
__DLL__ hid_t H5Pcreate_list(hid_t cls_id);
__DLL__ herr_t H5Pregister(hid_t class, const char *name, size_t size,
void *def_value, H5P_prp_create_func_t prp_create,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_close_func_t prp_close);
__DLL__ herr_t H5Pinsert(hid_t plist_id, const char *name, size_t size,
void *value, H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
H5P_prp_close_func_t prp_close);
__DLL__ herr_t H5Pset(hid_t plist_id, const char *name, void *value);
__DLL__ herr_t H5Pexist(hid_t plist_id, const char *name);
__DLL__ herr_t H5Pget_size(hid_t plist_id, const char *name);
__DLL__ herr_t H5Pget(hid_t plist_id, const char *name, void * value);
__DLL__ herr_t H5Premove(hid_t plist_id, const char *name);
__DLL__ herr_t H5Punregister(hid_t pclass_id, const char *name);
__DLL__ herr_t H5Pclose_list(hid_t plist_id);
__DLL__ herr_t H5Pclose_class(hid_t plist_id);
__DLL__ hid_t H5Pcreate(H5P_class_t type);
__DLL__ herr_t H5Pclose(hid_t plist_id);
__DLL__ hid_t H5Pcopy(hid_t plist_id);