1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF5. The full HDF5 copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the files COPYING and Copyright.html. COPYING can be found at the root * 9 * of the source code distribution tree; Copyright.html can be found at the * 10 * root level of an installed copy of the electronic HDF5 document set and * 11 * is linked from the top-level documents page. It can also be found at * 12 * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * 13 * access to either file, you may request a copy from help@hdfgroup.org. * 14 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 16 /* 17 * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu> 18 * Friday, November 16, 2001 19 * 20 * Purpose: This file contains declarations which are visible only within 21 * the H5P package. Source files outside the H5P package should 22 * include H5Pprivate.h instead. 23 */ 24 #ifndef H5P_PACKAGE 25 #error "Do not include this file outside the H5P package!" 26 #endif 27 28 #ifndef _H5Ppkg_H 29 #define _H5Ppkg_H 30 31 /* Get package's private header */ 32 #include "H5Pprivate.h" 33 34 /* Other private headers needed by this file */ 35 #include "H5SLprivate.h" /* Skip lists */ 36 37 /**************************/ 38 /* Package Private Macros */ 39 /**************************/ 40 41 42 /****************************/ 43 /* Package Private Typedefs */ 44 /****************************/ 45 46 /* Define enum for type of object that property is within */ 47 typedef enum { 48 H5P_PROP_WITHIN_UNKNOWN=0, /* Property container is unknown */ 49 H5P_PROP_WITHIN_LIST, /* Property is within a list */ 50 H5P_PROP_WITHIN_CLASS /* Property is within a class */ 51 } H5P_prop_within_t; 52 53 /* Define enum for modifications to class */ 54 typedef enum { 55 H5P_MOD_ERR=(-1), /* Indicate an error */ 56 H5P_MOD_INC_CLS, /* Increment the dependant class count*/ 57 H5P_MOD_DEC_CLS, /* Decrement the dependant class count*/ 58 H5P_MOD_INC_LST, /* Increment the dependant list count*/ 59 H5P_MOD_DEC_LST, /* Decrement the dependant list count*/ 60 H5P_MOD_INC_REF, /* Increment the ID reference count*/ 61 H5P_MOD_DEC_REF, /* Decrement the ID reference count*/ 62 H5P_MOD_MAX /* Upper limit on class modifications */ 63 } H5P_class_mod_t; 64 65 /* Define structure to hold property information */ 66 typedef struct H5P_genprop_t { 67 /* Values for this property */ 68 char *name; /* Name of property */ 69 size_t size; /* Size of property value */ 70 void *value; /* Pointer to property value */ 71 H5P_prop_within_t type; /* Type of object the property is within */ 72 hbool_t shared_name; /* Whether the name is shared or not */ 73 74 /* Callback function pointers & info */ 75 H5P_prp_create_func_t create; /* Function to call when a property is created */ 76 H5P_prp_set_func_t set; /* Function to call when a property value is set */ 77 H5P_prp_get_func_t get; /* Function to call when a property value is retrieved */ 78 H5P_prp_delete_func_t del; /* Function to call when a property is deleted */ 79 H5P_prp_copy_func_t copy; /* Function to call when a property is copied */ 80 H5P_prp_compare_func_t cmp; /* Function to call when a property is compared */ 81 H5P_prp_close_func_t close; /* Function to call when a property is closed */ 82 } H5P_genprop_t; 83 84 /* Define structure to hold class information */ 85 struct H5P_genclass_t { 86 struct H5P_genclass_t *parent; /* Pointer to parent class */ 87 char *name; /* Name of property list class */ 88 H5P_plist_type_t type; /* Type of property */ 89 size_t nprops; /* Number of properties in class */ 90 unsigned plists; /* Number of property lists that have been created since the last modification to the class */ 91 unsigned classes; /* Number of classes that have been derived since the last modification to the class */ 92 unsigned ref_count; /* Number of oustanding ID's open on this class object */ 93 hbool_t deleted; /* Whether this class has been deleted and is waiting for dependent classes & proplists to close */ 94 unsigned revision; /* Revision number of a particular class (global) */ 95 H5SL_t *props; /* Skip list containing properties */ 96 97 /* Callback function pointers & info */ 98 H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ 99 void *create_data; /* Pointer to user data to pass along to create callback */ 100 H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ 101 void *copy_data; /* Pointer to user data to pass along to copy callback */ 102 H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ 103 void *close_data; /* Pointer to user data to pass along to close callback */ 104 }; 105 106 /* Define structure to hold property list information */ 107 struct H5P_genplist_t { 108 H5P_genclass_t *pclass; /* Pointer to class info */ 109 hid_t plist_id; /* Copy of the property list ID (for use in close callback) */ 110 size_t nprops; /* Number of properties in class */ 111 hbool_t class_init; /* Whether the class initialization callback finished successfully */ 112 H5SL_t *del; /* Skip list containing names of deleted properties */ 113 H5SL_t *props; /* Skip list containing properties */ 114 }; 115 116 /* Function pointer for library classes with properties to register */ 117 typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); 118 typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); 119 120 /* 121 * Each library property list class has a variable of this type that contains 122 * class variables and methods used to initialize the class. 123 */ 124 typedef struct H5P_libclass_t { 125 const char *name; /* Class name */ 126 H5P_plist_type_t type; /* Class type */ 127 128 hid_t const * const par_class_id; /* Pointer to global parent class property list class ID */ 129 hid_t * const class_id; /* Pointer to global property list class ID */ 130 hid_t * const def_plist_id; /* Pointer to global default property list ID */ 131 H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ 132 133 /* Class callback function pointers & info */ 134 H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ 135 void *create_data; /* Pointer to user data to pass along to create callback */ 136 H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ 137 void *copy_data; /* Pointer to user data to pass along to copy callback */ 138 H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ 139 void *close_data; /* Pointer to user data to pass along to close callback */ 140 } H5P_libclass_t; 141 142 /* Property list/class iterator callback function pointer */ 143 typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); 144 145 /*****************************/ 146 /* Package Private Variables */ 147 /*****************************/ 148 149 150 /******************************/ 151 /* Package Private Prototypes */ 152 /******************************/ 153 154 /* Private functions, not part of the publicly documented API */ 155 H5_DLL herr_t H5P__term_pub_interface(void); 156 H5_DLL herr_t H5P__term_deprec_interface(void); 157 H5_DLL H5P_genclass_t *H5P_create_class(H5P_genclass_t *par_class, 158 const char *name, H5P_plist_type_t type, 159 H5P_cls_create_func_t cls_create, void *create_data, 160 H5P_cls_copy_func_t cls_copy, void *copy_data, 161 H5P_cls_close_func_t cls_close, void *close_data); 162 H5_DLL H5P_genclass_t *H5P_copy_pclass(H5P_genclass_t *pclass); 163 H5_DLL herr_t H5P_register_real(H5P_genclass_t *pclass, const char *name, size_t size, 164 const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, 165 H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, 166 H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, 167 H5P_prp_close_func_t prp_close); 168 H5_DLL herr_t H5P_register(H5P_genclass_t **pclass, const char *name, size_t size, 169 const void *def_value, H5P_prp_create_func_t prp_create, H5P_prp_set_func_t prp_set, 170 H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_delete, 171 H5P_prp_copy_func_t prp_copy, H5P_prp_compare_func_t prp_cmp, 172 H5P_prp_close_func_t prp_close); 173 H5_DLL herr_t H5P_add_prop(H5SL_t *props, H5P_genprop_t *prop); 174 H5_DLL herr_t H5P_access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod); 175 H5_DLL htri_t H5P_exist_pclass(H5P_genclass_t *pclass, const char *name); 176 H5_DLL herr_t H5P_get_size_plist(const H5P_genplist_t *plist, const char *name, 177 size_t *size); 178 H5_DLL herr_t H5P_get_size_pclass(H5P_genclass_t *pclass, const char *name, 179 size_t *size); 180 H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); 181 H5_DLL herr_t H5P_get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops); 182 H5_DLL int H5P_cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); 183 H5_DLL herr_t H5P_cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, 184 int *cmp_ret); 185 H5_DLL int H5P_iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, 186 int *idx, H5P_iterate_int_t iter_func, void *iter_data); 187 H5_DLL int H5P_iterate_pclass(const H5P_genclass_t *pclass, int *idx, 188 H5P_iterate_int_t iter_func, void *iter_data); 189 H5_DLL herr_t H5P_copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name); 190 H5_DLL herr_t H5P_copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name); 191 H5_DLL herr_t H5P_unregister(H5P_genclass_t *pclass, const char *name); 192 H5_DLL char *H5P_get_class_path(H5P_genclass_t *pclass); 193 H5_DLL H5P_genclass_t *H5P_open_class_path(const char *path); 194 H5_DLL H5P_genclass_t *H5P_get_class_parent(const H5P_genclass_t *pclass); 195 H5_DLL herr_t H5P_close_class(void *_pclass); 196 H5_DLL herr_t H5P_get_filter(const H5Z_filter_info_t *filter, 197 unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], 198 size_t namelen, char name[], unsigned *filter_config); 199 H5_DLL H5P_genprop_t *H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name); 200 201 /* Testing functions */ 202 #ifdef H5P_TESTING 203 H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); 204 H5_DLL hid_t H5P_open_class_path_test(const char *path); 205 H5_DLL herr_t H5P_reset_external_file_test(hid_t dcpl_id); 206 #endif /* H5P_TESTING */ 207 208 #endif /* _H5Ppkg_H */ 209 210