|
|
|||
File indexing completed on 2025-12-04 10:20:55
0001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 0002 * Copyright by The HDF Group. * 0003 * All rights reserved. * 0004 * * 0005 * This file is part of HDF5. The full HDF5 copyright notice, including * 0006 * terms governing use, modification, and redistribution, is contained in * 0007 * the COPYING file, which can be found at the root of the source code * 0008 * distribution tree, or in https://www.hdfgroup.org/licenses. * 0009 * If you do not have access to either file, you may request a copy from * 0010 * help@hdfgroup.org. * 0011 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 0012 0013 /*------------------------------------------------------------------------- 0014 * 0015 * Created: H5Opublic.h 0016 * 0017 * Purpose: Public declarations for the H5O (object header) 0018 * package 0019 * 0020 *------------------------------------------------------------------------- 0021 */ 0022 #ifndef H5Opublic_H 0023 #define H5Opublic_H 0024 0025 #include "H5public.h" /* Generic Functions */ 0026 #include "H5Ipublic.h" /* Identifiers */ 0027 0028 /*****************/ 0029 /* Public Macros */ 0030 /*****************/ 0031 0032 /* Flags for object copy (H5Ocopy) */ 0033 #define H5O_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /**< Copy only immediate members */ 0034 #define H5O_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /**< Expand soft links into new objects */ 0035 #define H5O_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /**< Expand external links into new objects */ 0036 #define H5O_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /**< Copy objects that are pointed by references */ 0037 #define H5O_COPY_WITHOUT_ATTR_FLAG (0x0010u) /**< Copy object without copying attributes */ 0038 #define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /**< Copy NULL messages (empty space) */ 0039 #define H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG (0x0040u) /**< Merge committed datatypes in dest file */ 0040 #define H5O_COPY_ALL (0x007Fu) /**< All object copying flags (for internal checking) */ 0041 0042 /* Flags for shared message indexes. 0043 * Pass these flags in using the mesg_type_flags parameter in 0044 * H5P_set_shared_mesg_index. 0045 * (Developers: These flags correspond to object header message type IDs, 0046 * but we need to assign each kind of message to a different bit so that 0047 * one index can hold multiple types.) 0048 */ 0049 #define H5O_SHMESG_NONE_FLAG 0x0000 /**< No shared messages */ 0050 #define H5O_SHMESG_SDSPACE_FLAG ((unsigned)1 << 0x0001) /**< Simple Dataspace Message. */ 0051 #define H5O_SHMESG_DTYPE_FLAG ((unsigned)1 << 0x0003) /**< Datatype Message. */ 0052 #define H5O_SHMESG_FILL_FLAG ((unsigned)1 << 0x0005) /**< Fill Value Message. */ 0053 #define H5O_SHMESG_PLINE_FLAG ((unsigned)1 << 0x000b) /**< Filter pipeline message. */ 0054 #define H5O_SHMESG_ATTR_FLAG ((unsigned)1 << 0x000c) /**< Attribute Message. */ 0055 #define H5O_SHMESG_ALL_FLAG \ 0056 (H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_FILL_FLAG | H5O_SHMESG_PLINE_FLAG | \ 0057 H5O_SHMESG_ATTR_FLAG) 0058 0059 /* clang-format off */ 0060 /* Object header status flag definitions */ 0061 #define H5O_HDR_CHUNK0_SIZE 0x03 /**< 2-bit field indicating # of bytes to store the size of chunk 0's data */ 0062 #define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x04 /**< Attribute creation order is tracked */ 0063 #define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x08 /**< Attribute creation order has index */ 0064 #define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x10 /**< Non-default attribute storage phase change values stored */ 0065 #define H5O_HDR_STORE_TIMES 0x20 /**< Store access, modification, change & birth times for object */ 0066 #define H5O_HDR_ALL_FLAGS \ 0067 (H5O_HDR_CHUNK0_SIZE | H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | \ 0068 H5O_HDR_ATTR_STORE_PHASE_CHANGE | H5O_HDR_STORE_TIMES) 0069 /* clang-format on */ 0070 0071 /* Maximum shared message values. Number of indexes is 8 to allow room to add 0072 * new types of messages. 0073 */ 0074 #define H5O_SHMESG_MAX_NINDEXES 8 0075 #define H5O_SHMESG_MAX_LIST_SIZE 5000 0076 0077 /* Flags for H5Oget_info. 0078 * These flags determine which fields will be filled in the H5O_info_t 0079 * struct. 0080 */ 0081 #define H5O_INFO_BASIC 0x0001u /**< Fill in the fileno, addr, type, and rc fields \since 1.10.3 */ 0082 #define H5O_INFO_TIME 0x0002u /**< Fill in the atime, mtime, ctime, and btime fields \since 1.10.3 */ 0083 #define H5O_INFO_NUM_ATTRS 0x0004u /**< Fill in the num_attrs field \since 1.10.3 */ 0084 #define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS) 0085 0086 //! <!-- [H5O_native_info_fields_snip] --> 0087 /** 0088 * Flags for H5Oget_native_info(). These flags determine which fields will be 0089 * filled in the \ref H5O_native_info_t struct. 0090 */ 0091 #define H5O_NATIVE_INFO_HDR 0x0008u /**< Fill in the hdr field \since 1.12.0 */ 0092 #define H5O_NATIVE_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field \since 1.12.0 */ 0093 #define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE) 0094 //! <!-- [H5O_native_info_fields_snip] --> 0095 0096 /* Convenience macro to check if the token is the 'undefined' token value */ 0097 #define H5O_IS_TOKEN_UNDEF(token) (!memcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) 0098 0099 /*******************/ 0100 /* Public Typedefs */ 0101 /*******************/ 0102 0103 //! <!-- [H5O_type_t_snip] --> 0104 /** 0105 * Types of objects in file 0106 */ 0107 typedef enum H5O_type_t { 0108 H5O_TYPE_UNKNOWN = -1, /**< Unknown object type */ 0109 H5O_TYPE_GROUP, /**< Object is a group */ 0110 H5O_TYPE_DATASET, /**< Object is a dataset */ 0111 H5O_TYPE_NAMED_DATATYPE, /**< Object is a named data type */ 0112 H5O_TYPE_MAP, /**< Object is a map */ 0113 H5O_TYPE_NTYPES /**< Number of different object types (must be last!) */ 0114 } H5O_type_t; 0115 //! <!-- [H5O_type_t_snip] --> 0116 0117 //! <!-- [H5O_hdr_info_t_snip] --> 0118 /** 0119 * Information struct for object header metadata (for 0120 * H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx()) 0121 */ 0122 typedef struct H5O_hdr_info_t { 0123 unsigned version; /**< Version number of header format in file */ 0124 unsigned nmesgs; /**< Number of object header messages */ 0125 unsigned nchunks; /**< Number of object header chunks */ 0126 unsigned flags; /**< Object header status flags */ 0127 struct { 0128 hsize_t total; /**< Total space for storing object header in file */ 0129 hsize_t meta; /**< Space within header for object header metadata information */ 0130 hsize_t mesg; /**< Space within header for actual message information */ 0131 hsize_t free; /**< Free space within object header */ 0132 } space; 0133 struct { 0134 uint64_t present; /**< Flags to indicate presence of message type in header */ 0135 uint64_t shared; /**< Flags to indicate message type is shared in header */ 0136 } mesg; 0137 } H5O_hdr_info_t; 0138 //! <!-- [H5O_hdr_info_t_snip] --> 0139 0140 //! <!-- [H5O_info2_t_snip] --> 0141 /** 0142 * Data model information struct for objects 0143 * (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3) 0144 */ 0145 typedef struct H5O_info2_t { 0146 unsigned long 0147 fileno; /**< File number that object is located in. Constant across multiple opens of the same file */ 0148 H5O_token_t token; /**< Token representing the object */ 0149 H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ 0150 unsigned rc; /**< Reference count of object */ 0151 time_t atime; /**< Access time */ 0152 time_t mtime; /**< Modification time */ 0153 time_t ctime; /**< Change time */ 0154 time_t btime; /**< Birth time */ 0155 hsize_t num_attrs; /**< Number of attributes attached to object */ 0156 } H5O_info2_t; 0157 //! <!-- [H5O_info2_t_snip] --> 0158 0159 //! <!-- [H5O_native_info_t_snip] --> 0160 /** 0161 * Native file format information struct for objects. 0162 * (For H5Oget_native_info(), H5Oget_native_info_by_name(), H5Oget_native_info_by_idx()) 0163 */ 0164 typedef struct H5O_native_info_t { 0165 H5O_hdr_info_t hdr; /**< Object header information */ 0166 struct { 0167 H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ 0168 H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */ 0169 } meta_size; /**< Extra metadata storage for obj & attributes */ 0170 } H5O_native_info_t; 0171 //! <!-- [H5O_native_info_t_snip] --> 0172 0173 /** 0174 * Typedef for message creation indexes 0175 */ 0176 typedef uint32_t H5O_msg_crt_idx_t; 0177 0178 //! <!-- [H5O_iterate2_t_snip] --> 0179 /** 0180 * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3) 0181 * 0182 * \param[in] obj Object that serves as the root of the iteration; 0183 * the same value as the H5Ovisit3() \c obj_id parameter 0184 * \param[in] name Name of object, relative to \p obj, being examined at current 0185 * step of the iteration 0186 * \param[out] info Information about that object 0187 * \param[in,out] op_data User-defined pointer to data required by the application 0188 * in processing the object; a pass-through of the \c op_data 0189 * pointer provided with the H5Ovisit3() function call 0190 * \return \herr_t_iter 0191 * 0192 * \since 1.12.0 0193 * 0194 */ 0195 typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data); 0196 //! <!-- [H5O_iterate2_t_snip] --> 0197 0198 //! <!-- [H5O_mcdt_search_ret_t_snip] --> 0199 typedef enum H5O_mcdt_search_ret_t { 0200 H5O_MCDT_SEARCH_ERROR = -1, /**< Abort H5Ocopy */ 0201 H5O_MCDT_SEARCH_CONT, /**< Continue the global search of all committed datatypes in the destination file 0202 */ 0203 H5O_MCDT_SEARCH_STOP /**< Stop the search, but continue copying. The committed datatype will be copied 0204 but not merged. */ 0205 } H5O_mcdt_search_ret_t; 0206 //! <!-- [H5O_mcdt_search_ret_t_snip] --> 0207 0208 //! <!-- [H5O_mcdt_search_cb_t_snip] --> 0209 /** 0210 * Callback to invoke when completing the search for a matching committed 0211 * datatype from the committed dtype list 0212 */ 0213 typedef H5O_mcdt_search_ret_t (*H5O_mcdt_search_cb_t)(void *op_data); 0214 //! <!-- [H5O_mcdt_search_cb_t_snip] --> 0215 0216 /********************/ 0217 /* Public Variables */ 0218 /********************/ 0219 0220 /*********************/ 0221 /* Public Prototypes */ 0222 /*********************/ 0223 #ifdef __cplusplus 0224 extern "C" { 0225 #endif 0226 0227 /** 0228 *------------------------------------------------------------------------- 0229 * \ingroup H5O 0230 * 0231 * \brief Opens an object in an HDF5 file by location identifier and path name. 0232 * 0233 * \fgdta_loc_obj_id{loc_id} 0234 * \param[in] name Path to the object; relative to \p loc_id 0235 * \lapl_id 0236 * 0237 * \return \hid_ti{object} 0238 * 0239 * \details H5Oopen() opens a group, dataset, or committed (named) datatype 0240 * specified by a location, \p loc_id, and a path name, \p name, in an HDF5 file. 0241 * 0242 * This function opens the object in the same manner as H5Gopen(), H5Topen(), and H5Dopen(). 0243 * However, H5Oopen() does not require the type of object to be known beforehand. 0244 * This can be useful with user-defined links, for instance, when only a path may be known. 0245 * 0246 * H5Oopen() cannot be used to open a dataspace, attribute, property list, or file. 0247 * 0248 * Once an object of an unknown type has been opened with H5Oopen(), 0249 * the type of that object can be determined by means of an H5Iget_type() call. 0250 * 0251 * \p loc_id may be a file, group, dataset, named datatype, or attribute. 0252 * If an attribute is specified for \p loc_id then the object where the 0253 * attribute is attached will be accessed. 0254 * 0255 * \p name must be the path to that object relative to \p loc_id. 0256 * 0257 * \p lapl_id is the link access property list associated with the link pointing to 0258 * the object. If default link access properties are appropriate, this can be 0259 * passed in as #H5P_DEFAULT. 0260 * 0261 * When it is no longer needed, the opened object should be closed with 0262 * H5Oclose(), H5Gclose(), H5Tclose(), or H5Dclose(). 0263 * 0264 * \version 1.8.1 Fortran subroutine introduced in this release. 0265 * 0266 * \since 1.8.0 0267 * 0268 */ 0269 H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); 0270 /** 0271 * -------------------------------------------------------------------------- 0272 * \ingroup ASYNC 0273 * \async_variant_of{H5Oopen} 0274 */ 0275 #ifndef H5_DOXYGEN 0276 H5_DLL hid_t H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, 0277 const char *name, hid_t lapl_id, hid_t es_id); 0278 #else 0279 H5_DLL hid_t H5Oopen_async(hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); 0280 #endif 0281 0282 /** 0283 *------------------------------------------------------------------------- 0284 * \ingroup H5O 0285 * 0286 * \brief Opens an object in an HDF5 file using its VOL independent token 0287 * 0288 * \fgdta_loc_obj_id{loc_id} 0289 * \param[in] token Object token 0290 * 0291 * \return \hid_ti{object} 0292 * 0293 * \details H5Oopen_by_token() opens an object specified by the object 0294 * identifier, \p loc_id and object token, \p token. 0295 * 0296 * \since 1.12.0 0297 * 0298 */ 0299 H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); 0300 0301 /** 0302 *------------------------------------------------------------------------- 0303 * \ingroup H5O 0304 * 0305 * \brief Opens the nth object in a group 0306 * 0307 * \fgdta_loc_obj_id{loc_id} 0308 * \param[in] group_name Name of group, relative to \p loc_id, in which object is located 0309 * \idx_type 0310 * \order 0311 * \param[in] n Object to open 0312 * \lapl_id 0313 * 0314 * \return \hid_ti{object} 0315 * 0316 * \details H5Oopen_by_idx() opens the nth object in the group specified by \p loc_id 0317 * and \p group_name. 0318 * 0319 * \p loc_id specifies a location identifier. 0320 * \p group_name specifies the group relative to \p loc_id in which the object can be found. 0321 * If \p loc_id fully specifies the group in which the object resides, 0322 * \p group_name can be a dot (.). 0323 * 0324 * The specific object to be opened within the group is specified by the three parameters: 0325 * \p idx_type, \p order and \p n. 0326 * 0327 * \p idx_type specifies the type of index by which objects are ordered. 0328 * Valid index types include the following: 0329 * 0330 * \indexes 0331 * 0332 * \p order specifies the order in which the objects are to be referenced for the purposes 0333 * of this function. Valid orders include the following: 0334 * 0335 * \orders 0336 * 0337 * Note that for #H5_ITER_NATIVE, rather than implying a particular order, 0338 * it instructs the HDF5 library to iterate through the objects in the fastest 0339 * available order, i.e., in a natural order. 0340 * 0341 * \p n specifies the position of the object within the index. Note that this count is 0342 * zero-based; 0 (zero) indicates that the function will return the value of the first object; 0343 * if \p n is 5, the function will return the value of the sixth object; etc. 0344 * 0345 * \p lapl_id specifies the link access property list to be used in accessing the object. 0346 * 0347 * An object opened with this function should be closed when it is no longer needed so that 0348 * resource leaks will not develop. H5Oclose() can be used to close groups, datasets, 0349 * or committed datatypes. 0350 * 0351 * \version 1.8.1 Fortran subroutine introduced in this release. 0352 * 0353 * \since 1.8.0 0354 * 0355 */ 0356 H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, 0357 hsize_t n, hid_t lapl_id); 0358 /** 0359 * -------------------------------------------------------------------------- 0360 * \ingroup ASYNC 0361 * \async_variant_of{H5Oopen_by_idx} 0362 */ 0363 #ifndef H5_DOXYGEN 0364 H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, 0365 const char *group_name, H5_index_t idx_type, H5_iter_order_t order, 0366 hsize_t n, hid_t lapl_id, hid_t es_id); 0367 #else 0368 H5_DLL hid_t H5Oopen_by_idx_async(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0369 H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); 0370 #endif 0371 0372 /** 0373 *------------------------------------------------------------------------- 0374 * \ingroup H5O 0375 * 0376 * \brief Determines whether a link resolves to an actual object. 0377 * 0378 * \fgdta_loc_obj_id{loc_id} 0379 * \param[in] name The name of the link to check 0380 * \lapl_id 0381 * 0382 * \return Returns a positive value if the object pointed to by 0383 * the \p loc_id and \p name combination exists. 0384 * \return Returns 0 if the object pointed to by 0385 * the \p loc_id and \p name combination does not exist. 0386 * \return Returns a negative value when the function fails. 0387 * 0388 * \details H5Oexists_by_name() allows an application to determine whether 0389 * the link \p name in the group or file specified with \p loc_id 0390 * resolves to an HDF5 object to open or if the link dangles. The 0391 * link may be of any type, but hard links will always resolve 0392 * to objects and do not need to be verified. 0393 * 0394 * Note that H5Oexists_by_name() verifies only that the target 0395 * object exists. If \p name includes either a relative path or 0396 * an absolute path to the target link, intermediate steps 0397 * along the path must be verified before the existence of 0398 * the target link can be safely checked. If the path is not 0399 * verified and an intermediate element of the path does not 0400 * exist, H5Oexists_by_name() will fail. The example in the next 0401 * paragraph illustrates one step-by-step method for verifying 0402 * the existence of a link with a relative or absolute path. 0403 * 0404 * \par Example 0405 * Use the following steps to verify the existence of 0406 * the link \c datasetD in the \c group group1/group2/softlink_to_group3/, 0407 * where \c group1 is a member of the group specified by \c loc_id: 0408 * 0409 * \par 0410 * - First, use H5Lexists() to verify that a link named \c group1 exists. 0411 * - If \c group1 exists, use H5Oexists_by_name() to verify that the 0412 * link \c group1 resolves to an object. 0413 * - If \c group1 exists, use H5Lexists() again, this time with the name 0414 * set to \c group1/group2, to verify that the link \c group2 exists 0415 * in \c group1. 0416 * - If the \c group2 link exists, use H5Oexists_by_name() to verify 0417 * that \c group1/group2 resolves to an object. 0418 * - If \c group2 exists, use H5Lexists() again, this time with the name 0419 * set to \c group1/group2/softlink_to_group3, to verify that the 0420 * link \c softlink_to_group3 exists in \c group2. 0421 * - If the \c softlink_to_group3 link exists, use H5Oexists_by_name() 0422 * to verify that \c group1/group2/softlink_to_group3 resolves to 0423 * an object. 0424 * - If \c softlink_to_group3 exists, you can now safely use H5Lexists 0425 * with the name set to \c group1/group2/softlink_to_group3/datasetD to 0426 * verify that the target link, \c datasetD, exists. 0427 * - And finally, if the link \c datasetD exists, use H5Oexists_by_name 0428 * to verify that \c group1/group2/softlink_to_group3/datasetD 0429 * resolves to an object. 0430 * 0431 * \par 0432 * If the link to be verified is specified with an absolute path, 0433 * the same approach should be used, but starting with the first 0434 * link in the file's root group. For instance, if \c datasetD 0435 * were in \c /group1/group2/softlink_to_group3, the first call to 0436 * H5Lexists() would have name set to \c /group1. 0437 * 0438 * \par 0439 * Note that this is an outline and does not include all the necessary 0440 * details. Depending on circumstances, for example, an application 0441 * may need to verify the type of an object also. 0442 * 0443 * \warning \Bold{Failure Modes:} 0444 * \warning If \p loc_id and \p name both exist, but the combination does not 0445 * resolve to an object, the function will return 0 (zero); 0446 * the function does not fail in this case. 0447 * \warning If either the location or the link specified by the \p loc_id 0448 * and \p name combination does not exist, the function will fail, 0449 * returning a negative value. 0450 * \warning Note that verifying the existence of an object within an HDF5 0451 * file is a multistep process. An application can be certain the 0452 * object does not exist only if H5Lexists() and H5Oexists_by_name() 0453 * have been used to verify the existence of the links and groups 0454 * in the hierarchy above that object. The example above, in the 0455 * function description, provides a step-by-step description of 0456 * that verification process. 0457 * 0458 * \version 1.8.11 Fortran subroutine introduced in this release. 0459 * 0460 * \since 1.8.5 0461 * 0462 */ 0463 H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); 0464 0465 /** 0466 *------------------------------------------------------------------------- 0467 * \ingroup H5O 0468 * 0469 * \brief Retrieves the metadata for an object specified by an identifier 0470 * 0471 * \fgdta_loc_obj_id{loc_id} 0472 * \param[out] oinfo Buffer in which to return object information 0473 * \param[in] fields Flags specifying the fields to include in \p oinfo 0474 * 0475 * \return \herr_t 0476 * 0477 * \details H5Oget_info3() specifies an object by its identifier, \p loc_id , and 0478 * retrieves the metadata describing that object in \p oinfo. 0479 * 0480 * The \p fields parameter contains flags to determine which fields will be filled in 0481 * the H5O_info2_t \c struct returned in \p oinfo. 0482 * These flags are defined in the H5Opublic.h file: 0483 * 0484 * \obj_info_fields 0485 * 0486 * \par Example 0487 * An example snippet from examples/h5_attribute.c: 0488 * \par 0489 * \snippet h5_attribute.c H5Oget_info3_snip 0490 * 0491 * \note If you are iterating through a lot of different objects to 0492 * retrieve information via the H5Oget_info() family of routines, 0493 * you may see memory building up. This can be due to memory 0494 * allocation for metadata, such as object headers and messages, 0495 * when the iterated objects are put into the metadata cache. 0496 * \note 0497 * If the memory buildup is not desirable, you can configure a 0498 * smaller cache via H5Fset_mdc_config() or set the file access 0499 * property list via H5Pset_mdc_config(). A smaller sized cache 0500 * will force metadata entries to be evicted from the cache, 0501 * thus freeing the memory associated with the entries. 0502 * 0503 * \since 1.12.0 0504 * 0505 */ 0506 H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); 0507 0508 /** 0509 *------------------------------------------------------------------------- 0510 * \ingroup H5O 0511 * 0512 * \brief Retrieves the metadata for an object, identifying the object by 0513 * location and relative name 0514 * 0515 * \fgdta_loc_obj_id{loc_id} 0516 * \param[in] name Name of object, relative to \p loc_id 0517 * \param[out] oinfo Buffer in which to return object information 0518 * \param[in] fields Flags specifying the fields to include in \p oinfo 0519 * \lapl_id 0520 * 0521 * \return \herr_t 0522 * 0523 * \details H5Oget_info_by_name3() specifies an object's location and name, 0524 * \p loc_id and \p name, respectively, and retrieves the metadata 0525 * describing that object in \p oinfo, an H5O_info2_t struct. 0526 * 0527 * The \p fields parameter contains flags to determine which fields will be filled in 0528 * the H5O_info2_t \c struct returned in \p oinfo. 0529 * These flags are defined in the H5Opublic.h file: 0530 * 0531 * \obj_info_fields 0532 * 0533 * The link access property list, \c lapl_id, is not currently used; 0534 * it should be passed in as #H5P_DEFAULT. 0535 * 0536 * \par Example 0537 * An example snippet from test/vol.c: 0538 * \snippet vol.c H5Oget_info_by_name3_snip 0539 * 0540 * \since 1.12.0 0541 * 0542 */ 0543 H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, unsigned fields, 0544 hid_t lapl_id); 0545 /** 0546 * -------------------------------------------------------------------------- 0547 * \ingroup ASYNC 0548 * \async_variant_of{H5Oget_info_by_name} 0549 */ 0550 #ifndef H5_DOXYGEN 0551 H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line, 0552 hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, 0553 unsigned fields, hid_t lapl_id, hid_t es_id); 0554 #else 0555 H5_DLL herr_t H5Oget_info_by_name_async(hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, 0556 unsigned fields, hid_t lapl_id, hid_t es_id); 0557 #endif 0558 0559 /** 0560 *------------------------------------------------------------------------- 0561 * \ingroup H5O 0562 * 0563 * \brief Retrieves the metadata for an object, identifying the object 0564 * by an index position 0565 * 0566 * \fgdta_loc_obj_id{loc_id} 0567 * \param[in] group_name Name of group in which object is located 0568 * \idx_type 0569 * \order 0570 * \param[in] n Position within the index 0571 * \param[out] oinfo Buffer in which to return object information 0572 * \param[in] fields Flags specifying the fields to include in \p oinfo 0573 * \lapl_id 0574 * 0575 * \return \herr_t 0576 * 0577 * \details H5Oget_info_by_idx3() retrieves the metadata describing an 0578 * object in the \c struct \p oinfo, as specified by the location, 0579 * \p loc_id, group name, \p group_name, the index by which objects 0580 * in that group are tracked, \p idx_type, the order by which the 0581 * index is to be traversed, \p order, and an object's position 0582 * \p n within that index. 0583 * 0584 * If \p loc_id fully specifies the group in which the object resides, 0585 * \p group_name can be a dot (\c .). 0586 * 0587 * The \p fields parameter contains flags to determine which fields will be filled in 0588 * the H5O_info2_t \c struct returned in \p oinfo. 0589 * These flags are defined in the H5Opublic.h file: 0590 * \obj_info_fields 0591 * 0592 * The link access property list, \c lapl_id, is not currently used; 0593 * it should be passed in as #H5P_DEFAULT. 0594 * 0595 * \par Example 0596 * An example snippet from test/titerate.c: 0597 * \snippet titerate.c H5Oget_info_by_idx3_snip 0598 * 0599 * \since 1.12.0 0600 * 0601 */ 0602 H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0603 H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, unsigned fields, 0604 hid_t lapl_id); 0605 0606 /** 0607 *------------------------------------------------------------------------- 0608 * \ingroup H5O 0609 * 0610 * \brief Retrieve native file format information about an object 0611 * 0612 * \fgdta_loc_obj_id{loc_id} 0613 * \param[out] oinfo Buffer in which to return native object information 0614 * \param[in] fields Flags to determine which fields in \p oinfo are filled in 0615 * 0616 * \return \herr_t 0617 * 0618 * \details H5Oget_native_info() retrieves the native file format information for an object 0619 * specified by \p loc_id. 0620 * 0621 * The \p fields parameter indicates which fields to fill in 0622 * H5O_native_info_t. Possible values defined in H5Opublic.h are: 0623 * 0624 * \snippet this H5O_native_info_fields_snip 0625 * 0626 * \par Example 0627 * An example snippet from test/tfile.c: 0628 * \par 0629 * \snippet tfile.c H5Oget_native_info_snip 0630 * 0631 * \since 1.12.0 0632 * 0633 */ 0634 H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields); 0635 0636 /** 0637 *------------------------------------------------------------------------- 0638 * \ingroup H5O 0639 * 0640 * \brief Retrieve native file format information about an object given its name 0641 * 0642 * \fgdta_loc_obj_id{loc_id} 0643 * \param[in] name Name of object 0644 * \param[out] oinfo Buffer in which to return native object information 0645 * \param[in] fields Flags to determine which fields in \p oinfo are filled in 0646 * \lapl_id 0647 * 0648 * \return \herr_t 0649 * 0650 * \details H5Oget_native_info_by_name() retrieves the native file format 0651 * information for an object specified by \p loc_id and the name \p 0652 * name. 0653 * 0654 * The \p fields parameter which fields to fill in H5O_native_info_t. 0655 * Possible values defined in H5Opublic.h are: 0656 * 0657 * \snippet this H5O_native_info_fields_snip 0658 * 0659 * \par Example 0660 * An example snippet from test/tfile.c: 0661 * \snippet tfile.c H5Oget_native_info_by_name_snip 0662 * 0663 * \since 1.12.0 0664 * 0665 */ 0666 H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, 0667 unsigned fields, hid_t lapl_id); 0668 0669 /** 0670 *------------------------------------------------------------------------- 0671 * \ingroup H5O 0672 * 0673 * \brief Retrieve native file format information about an object 0674 * according to the order of an index 0675 * 0676 * \fgdta_loc_obj_id{loc_id} 0677 * \param[in] group_name Name of group in which object is located 0678 * \idx_type 0679 * \order 0680 * \param[in] n Position within the index 0681 * \param[out] oinfo Buffer in which to return native object information 0682 * \param[in] fields Flags to determine which fields in \p oinfo are filled in 0683 * \lapl_id 0684 * 0685 * \return \herr_t 0686 * 0687 * \details H5Oget_native_info_by_idx() retrieves the native file format information for an object 0688 * specified by \p loc_id, group name, \p group_name, the index by which 0689 * objects in the group are tracked, \p idx_type, the order by which 0690 * the index is to be traversed, \p order , and an object's position 0691 * \p n within that index. 0692 * 0693 * The \p fields parameter indicates which fields to fill in H5O_native_info_t. 0694 * Possible values defined in H5Opublic.h are: 0695 * \snippet this H5O_native_info_fields_snip 0696 * 0697 * The link access property list, \c lapl_id, is not currently used; 0698 * it should be passed in as #H5P_DEFAULT. 0699 * 0700 * \since 1.12.0 0701 * 0702 */ 0703 H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0704 H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, 0705 unsigned fields, hid_t lapl_id); 0706 0707 /** 0708 *------------------------------------------------------------------------- 0709 * \ingroup H5O 0710 * 0711 * \brief Creates a hard link to an object in an HDF5 file 0712 * 0713 * \param[in] obj_id Object to be linked 0714 * \param[in] new_loc_id Location identifier at which object is to be linked; 0715 * may be a file, group, dataset, named datatype or attribute identifier. 0716 * \param[in] new_name Name of link to be created, relative to \p new_loc_id. 0717 * \lcpl_id 0718 * \lapl_id 0719 * 0720 * \return \herr_t 0721 * 0722 * \details H5Olink() creates a new hard link to an object in an HDF5 file. 0723 * \p new_loc_id and \p \p new_link_name specify the location and name of the 0724 * new link, while \p object_id identifies the object that the link 0725 * points to. 0726 * 0727 * H5Olink() is designed for two purposes: 0728 * - To create the first hard link to an object that has just 0729 * been created with H5Dcreate_anon(), H5Gcreate_anon(), or 0730 * H5Tcommit_anon(). 0731 * - To add additional structure to an existing 0732 * file so that, for example, an object can be shared among 0733 * multiple groups. 0734 * 0735 * \p lcpl and \p lapl are the link creation and access property lists 0736 * associated with the new link. 0737 * 0738 * \par Example: 0739 * To create a new link to an object while simultaneously creating 0740 * missing intermediate groups: Suppose that an application must 0741 * create the group C with the path /A/B01/C but may not know 0742 * at run time whether the groups A and B01 exist. The following 0743 * code ensures that those groups are created if they are missing: 0744 * \par 0745 * \code 0746 * 0747 * // Creates a link creation property list (LCPL). 0748 * hid_t lcpl_id = H5Pcreate(H5P_LINK_CREATE); 0749 * 0750 * // Sets "create missing intermediate groups" property in that LCPL. 0751 * int status = H5Pset_create_intermediate_group(lcpl_id, true); 0752 * 0753 * // Creates a group without linking it into the file structure. 0754 * hid_t gid = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT); 0755 * 0756 * // Links group into file structure. 0757 * status = H5Olink(gid, file_id, "/A/B01/C", lcpl_id, H5P_DEFAULT); 0758 * 0759 * \endcode 0760 * 0761 * \par 0762 * Note that unless the object is intended to be temporary, 0763 * the H5O_LINK call is mandatory if an object created with one 0764 * of the H5*_CREATE_ANON functions (or with H5T_COMMIT_ANON) 0765 * is to be retained in the file; without an H5O_LINK call, 0766 * the object will not be linked into the HDF5 file structure 0767 * and will be deleted when the file is closed. 0768 * 0769 * \version 1.8.1 Fortran subroutine introduced in this release. 0770 * 0771 * \since 1.8.0 0772 * 0773 */ 0774 H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id); 0775 0776 /** 0777 *------------------------------------------------------------------------- 0778 * \ingroup H5O 0779 * 0780 * \brief Increments an object reference count 0781 * 0782 * \fgdta_loc_obj_id{object_id} 0783 * 0784 * \return \herr_t 0785 * 0786 * \details H5Oincr_refcount() increments the hard link reference count for an object. 0787 * It should be used any time a user-defined link that references 0788 * an object by address is added. When the link is deleted, 0789 * H5Odecr_refcount() should be used. 0790 * 0791 * An object's reference count is the number of hard links in the 0792 * file that point to that object. See the “Programming Model” 0793 * section of the HDF5 Groups chapter in the -- <em>\ref UG</em> 0794 * for a complete discussion of reference counts. 0795 * 0796 * If a user application needs to determine an object's reference 0797 * count, an H5Oget_info() call is required; the reference count 0798 * is returned in the \c rc field of the #H5O_info_t \c struct. 0799 * 0800 * \warning This function must be used with care! 0801 * \warning Improper use can lead to inaccessible data, wasted space in the file, 0802 * or <b><em>file corruption</em></b>. 0803 * 0804 * \version 1.8.11 Fortran subroutine introduced in this release. 0805 * 0806 * \since 1.8.0 0807 * 0808 */ 0809 H5_DLL herr_t H5Oincr_refcount(hid_t object_id); 0810 0811 /** 0812 *------------------------------------------------------------------------- 0813 * \ingroup H5O 0814 * 0815 * \brief Decrements an object reference count 0816 * 0817 * \fgdta_loc_obj_id{object_id} 0818 * 0819 * \return \herr_t 0820 * 0821 * \details H5Odecr_refcount() decrements the hard link reference count for an object. 0822 * It should be used any time a user-defined link that references 0823 * an object by address is deleted. In general, H5Oincr_refcount() will have 0824 * been used previously, when the link was created. 0825 * 0826 * An object's reference count is the number of hard links in the 0827 * file that point to that object. See the “Programming Model” 0828 * section of the HDF5 Groups chapter in the <em>\ref UG</em> 0829 * for a more complete discussion of reference counts. 0830 * 0831 * If a user application needs to determine an object's reference 0832 * count, an H5Oget_info() call is required; the reference count 0833 * is returned in the \c rc field of the #H5O_info_t \c struct. 0834 * 0835 * \warning This function must be used with care! 0836 * \warning Improper use can lead to inaccessible data, wasted space in the file, 0837 * or <b><em>file corruption</em></b>. 0838 * 0839 * \version 1.8.11 Fortran subroutine introduced in this release. 0840 * 0841 * \since 1.8.0 0842 * 0843 */ 0844 H5_DLL herr_t H5Odecr_refcount(hid_t object_id); 0845 0846 /** 0847 *------------------------------------------------------------------------- 0848 * \ingroup H5O 0849 * 0850 * \brief Copies an object in an HDF5 file 0851 * 0852 * \param[in] src_loc_id Object identifier indicating the location of the 0853 * source object to be copied 0854 * \param[in] src_name Name of the source object to be copied 0855 * \param[in] dst_loc_id Location identifier specifying the destination 0856 * \param[in] dst_name Name to be assigned to the new copy 0857 * \param[in] ocpypl_id Object copy property list 0858 * \lcpl_id 0859 * 0860 * \return \herr_t 0861 * 0862 * \details H5Ocopy() copies the group, dataset or committed datatype 0863 * specified by \p src_name from the file or group specified by 0864 * \p src_loc_id to the destination location \p dst_loc_id. 0865 * 0866 * The destination location, as specified in dst_loc_id, may 0867 * be a group in the current file or a location in a different 0868 * file. If dst_loc_id is a file identifier, the copy will be 0869 * placed in that file's root group. 0870 * 0871 * The copy will be created with the path specified in \p dst_name, 0872 * which must not pre-exist in the destination location. If 0873 * \p dst_name already exists at the location \p dst_loc_id, 0874 * H5Ocopy() will fail. If \p dst_name is an absolute path, 0875 * the copy will be created relative to the file's root group. 0876 * 0877 * The copy of the object is created with the property lists 0878 * specified by \p ocpypl_id and \p lcpl_id. #H5P_DEFAULT can be passed 0879 * in for these property lists. The default behavior: 0880 * 0881 * - of the link creation property list is to NOT create 0882 * intermediate groups. 0883 * - of the flags specified by the object creation property list 0884 * is described in H5Pset_copy_object(). 0885 * 0886 * These property lists or flags can be modified to govern the 0887 * behavior of H5Ocopy() as follows: 0888 * 0889 * - A flag controlling the creation of intermediate groups that 0890 * may not yet exist is set in the link creation property list 0891 * \p lcpl_id with H5Pset_create_intermediate_group(). 0892 * 0893 * - Copying of committed datatypes can be tuned through the use 0894 * of H5Pset_copy_object(), H5Padd_merge_committed_dtype_path(), 0895 * H5Pset_mcdt_search_cb(), and related functions. 0896 * 0897 * - Flags controlling other aspects of object copying are set in the 0898 * object copy property list \p ocpypl_id with H5Pset_copy_object(). 0899 * 0900 * H5Ocopy() will always try to make a copy of the object specified 0901 * in \p src_name. 0902 * 0903 * - If the object specified by \p src_name is a group containing a 0904 * soft or external link, the default is that the new copy will 0905 * contain a soft or external link with the same value as the 0906 * original. See H5Pset_copy_object() for optional settings. 0907 * 0908 * - If the path specified in \p src_name is or contains a soft link 0909 * or an external link, H5Ocopy() will copy the target object. 0910 * Use H5Lcopy() if the intent is to create a new soft or external 0911 * link with the same value as the original link. 0912 * 0913 * H5Ocopy() can be used to copy an object in an HDF5 file. If 0914 * an object has been changed since it was opened, it should be 0915 * written back to the file before using H5Ocopy(). The object 0916 * can be written back either by closing the object (H5Gclose(), 0917 * H5Oclose(), H5Dclose(), or H5Tclose()) or by flushing 0918 * the HDF5 file (H5Fflush()). 0919 * 0920 * \par See Also: 0921 * - Functions to modify the behavior of H5Ocopy(): 0922 * - H5Padd_merge_committed_dtype_path() 0923 * - H5Pset_copy_object() 0924 * - H5Pset_create_intermediate_group() 0925 * - H5Pset_mcdt_search_cb() 0926 * - Copying Committed Datatypes with #H5Ocopy - A comprehensive 0927 * discussion of copying committed datatypes (PDF) in 0928 * Advanced Topics in HDF5 0929 * 0930 * \version 1.8.9 Fortran subroutine introduced in this release. 0931 * 0932 * \since 1.8.0 0933 * 0934 */ 0935 H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, 0936 hid_t ocpypl_id, hid_t lcpl_id); 0937 /** 0938 * -------------------------------------------------------------------------- 0939 * \ingroup ASYNC 0940 * \async_variant_of{H5Ocopy} 0941 */ 0942 #ifndef H5_DOXYGEN 0943 H5_DLL herr_t H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid_t src_loc_id, 0944 const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, 0945 hid_t lcpl_id, hid_t es_id); 0946 #else 0947 H5_DLL herr_t H5Ocopy_async(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, 0948 hid_t ocpypl_id, hid_t lcpl_id, hid_t es_id); 0949 #endif 0950 0951 /** 0952 *------------------------------------------------------------------------- 0953 * \ingroup H5O 0954 * 0955 * \brief Sets comment for specified object 0956 * 0957 * \fgdta_loc_obj_id{obj_id} 0958 * \param[in] comment The new comment 0959 * 0960 * \return \herr_t 0961 * 0962 * \details H5Oset_comment() sets the comment for the specified object 0963 * to the contents of \p comment. Any previously existing comment 0964 * is overwritten. 0965 * 0966 * The target object is specified by an identifier, \p obj_id. 0967 * If \p comment is an empty string or a null pointer, any existing 0968 * comment message is removed from the object. 0969 * 0970 * Comments should be relatively short, null-terminated, ASCII strings. 0971 * 0972 * Comments can be attached to any object that has an object 0973 * header. Datasets, groups, and committed (named) datatypes have 0974 * object headers. Symbolic links do not have object headers. 0975 * 0976 * If a comment is being added to an object attribute, this comment 0977 * will be attached to the object to which the attribute belongs 0978 * and not to the attribute itself. 0979 * 0980 * \version 1.8.11 Fortran subroutine introduced in this release. 0981 * 0982 * \since 1.8.0 0983 * 0984 */ 0985 H5_DLL herr_t H5Oset_comment(hid_t obj_id, const char *comment); 0986 0987 /** 0988 *------------------------------------------------------------------------- 0989 * \ingroup H5O 0990 * 0991 * \brief Sets comment for specified object 0992 * 0993 * \fgdta_loc_obj_id{loc_id} 0994 * \param[in] name Name of the object whose comment is to be set or reset 0995 * \param[in] comment The new comment 0996 * \lapl_id 0997 * 0998 * \return \herr_t 0999 * 1000 * \details H5Oset_comment_by_name() sets the comment for the specified object 1001 * to the contents of \p comment. Any previously existing comment 1002 * is overwritten. 1003 * 1004 * The target object is specified by \p loc_id and \p name. 1005 * \p loc_id can specify any object in the file. 1006 * \p name can be one of the following: 1007 * 1008 * - The name of the object specified as a path relative to \p loc_id 1009 * - An absolute name of the object, starting from \c /, the file's root group 1010 * - A dot (\c .), if \p loc_id fully specifies the object 1011 * 1012 * If \p comment is an empty string or a null pointer, any existing 1013 * comment message is removed from the object. 1014 * 1015 * Comments should be relatively short, null-terminated, ASCII strings. 1016 * 1017 * Comments can be attached to any object that has an object 1018 * header. Datasets, groups, and committed (named) datatypes have 1019 * object headers. Symbolic links do not have object headers. 1020 * 1021 * If a comment is being added to an object attribute, this comment 1022 * will be attached to the object to which the attribute belongs 1023 * and not to the attribute itself. 1024 * 1025 * \p lapl_id contains a link access property list identifier. A 1026 * link access property list can come into play when traversing 1027 * links to access an object. 1028 * 1029 * \version 1.8.11 Fortran subroutine introduced in this release. 1030 * 1031 * \since 1.8.0 1032 * 1033 */ 1034 H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id); 1035 1036 /** 1037 *------------------------------------------------------------------------- 1038 * \ingroup H5O 1039 * 1040 * \brief Retrieves comment for specified object 1041 * 1042 * \fgdta_loc_obj_id{obj_id} 1043 * \param[out] comment The comment 1044 * \param[in] bufsize Anticipated required size of the comment buffer 1045 * 1046 * \return Upon success, returns the number of characters in the 1047 * comment, not including the \c NULL terminator, or zero (\c 0) if 1048 * the object has no comment. The value returned may be larger 1049 * than \p bufsize. Otherwise returns a negative value. 1050 * 1051 * \details H5Oget_comment() retrieves the comment for the specified object in 1052 * the buffer \p comment. 1053 * 1054 * The target object is specified by an identifier, \p object_id. 1055 * 1056 * The size in bytes of the buffer \p comment, including the \c NULL 1057 * terminator, is specified in \p bufsize. If \p bufsize is unknown, 1058 * a preliminary H5Oget_comment() call with the pointer \p comment 1059 * set to \c NULL will return the size of the comment <em>without</em> 1060 * the \c NULL terminator. 1061 * 1062 * If \p bufsize is set to a smaller value than described above, 1063 * only \p bufsize bytes of the comment, without a \c NULL terminator, 1064 * are returned in \p comment. 1065 * 1066 * If an object does not have a comment, an empty string is 1067 * returned in \p comment. 1068 * 1069 * \version 1.8.11 Fortran subroutine introduced in this release. 1070 * 1071 * \since 1.8.0 1072 * 1073 */ 1074 H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); 1075 1076 /** 1077 *------------------------------------------------------------------------- 1078 * \ingroup H5O 1079 * 1080 * \brief Retrieves comment for specified object 1081 * 1082 * \fgdta_loc_obj_id{loc_id} 1083 * \param[in] name Name of the object whose comment is to be retrieved 1084 * \param[out] comment The comment 1085 * \param[in] bufsize Anticipated required size of the \p comment buffer 1086 * \lapl_id 1087 * 1088 * \return Upon success, returns the number of characters in the comment, 1089 * not including the \c NULL terminator, or zero (\c 0) if the object 1090 * has no comment. The value returned may be larger than \c bufsize. 1091 * Otherwise returns a negative value. 1092 * 1093 * \details H5Oget_comment_by_name() retrieves the comment for an object 1094 * in the buffer \p comment. 1095 * 1096 * The target object is specified by \p loc_id and \p name. 1097 * \p loc_id can specify any object in the file. 1098 * \p name can be one of the following: 1099 * 1100 * - The name of the object relative to \p loc_id 1101 * - An absolute name of the object, starting from \c /, the file's root group 1102 * - A dot (\c .), if \p loc_id fully specifies the object 1103 * 1104 * The size in bytes of the comment, including the \c NULL terminator, 1105 * is specified in \p bufsize. If \p bufsize is unknown, a preliminary 1106 * H5Oget_comment_by_name() call with the pointer \p comment set 1107 * to \c NULL will return the size of the comment <em>without</em> 1108 * the \c NULL terminator. 1109 * 1110 * If \p bufsize is set to a smaller value than described above, 1111 * only \p bufsize bytes of the comment, without a \c NULL terminator, 1112 * are returned in \p comment. 1113 * 1114 * If an object does not have a comment, an empty string is 1115 * returned in \p comment. 1116 * 1117 * \p lapl_id contains a link access property list identifier. A 1118 * link access property list can come into play when traversing 1119 * links to access an object. 1120 * 1121 * \version 1.8.11 Fortran subroutine introduced in this release. 1122 * 1123 * \since 1.8.0 1124 * 1125 */ 1126 H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize, 1127 hid_t lapl_id); 1128 1129 /** 1130 *------------------------------------------------------------------------- 1131 * \ingroup H5O 1132 * 1133 * \brief Recursively visits all objects accessible from a specified object 1134 * 1135 * \fgdta_loc_obj_id{obj_id} 1136 * \idx_type 1137 * \order 1138 * \param[in] op Callback function passing data regarding the object 1139 * to the calling application 1140 * \param[in] op_data User-defined pointer to data required by the application 1141 * for its processing of the object 1142 * \param[in] fields Flags specifying the fields to be retrieved to the 1143 * callback \p op 1144 * 1145 * \return On success, returns the return value of the first operator 1146 * that returns a positive value, or zero if all members were 1147 * processed with no operator returning non-zero. 1148 * 1149 * \return On failure, returns a negative value if something goes wrong 1150 * within the library, or the first negative value returned by 1151 * an operator. 1152 * 1153 * \details H5Ovisit3() is a recursive iteration function to visit the 1154 * object \p obj_id and, if \p obj_id is a group, all objects in 1155 * and below it in an HDF5 file, thus providing a mechanism for 1156 * an application to perform a common set of operations across 1157 * all of those objects or a dynamically selected subset. 1158 * For non-recursive iteration across the members of a group, 1159 * see H5Literate2(). 1160 * 1161 * If \p obj_id is a group identifier, that group serves as the 1162 * root of a recursive iteration. If \p obj_id is a file identifier, 1163 * that file's root group serves as the root of the recursive 1164 * iteration. If \p obj_id is an attribute identifier, 1165 * then the object where the attribute is attached will be iterated. 1166 * If \p obj_id is any other type of object, such as a dataset or 1167 * named datatype, there is no iteration. 1168 * 1169 * Two parameters are used to establish the iteration: \p idx_type 1170 * and \p order. 1171 * 1172 * \p idx_type specifies the index to be used. If the links in 1173 * a group have not been indexed by the index type, they will 1174 * first be sorted by that index then the iteration will begin; 1175 * if the links have been so indexed, the sorting step will be 1176 * unnecessary, so the iteration may begin more quickly. 1177 1178 * Note that the index type passed in \p idx_type is a 1179 * <em>best effort</em> setting. If the application passes in 1180 * a value indicating iteration in creation order and a group is 1181 * encountered that was not tracked in creation order, that group 1182 * will be iterated over in alphanumeric order by name, or 1183 * <em>name order</em>. (<em>Name order</em> is the native order 1184 * used by the HDF5 library and is always available.) 1185 * 1186 * \p order specifies the order in which objects are to be inspected 1187 * along the index specified in \p idx_type. 1188 * 1189 * The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data 1190 * required to process objects in the course of the iteration. This pointer 1191 * is passed back to each step of the iteration in the callback 1192 * function's \p op_data parameter. 1193 * 1194 * The \p fields parameter contains flags to determine which fields will 1195 * be retrieved by the \p op callback function. These flags are defined 1196 * in the H5Opublic.h file: 1197 * \obj_info_fields 1198 * 1199 * H5Lvisit2() and H5Ovisit3() are companion functions: one for 1200 * examining and operating on links; the other for examining 1201 * and operating on the objects that those links point to. Both 1202 * functions ensure that by the time the function completes 1203 * successfully, every link or object below the specified point 1204 * in the file has been presented to the application for whatever 1205 * processing the application requires. These functions assume 1206 * that the membership of the group being iterated over remains 1207 * unchanged through the iteration; if any of the links in the 1208 * group change during the iteration, the resulting behavior 1209 * is undefined. 1210 * 1211 * \callback_note 1212 * 1213 * \par Example 1214 * An example snippet from test/links.c: 1215 * \snippet links.c H5Ovisit3_snip 1216 * 1217 * \since 1.12.0 1218 * 1219 */ 1220 H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, 1221 void *op_data, unsigned fields); 1222 1223 /** 1224 *------------------------------------------------------------------------- 1225 * \ingroup H5O 1226 * 1227 * \brief Recursively visits all objects accessible from a specified object 1228 * 1229 * \fgdta_loc_obj_id{loc_id} 1230 * \param[in] obj_name Name of the object, generally relative to 1231 * \p loc_id, that will serve as root of the iteration 1232 * \idx_type 1233 * \order 1234 * \param[in] op Callback function passing data regarding the object 1235 * to the calling application 1236 * \param[in] op_data User-defined pointer to data required by the application 1237 * for its processing of the object 1238 * \param[in] fields Flags specifying the fields to be retrieved to the 1239 * callback function \p op 1240 * \lapl_id 1241 * 1242 * \return On success, returns the return value of the first operator 1243 * that returns a positive value, or zero if all members were 1244 * processed with no operator returning non-zero. 1245 * 1246 * \return On failure, returns a negative value if something goes wrong 1247 * within the library, or the first negative value returned by 1248 * an operator. 1249 * 1250 * \details H5Ovisit_by_name3() is a recursive iteration function to visit 1251 * the object specified by the \p loc_id / \p obj_name parameter 1252 * pair and, if that object is a group, all objects in and below it 1253 * in an HDF5 file, thus providing a mechanism for an application to 1254 * perform a common set of operations across all of those objects or 1255 * a dynamically selected subset. For non-recursive iteration across 1256 * the members of a group, see H5Literate2(). 1257 * 1258 * The object serving as the root of the iteration is specified 1259 * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies 1260 * a file or an object in a file; if \p loc_id is an attribute identifier, 1261 * the object where the attribute is attached will be used. 1262 * \p obj_name specifies either an object in the file (with an absolute 1263 * name based on the file's root group) or an object name relative 1264 * to \p loc_id. If \p loc_id fully specifies the object that is to serve 1265 * as the root of the iteration, \p obj_name should be '\c .' (a dot). 1266 * (Note that when \p loc_id fully specifies the object that is to serve 1267 * as the root of the iteration, the user may wish to consider 1268 * using H5Ovisit3() instead of H5Ovisit_by_name3().) 1269 * 1270 * Two parameters are used to establish the iteration: \p idx_type 1271 * and \p order. 1272 * 1273 * \p idx_type specifies the index to be used. If the links in 1274 * a group have not been indexed by the index type, they will 1275 * first be sorted by that index then the iteration will begin; 1276 * if the links have been so indexed, the sorting step will be 1277 * unnecessary, so the iteration may begin more quickly. 1278 * 1279 * Note that the index type passed in \p idx_type is a 1280 * <em>best effort</em> setting. If the application passes in a 1281 * value indicating iteration in creation order and a group is 1282 * encountered that was not tracked in creation order, that group 1283 * will be iterated over in alphanumeric order by name, or 1284 * <em>name order</em>. (<em>Name order</em> is the native order 1285 * used by the HDF5 library and is always available.) 1286 * 1287 * \p order specifies the order in which objects are to be inspected 1288 * along the index specified in \p idx_type. 1289 * 1290 * The H5Ovisit_by_name3() \p op_data parameter is a user-defined 1291 * pointer to the data required to process objects in the course 1292 * of the iteration. This pointer is passed back to each step of 1293 * the iteration in the callback function's \p op_data parameter. 1294 * 1295 * \p lapl_id is a link access property list. In the general case, 1296 * when default link access properties are acceptable, this can 1297 * be passed in as #H5P_DEFAULT. An example of a situation that 1298 * requires a non-default link access property list is when 1299 * the link is an external link; an external link may require 1300 * that a link prefix be set in a link access property list 1301 * (see H5Pset_elink_prefix()). 1302 * 1303 * The \p fields parameter contains flags to determine which fields will 1304 * be retrieved by the \p op callback function. These flags are defined 1305 * in the H5Opublic.h file: 1306 * \obj_info_fields 1307 * 1308 * H5Lvisit_by_name2() and H5Ovisit_by_name3() are companion 1309 * functions: one for examining and operating on links; the other 1310 * for examining and operating on the objects that those links point to. 1311 * Both functions ensure that by the time the function completes 1312 * successfully, every link or object below the specified point 1313 * in the file has been presented to the application for whatever 1314 * processing the application requires. 1315 * 1316 * \callback_note 1317 * 1318 * \par Example 1319 * An example snippet from test/links.c: 1320 * \snippet links.c H5Ovisit_by_name3_snip 1321 * 1322 * \since 1.12.0 1323 * 1324 */ 1325 H5_DLL herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 1326 H5_iter_order_t order, H5O_iterate2_t op, void *op_data, unsigned fields, 1327 hid_t lapl_id); 1328 1329 /** 1330 *------------------------------------------------------------------------- 1331 * \ingroup H5O 1332 * 1333 * \brief Closes an object in an HDF5 file 1334 * 1335 * \obj_id{object_id} 1336 * 1337 * \return \herr_t 1338 * 1339 * \details H5Oclose() closes the group, dataset, or named datatype specified by 1340 * object_id. 1341 * 1342 * This function is the companion to H5Oopen(), and has the same 1343 * effect as calling H5Gclose(), H5Dclose(), or H5Tclose(). 1344 * 1345 * H5Oclose() is not used to close a dataspace, attribute, property 1346 * list, or file. 1347 * 1348 * \version 1.8.8 Fortran subroutine introduced in this release. 1349 * 1350 * \since 1.8.0 1351 * 1352 */ 1353 H5_DLL herr_t H5Oclose(hid_t object_id); 1354 /** 1355 * -------------------------------------------------------------------------- 1356 * \ingroup ASYNC 1357 * \async_variant_of{H5Oclose} 1358 */ 1359 #ifndef H5_DOXYGEN 1360 H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, 1361 hid_t es_id); 1362 #else 1363 H5_DLL herr_t H5Oclose_async(hid_t object_id, hid_t es_id); 1364 #endif 1365 1366 /** 1367 *------------------------------------------------------------------------- 1368 * \ingroup H5O 1369 * 1370 * \brief Flushes all buffers associated with an HDF5 object to disk 1371 * 1372 * \fgdta_loc_obj_id{obj_id} 1373 * 1374 * \return \herr_t 1375 * 1376 * \details H5Oflush() causes all buffers associated with an object to be immediately 1377 * flushed to disk without removing the data from the cache. 1378 * 1379 * The object associated with \p object_id can be any named object in an 1380 * HDF5 file, including a dataset, a group, or a committed datatype. 1381 * 1382 * \warning H5Oflush doesn't work correctly with parallel. It causes an assertion 1383 * failure in metadata cache during H5Fclose(). 1384 * 1385 * \note HDF5 does not possess full control over buffering. H5Oflush() 1386 * flushes the internal HDF5 buffers and then asks the operating 1387 * system (the OS) to flush the system buffers for the open 1388 * files. After that, the OS is responsible for ensuring that 1389 * the data is actually flushed to disk. 1390 * 1391 * \see H5Dflush(), H5Drefresh(), H5Oflush(), H5Grefresh(), H5Oflush(), 1392 * H5Orefresh(), H5Tflush(), H5Trefresh() 1393 * \see H5DOappend(), H5Fstart_swmr_write(), H5Pget_append_flush(), 1394 * H5Pget_object_flush_cb(), H5Pset_append_flush(), H5Pset_object_flush_cb() 1395 * \see H5Oare_mdc_flushes_disabled(), H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes() 1396 * 1397 * \since 1.10.0 1398 * 1399 */ 1400 H5_DLL herr_t H5Oflush(hid_t obj_id); 1401 /** 1402 * -------------------------------------------------------------------------- 1403 * \ingroup ASYNC 1404 * \async_variant_of{H5Oflush} 1405 */ 1406 #ifndef H5_DOXYGEN 1407 H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, 1408 hid_t es_id); 1409 #else 1410 H5_DLL herr_t H5Oflush_async(hid_t obj_id, hid_t es_id); 1411 #endif 1412 /** 1413 *------------------------------------------------------------------------- 1414 * \ingroup H5O 1415 * 1416 * \brief Refreshes all buffers associated with an HDF5 object 1417 * 1418 * \fgdta_loc_obj_id{oid} 1419 * 1420 * \return \herr_t 1421 * 1422 * \details H5Orefresh() causes all buffers associated with an object to be cleared 1423 * and immediately re-loaded with updated contents from disk. 1424 * 1425 * This function essentially closes the object, evicts all 1426 * metadata associated with it from the cache, and then re-opens 1427 * the object. The reopened object is automatically re-registered 1428 * with the same identifier. 1429 * 1430 * The object associated with \p oid can be any named object in an 1431 * HDF5 file including a dataset, a group, or a committed datatype. 1432 * 1433 * \since 1.10.0 1434 * 1435 */ 1436 H5_DLL herr_t H5Orefresh(hid_t oid); 1437 /** 1438 * -------------------------------------------------------------------------- 1439 * \ingroup ASYNC 1440 * \async_variant_of{H5Orefresh} 1441 */ 1442 #ifndef H5_DOXYGEN 1443 H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, hid_t oid, 1444 hid_t es_id); 1445 #else 1446 H5_DLL herr_t H5Orefresh_async(hid_t oid, hid_t es_id); 1447 #endif 1448 1449 /** 1450 *------------------------------------------------------------------------- 1451 * \ingroup H5O 1452 * 1453 * \brief Prevents metadata entries for an HDF5 object from being flushed 1454 * from the metadata cache to storage 1455 * 1456 * \param[in] object_id Identifier of the object that will have flushes disabled; 1457 * may be a group, named datatype, or dataset identifier 1458 * 1459 * \return \herr_t 1460 * 1461 * \details H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes() and associated flush 1462 * functions can be used to control the flushing of entries from 1463 * a file's metadata cache. 1464 * 1465 * This function prevents an object's or cache's dirty metadata 1466 * entries from being flushed from the cache by the usual cache 1467 * eviction/flush policy. Instead, users must manually flush the 1468 * cache or entries for individual objects via the appropriate 1469 * H5Fflush(), H5Dflush(), H5Gflush(), H5Tflush(), and H5Oflush() calls. 1470 * 1471 * Metadata cache entries can be controlled at both the individual 1472 * HDF5 object level (datasets, groups, committed datatypes) 1473 * and the entire metadata cache level. 1474 * 1475 * \note HDF5 objects include datasets, groups, and committed datatypes. Only 1476 * #hid_t identifiers that represent these objects can be passed to the 1477 * function. Passing in a #hid_t identifier that represents any other 1478 * HDF5 entity is considered an error. It is an error to pass an HDF5 1479 * file identifier (obtained from H5Fopen() or H5Fcreate()) to this 1480 * function. Misuse of this function can cause the cache to exhaust 1481 * available memory. Objects can be returned to the default automatic 1482 * flush behavior with H5Oenable_mdc_flushes(). Flush prevention only 1483 * pertains to new or dirty metadata entries. Clean entries can be 1484 * evicted from the cache. Calling this function on an object that has 1485 * already had flushes disabled will return an error. 1486 * 1487 * \since 1.10.0 1488 * 1489 */ 1490 H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); 1491 1492 /** 1493 *------------------------------------------------------------------------- 1494 * \ingroup H5O 1495 * 1496 * \brief Enables flushing of dirty metadata entries from a file's metadata cache 1497 * 1498 * \param[in] object_id Identifier of the object that will have flushes re-enabled; 1499 * may be a group, named datatype, or dataset identifier 1500 * 1501 * \return \herr_t 1502 * 1503 * \details H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() 1504 * and associated flush functions can be used to control the flushing 1505 * of entries from a file's metadata cache. 1506 * 1507 * This function allows an object or cache's dirty metadata entries to be 1508 * flushed from the cache by the usual cache eviction/flush policy. 1509 * 1510 * Metadata cache entries can be controlled at both the individual HDF5 1511 * object level (datasets, groups, committed datatypes) and the entire 1512 * metadata cache level. 1513 * 1514 * 1515 * \note HDF5 objects include datasets, groups, and committed datatypes. Only 1516 * #hid_t identifiers that represent these objects can be passed to the 1517 * function. Passing in a #hid_t identifier that represents any other 1518 * HDF5 entity is considered an error. It is an error to pass an HDF5 1519 * file identifier (obtained from H5Fopen() or H5Fcreate()) to this 1520 * function. Using this function on an object that has not had flushes 1521 * disabled is considered an error. The state of an object can be 1522 * determined with H5Oare_mdc_flushes_disabled(). An object will be 1523 * returned to the default flush algorithm when it is closed. All objects 1524 * will be returned to the default flush algorithm when the file is 1525 * closed. An object's entries will not necessarily be flushed as a 1526 * result of calling this function. 1527 * 1528 * \since 1.10.0 1529 * 1530 */ 1531 H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); 1532 1533 /** 1534 *------------------------------------------------------------------------- 1535 * \ingroup H5O 1536 * 1537 * \brief Retrieves comment for specified object 1538 * 1539 * \param[in] object_id Identifier of an object in the cache; 1540 * may be a group, named datatype, or dataset identifier 1541 * \param[out] are_disabled Flushes enabled/disabled 1542 * 1543 * \return \p are_disabled will be set to \c 1 if an object has had flushes disabled 1544 * and \c 0 if it has not had flushes disabled. 1545 * \return \herr_t 1546 * 1547 * \details H5Oare_mdc_flushes_disabled() determines if an HDF5 object (dataset, group, committed 1548 * datatype) has had flushes of metadata entries disabled. 1549 * 1550 * The H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() and 1551 * associated flush functions can be used to control the flushing of 1552 * entries from a file's metadata cache. Metadata cache entries can be controlled 1553 * at both the individual HDF5 object level (datasets, groups, 1554 * committed datatypes) and the entire metadata cache level. 1555 * 1556 * \note HDF5 objects include datasets, groups, and committed datatypes. 1557 * Only #hid_t identifiers that represent these objects can be passed to the function. 1558 * \note Passing in a #hid_t identifier that represents any other HDF5 entity is 1559 * considered an error. 1560 * \note It is an error to pass an HDF5 file identifier 1561 * (obtained from H5Fopen() or H5Fcreate()) to this function. 1562 * 1563 * \since 1.10.0 1564 * 1565 */ 1566 H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled); 1567 1568 /** 1569 *------------------------------------------------------------------------- 1570 * \ingroup H5O 1571 * 1572 * \brief Compares two VOL connector object tokens 1573 * 1574 * \fgdta_loc_obj_id{loc_id} 1575 * \param[in] token1 First object token 1576 * \param[in] token2 Second object token 1577 * \param[out] cmp_value Comparison value 1578 * 1579 * \return \herr_t 1580 * 1581 * \details H5Otoken_cmp() compares two VOL connector object tokens, \p token1 1582 * and \p token2 for the file or group identifier specified by \p loc_id. 1583 * Both object tokens must be from the same VOL connector class. 1584 * 1585 * H5O_token_t is defined in H5public.h as follows: 1586 * \snippet H5public.h H5O_token_t_snip 1587 * 1588 * A comparison value, \p cmp_value, is returned, which indicates the 1589 * result of the comparison: 1590 * 1591 * <table> 1592 * <tr> 1593 * <th>cmp_value</th> 1594 * <th>Result</th> 1595 * </tr> 1596 * <tr> 1597 * <td> > 0</td> 1598 * <td> \p token1 > \p token2</td> 1599 * </tr> 1600 * <tr> 1601 * <td> < 0</td> 1602 * <td>\p token1 < \p token2</td> 1603 * </tr> 1604 * <tr> 1605 * <td>0</td> 1606 * <td>\p token1 = \p token2</td> 1607 * </tr> 1608 * </table> 1609 * 1610 * \par Example 1611 * An example snippet from test/links.c: 1612 * \snippet links.c H5Otoken_cmp_snip 1613 * 1614 * \since 1.12.0 1615 * 1616 */ 1617 H5_DLL herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, 1618 int *cmp_value); 1619 1620 /** 1621 *------------------------------------------------------------------------- 1622 * \ingroup H5O 1623 * 1624 * \brief Serializes a connector's object token into a string 1625 * 1626 * \fgdta_loc_obj_id{loc_id} 1627 * \param[in] token Connector object token 1628 * \param[out] token_str String for connector object token \p token 1629 * 1630 * \return \herr_t 1631 * 1632 * \details H5Otoken_to_str() serializes a connector's object token specified by 1633 * \p token and the location identifier for the object, \p loc_id, 1634 * into a string, \p token_str. 1635 * 1636 * \since 1.12.0 1637 * 1638 */ 1639 H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str); 1640 1641 /** 1642 *------------------------------------------------------------------------- 1643 * \ingroup H5O 1644 * 1645 * \brief Deserializes a string into a connector object token 1646 * 1647 * \fgdta_loc_obj_id{loc_id} 1648 * \param[in] token_str Object token string 1649 * \param[out] token Connector object token 1650 * 1651 * \return \herr_t 1652 * 1653 * \details H5Otoken_from_str() deserializes a string, \p token_str, into a 1654 * connector object token, \p token, for the object specified by the 1655 * location identifier, \p loc_id. 1656 * 1657 * \since 1.12.0 1658 * 1659 */ 1660 H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token); 1661 1662 /// \cond DEV 1663 /* API Wrappers for async routines */ 1664 /* (Must be defined _after_ the function prototype) */ 1665 /* (And must only defined when included in application code, not the library) */ 1666 #ifndef H5O_MODULE 1667 #define H5Oopen_async(...) H5Oopen_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1668 #define H5Oopen_by_idx_async(...) H5Oopen_by_idx_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1669 #define H5Oget_info_by_name_async(...) H5Oget_info_by_name_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1670 #define H5Oclose_async(...) H5Oclose_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1671 #define H5Oflush_async(...) H5Oflush_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1672 #define H5Orefresh_async(...) H5Orefresh_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1673 #define H5Ocopy_async(...) H5Ocopy_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1674 1675 /* Define "wrapper" versions of function calls, to allow compile-time values to 1676 * be passed in by language wrapper or library layer on top of HDF5. 1677 */ 1678 #define H5Oopen_async_wrap H5_NO_EXPAND(H5Oopen_async) 1679 #define H5Oopen_by_idx_async_wrap H5_NO_EXPAND(H5Oopen_by_idx_async) 1680 #define H5Oget_info_by_name_async_wrap H5_NO_EXPAND(H5Oget_info_by_name_async) 1681 #define H5Oclose_async_wrap H5_NO_EXPAND(H5Oclose_async) 1682 #define H5Oflush_async_wrap H5_NO_EXPAND(H5Oflush_async) 1683 #define H5Orefresh_async_wrap H5_NO_EXPAND(H5Orefresh_async) 1684 #define H5Ocopy_async_wrap H5_NO_EXPAND(H5Ocopy_async) 1685 #endif 1686 /// \endcond 1687 1688 /* The canonical 'undefined' token value */ 1689 #define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g) 1690 H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g; 1691 1692 /* Symbols defined for compatibility with previous versions of the HDF5 API. 1693 * 1694 * Use of these symbols is deprecated. 1695 */ 1696 #ifndef H5_NO_DEPRECATED_SYMBOLS 1697 1698 /* Macros */ 1699 1700 /* Deprecated flags for earlier versions of H5Oget_info* */ 1701 #define H5O_INFO_HDR 0x0008u /**< Fill in the hdr field */ 1702 #define H5O_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field */ 1703 #undef H5O_INFO_ALL 1704 #define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE) 1705 1706 /* Typedefs */ 1707 1708 //! <!-- [H5O_stat_t_snip] --> 1709 /** 1710 * A struct that's part of the \ref H5G_stat_t structure 1711 * \deprecated 1712 */ 1713 typedef struct H5O_stat_t { 1714 hsize_t size; /**< Total size of object header in file */ 1715 hsize_t free; /**< Free space within object header */ 1716 unsigned nmesgs; /**< Number of object header messages */ 1717 unsigned nchunks; /**< Number of object header chunks */ 1718 } H5O_stat_t; 1719 //! <!-- [H5O_stat_t_snip] --> 1720 1721 //! <!-- [H5O_info1_t_snip] --> 1722 /** 1723 * Information struct for object (For H5Oget_info(), H5Oget_info_by_name(), 1724 * H5Oget_info_by_idx() versions 1 & 2.) 1725 */ 1726 typedef struct H5O_info1_t { 1727 unsigned long 1728 fileno; /**< File number that object is located in. Constant across multiple opens of the same file */ 1729 haddr_t addr; /**< Object address in file */ 1730 H5O_type_t type; /**< Basic object type (group, dataset, etc.) */ 1731 unsigned rc; /**< Reference count of object */ 1732 time_t atime; /**< Access time */ 1733 time_t mtime; /**< Modification time */ 1734 time_t ctime; /**< Change time */ 1735 time_t btime; /**< Birth time */ 1736 hsize_t num_attrs; /**< Number of attributes attached to object */ 1737 H5O_hdr_info_t hdr; /**< Object header information */ 1738 /* Extra metadata storage for obj & attributes */ 1739 struct { 1740 H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ 1741 H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */ 1742 } meta_size; 1743 } H5O_info1_t; 1744 //! <!-- [H5O_info1_t_snip] --> 1745 1746 //! <!-- [H5O_iterate1_t_snip] --> 1747 /** 1748 * Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2) 1749 * 1750 * \param[in] obj Object that serves as the root of the iteration; 1751 * the same value as the H5Ovisit1() \c obj_id parameter 1752 * \param[in] name Name of object, relative to \p obj, being examined at current 1753 * step of the iteration 1754 * \param[out] info Information about that object 1755 * \param[in,out] op_data User-defined pointer to data required by the application 1756 * in processing the object 1757 * \return \herr_t_iter 1758 * 1759 * \since 1.8.0 1760 * 1761 */ 1762 typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data); 1763 //! <!-- [H5O_iterate1_t_snip] --> 1764 1765 /* Function prototypes */ 1766 1767 /** 1768 *------------------------------------------------------------------------- 1769 * \ingroup H5O 1770 * 1771 * \brief Opens an object using its address within an HDF5 file. 1772 * 1773 * \fgdta_loc_obj_id{loc_id} 1774 * \param[in] addr Object's address in the file 1775 * 1776 * \return \hid_ti{object} 1777 * 1778 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1779 * the function H5Oopen_by_token(). 1780 * 1781 * \details H5Oopen_by_addr() opens a group, dataset, or committed (named) datatype using its 1782 * address within an HDF5 file, \p addr. The resulting opened object is identical to 1783 * an object opened with H5Oopen() and should be closed with H5Oclose() or an 1784 * object-type-specific closing function (such as H5Gclose()) when no longer needed. 1785 * 1786 * \p loc_id is a location identifier in the file. 1787 * 1788 * The object's address within the file, \p addr, is the byte offset of the first byte 1789 * of the object header from the beginning of the HDF5 file space, i.e., from the 1790 * beginning of the superblock (see the “HDF5 Storage Model” section of the The 1791 * HDF5 Data Model and File Structure chapter of the <em>HDF5 User's Guide</em>.) 1792 * 1793 * \p addr can be obtained via either of two function calls. H5Gget_objinfo() returns 1794 * the object's address in the \c objno field of the H5G_stat_t \c struct; 1795 * H5Lget_info() returns the address in the \c address field of the #H5L_info_t \c struct. 1796 * 1797 * The address of the HDF5 file on a physical device has no effect on H5Oopen_by_addr(), 1798 * nor does the use of any file driver. As stated above, the object address is its 1799 * offset within the HDF5 file; HDF5's file drivers will transparently map this to an 1800 * address on a storage device. 1801 * 1802 * \warning This function must be used with care! 1803 * \warning Improper use can lead to inaccessible data, wasted space in the file, 1804 * or <b><em>file corruption</em></b>. 1805 * \warning This function is dangerous if called on an invalid address. The risk can be safely 1806 * overcome by retrieving the object address with H5Gget_objinfo() or H5Lget_info() 1807 * immediately before calling H5Oopen_by_addr(). The immediacy of the operation can be 1808 * important; if time has elapsed and the object has been deleted from the file, 1809 * the address will be invalid, and file corruption can result. 1810 * 1811 * \version 1.8.4 Fortran subroutine added in this release. 1812 * 1813 * \since 1.8.0 1814 * 1815 */ 1816 H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); 1817 1818 /** 1819 *------------------------------------------------------------------------- 1820 * \ingroup H5O 1821 * 1822 * \brief Retrieves the metadata for an object specified by an identifier 1823 * 1824 * \fgdta_loc_obj_id{loc_id} 1825 * \param[out] oinfo Buffer in which to return object information 1826 * 1827 * \return \herr_t 1828 * 1829 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1830 * the function H5Oget_info3() or the macro #H5Oget_info. 1831 * 1832 * \details H5Oget_info1() specifies an object by its identifier, \p loc_id , and 1833 * retrieves the metadata describing that object in \p oinfo. 1834 * 1835 * \note If you are iterating through a lot of different objects to 1836 * retrieve information via the H5Oget_info() family of routines, 1837 * you may see memory building up. This can be due to memory 1838 * allocation for metadata, such as object headers and messages, 1839 * when the iterated objects are put into the metadata cache. 1840 * \note 1841 * If the memory buildup is not desirable, you can configure a 1842 * smaller cache via H5Fset_mdc_config() or set the file access 1843 * property list via H5Pset_mdc_config(). A smaller sized cache 1844 * will force metadata entries to be evicted from the cache, 1845 * thus freeing the memory associated with the entries. 1846 * 1847 * \version 1.10.5 The macro #H5Oget_info was removed and the function 1848 * H5Oget_info1() was copied to H5Oget_info(). 1849 * \version 1.10.3 Function H5Oget_info() was copied to H5Oget_info1(), 1850 * and the macro #H5Oget_info was created. 1851 * \version 1.8.15 Added a note about the valid values for the \c version 1852 * field in the H5O_hdr_info_t structure. 1853 * \version 1.8.11 Fortran subroutine introduced in this release. 1854 * \version 1.8.10 Added #H5O_type_t structure to the Description section. \n 1855 * Separated H5O_hdr_info_t structure from #H5O_info_t in the 1856 * Description section. \n 1857 * Clarified the definition and implementation of the time fields. 1858 * 1859 * \since 1.8.0 1860 * 1861 */ 1862 H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo); 1863 1864 /** 1865 *------------------------------------------------------------------------- 1866 * \ingroup H5O 1867 * 1868 * \brief Retrieves the metadata for an object, identifying the object 1869 * by location and relative name 1870 * 1871 * \fgdta_loc_obj_id{loc_id} 1872 * \param[in] name Name of object, relative to \p loc_id 1873 * \param[out] oinfo Buffer in which to return object information 1874 * \lapl_id 1875 * 1876 * \return \herr_t 1877 * 1878 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1879 * the function H5Oget_info_by_name2() or the macro #H5Oget_info_by_name. 1880 * 1881 * \details H5Oget_info_by_name1() specifies an object's location and name, \p loc_id 1882 * and \p name, respectively, and retrieves the metadata describing that object 1883 * in \p oinfo, an H5O_info1_t \c struct. 1884 * 1885 * The \c struct H5O_info1_t is defined in H5Opublic.h and described 1886 * in the H5Oget_info1() function entry. 1887 * 1888 * The link access property list, \p lapl_id, is not currently used; 1889 * it should be passed in as #H5P_DEFAULT. 1890 * 1891 * \version 1.10.5 The macro #H5Oget_info_by_name was removed and the function 1892 * H5Oget_info_by_name1() was copied to H5Oget_info_by_name(). 1893 * \version 1.10.3 Function H5Oget_info_by_name() was copied to H5Oget_info_by_name1() 1894 * and the macro #H5Oget_info_by_name was created. 1895 * \version 1.8.8 Fortran 2003 subroutine and \c h5o_info_t derived type introduced 1896 * in this release. 1897 * 1898 * \since 1.8.0 1899 * 1900 */ 1901 H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo, hid_t lapl_id); 1902 1903 /** 1904 *------------------------------------------------------------------------- 1905 * \ingroup H5O 1906 * 1907 * \brief Retrieves the metadata for an object, identifying the object 1908 * by an index position 1909 * 1910 * \fgdta_loc_obj_id{loc_id} 1911 * \param[in] group_name Name of group in which object is located 1912 * \idx_type 1913 * \order 1914 * \param[in] n Position within the index 1915 * \param[out] oinfo Buffer in which to return object information 1916 * \lapl_id 1917 * 1918 * \return \herr_t 1919 * 1920 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1921 * the function H5Oget_info_by_idx3() or the macro H5Oget_info_by_idx(). 1922 * 1923 * \details H5Oget_info_by_idx1() retrieves the metadata describing an 1924 * object in the \c struct \p oinfo, as specified by the location, 1925 * \p loc_id, group name, \p group_name, the index by which objects 1926 * in that group are tracked, \p idx_type, the order by which the 1927 * index is to be traversed, \p order, and an object's position 1928 * \p n within that index. 1929 * 1930 * If \p loc_id fully specifies the group in which the object resides, 1931 * \p group_name can be a dot (\c .). 1932 * 1933 * The link access property list, \c lapl_id, is not currently used; 1934 * it should be passed in as #H5P_DEFAULT. 1935 * 1936 * \version 1.10.5 The macro #H5Oget_info_by_idx was removed and the function 1937 * H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1(). 1938 * \version 1.10.3 Function H5Oget_info_by_idx() was copied to H5Oget_info_by_idx1() 1939 * and the macro #H5Oget_info_by_idx was created. 1940 * \version 1.8.11 Fortran subroutine introduced in this release. 1941 * 1942 * \since 1.8.0 1943 * 1944 */ 1945 H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1946 H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, hid_t lapl_id); 1947 1948 /** 1949 *------------------------------------------------------------------------- 1950 * \ingroup H5O 1951 * 1952 * \brief Retrieves the metadata for an object specified by an identifier 1953 * 1954 * \fgdta_loc_obj_id{loc_id} 1955 * \param[out] oinfo Buffer in which to return object information 1956 * \param[in] fields Flags specifying the fields to include in \p oinfo 1957 * 1958 * \return \herr_t 1959 * 1960 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1961 * the function H5Oget_info3() or the macro H5Oget_info(). 1962 * 1963 * \details H5Oget_info2() specifies an object by its identifier, \p loc_id , and 1964 * retrieves the metadata describing that object in \p oinfo , an H5O_info1_t \c struct. 1965 * This \c struct type is described in H5Oget_info1(). 1966 * 1967 * The \p fields parameter contains flags to determine which fields will be filled in 1968 * the H5O_info1_t \c struct returned in \p oinfo. 1969 * These flags are defined in the H5Opublic.h file: 1970 * 1971 * \obj_info_fields 1972 * 1973 * \note If you are iterating through a lot of different objects to 1974 * retrieve information via the H5Oget_info() family of routines, 1975 * you may see memory building up. This can be due to memory 1976 * allocation for metadata, such as object headers and messages, 1977 * when the iterated objects are put into the metadata cache. 1978 * \note 1979 * If the memory buildup is not desirable, you can configure a 1980 * smaller cache via H5Fset_mdc_config() or set the file access 1981 * property list via H5Pset_mdc_config(). A smaller sized cache 1982 * will force metadata entries to be evicted from the cache, 1983 * thus freeing the memory associated with the entries. 1984 * 1985 * \since 1.10.3 1986 * 1987 */ 1988 H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields); 1989 1990 /** 1991 *------------------------------------------------------------------------- 1992 * \ingroup H5O 1993 * 1994 * \brief Retrieves the metadata for an object, identifying the object 1995 * by location and relative name 1996 * 1997 * \fgdta_loc_obj_id{loc_id} 1998 * \param[in] name Name of object, relative to \p loc_id 1999 * \param[out] oinfo Buffer in which to return object information 2000 * \param[in] fields Flags specifying the fields to include in \p oinfo 2001 * \lapl_id 2002 * 2003 * \return \herr_t 2004 * 2005 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 2006 * the function H5Oget_info_by_name3() or the macro H5Oget_info_by_name(). 2007 * 2008 * \details H5Oget_info_by_name2() specifies an object's location and name, \p loc_id and 2009 * \p name, respectively, and retrieves the metadata describing 2010 * that object in \p oinfo, an H5O_info1_t \c struct. 2011 * 2012 * The \c struct H5O_info1_t is defined in H5Opublic.h and described 2013 * in the H5Oget_info1() function entry. 2014 * 2015 * The \p fields parameter contains flags to determine which fields 2016 * will be filled in the H5O_info1_t \c struct returned in 2017 * \p oinfo. These flags are defined in the H5Opublic.h file: 2018 * 2019 * \obj_info_fields 2020 * 2021 * The link access property list, \p lapl_id, is not currently used; 2022 * it should be passed in as #H5P_DEFAULT. 2023 * 2024 * \since 1.10.3 2025 * 2026 */ 2027 H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo, unsigned fields, 2028 hid_t lapl_id); 2029 2030 /** 2031 *------------------------------------------------------------------------- 2032 * \ingroup H5O 2033 * 2034 * \brief Retrieves the metadata for an object, identifying the object 2035 * by an index position 2036 * 2037 * \fgdta_loc_obj_id{loc_id} 2038 * \param[in] group_name Name of group in which object is located 2039 * \idx_type 2040 * \order 2041 * \param[in] n Position within the index 2042 * \param[out] oinfo Buffer in which to return object information 2043 * \param[in] fields Flags specifying the fields to include in \p oinfo 2044 * \lapl_id 2045 * 2046 * \return \herr_t 2047 * 2048 * \deprecated As of HDF5-1.12 this function is deprecated in favor of 2049 * the function H5Oget_info_by_idx3() or the macro #H5Oget_info_by_idx. 2050 * 2051 * \details H5Oget_info_by_idx2() retrieves the metadata describing an 2052 * object in the \c struct \p oinfo, as specified by the location, 2053 * \p loc_id, group name, \p group_name, the index by which objects 2054 * in that group are tracked, \p idx_type, the order by which the 2055 * index is to be traversed, \p order, and an object's position 2056 * \p n within that index. 2057 * 2058 * \p oinfo, in which the object information is returned, is a \c struct of 2059 * type H5O_info1_t. This and other \c struct types used 2060 * by H5Oget_info_by_idx2() are described in H5Oget_info_by_idx1(). 2061 * 2062 * If \p loc_id fully specifies the group in which the object resides, 2063 * i\p group_name can be a dot (\c .). 2064 * 2065 * The \p fields parameter contains flags to determine which fields will be 2066 * filled in the H5O_info1_t \c struct returned in \p oinfo. 2067 * These flags are defined in the H5Opublic.h file: 2068 * \obj_info_fields 2069 * 2070 * The link access property list, \c lapl_id, is not currently used; 2071 * it should be passed in as #H5P_DEFAULT. 2072 * 2073 * \since 1.10.3 2074 * 2075 */ 2076 H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, 2077 H5_iter_order_t order, hsize_t n, H5O_info1_t *oinfo, unsigned fields, 2078 hid_t lapl_id); 2079 2080 /** 2081 *------------------------------------------------------------------------- 2082 * \ingroup H5O 2083 * 2084 * \brief Recursively visits all objects accessible from a specified object 2085 * 2086 * \fgdta_loc_obj_id{obj_id} 2087 * \idx_type 2088 * \order 2089 * \param[in] op Callback function passing data regarding the object 2090 * to the calling application 2091 * \param[in] op_data User-defined pointer to data required by the application 2092 * for its processing of the object 2093 * 2094 * \return On success, returns the return value of the first operator 2095 * that returns a positive value, or zero if all members were 2096 * processed with no operator returning non-zero. 2097 * 2098 * \return On failure, returns a negative value if something goes wrong 2099 * within the library, or the first negative value returned by 2100 * an operator. 2101 * 2102 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 2103 * the function H5Ovisit3() or the macro #H5Ovisit. 2104 * 2105 * \details H5Ovisit1() is a recursive iteration function to visit the 2106 * object \p obj_id and, if \p obj_id is a group, all objects in 2107 * and below it in an HDF5 file, thus providing a mechanism for 2108 * an application to perform a common set of operations across all 2109 * of those objects or a dynamically selected subset. For 2110 * non-recursive iteration across the members of a group, 2111 * see H5Literate1(). 2112 * 2113 * If \p obj_id is a group identifier, that group serves as the 2114 * root of a recursive iteration. If \p obj_id is a file identifier, 2115 * that file's root group serves as the root of the recursive 2116 * iteration. If \p obj_id is an attribute identifier, 2117 * then the object where the attribute is attached will be iterated. 2118 * If \p obj_id is any other type of object, such as a dataset or 2119 * named datatype, there is no iteration. 2120 * 2121 * Two parameters are used to establish the iteration: \p idx_type 2122 * and \p order. 2123 * 2124 * \p idx_type specifies the index to be used. If the links in 2125 * a group have not been indexed by the index type, they will 2126 * first be sorted by that index then the iteration will begin; 2127 * if the links have been so indexed, the sorting step will be 2128 * unnecessary, so the iteration may begin more quickly. 2129 * 2130 * Note that the index type passed in \p idx_type is a 2131 * <em>best effort</em> setting. If the application passes in 2132 * a value indicating iteration in creation order and a group is 2133 * encountered that was not tracked in creation order, that group 2134 * will be iterated over in alphanumeric order by name, or 2135 * <em>name order</em>. (<em>Name order</em> is the native order 2136 * used by the HDF5 library and is always available.) 2137 * 2138 * \p order specifies the order in which objects are to be inspected 2139 * along the index specified in \p idx_type. 2140 * 2141 * H5Lvisit1() and H5Ovisit1() are companion functions: one for 2142 * examining and operating on links; the other for examining 2143 * and operating on the objects that those links point to. Both 2144 * functions ensure that by the time the function completes 2145 * successfully, every link or object below the specified point 2146 * in the file has been presented to the application for whatever 2147 * processing the application requires. These functions assume 2148 * that the membership of the group being iterated over remains 2149 * unchanged through the iteration; if any of the links in the 2150 * group change during the iteration, the resulting behavior 2151 * is undefined. 2152 * 2153 * \version 1.10.5 The macro #H5Ovisit was removed and the function 2154 * H5Ovisit1() was copied to H5Ovisit(). 2155 * \version 1.10.3 Function H5Ovisit() was copied to H5Ovisit1(), 2156 * and the macro #H5Ovisit was created. 2157 * \version 1.8.8 Fortran subroutine introduced in this release. 2158 * 2159 * \since 1.8.0 2160 * 2161 */ 2162 H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, 2163 void *op_data); 2164 2165 /** 2166 *------------------------------------------------------------------------- 2167 * \ingroup H5O 2168 * 2169 * \brief Recursively visits all objects starting from a specified object 2170 * 2171 * \fgdta_loc_obj_id{loc_id} 2172 * \param[in] obj_name Name of the object, generally relative to 2173 * \p loc_id, that will serve as root of the iteration 2174 * \idx_type 2175 * \order 2176 * \param[in] op Callback function passing data regarding the object 2177 * to the calling application 2178 * \param[in] op_data User-defined pointer to data required by the application 2179 * for its processing of the object 2180 * \lapl_id 2181 * 2182 * \return On success, returns the return value of the first operator 2183 * that returns a positive value, or zero if all members were 2184 * processed with no operator returning non-zero. 2185 * 2186 * \return On failure, returns a negative value if something goes wrong 2187 * within the library, or the first negative value returned by 2188 * an operator. 2189 * 2190 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 2191 * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name. 2192 * 2193 * \details H5Ovisit_by_name1() is a recursive iteration function to visit 2194 * the object specified by the \p loc_id / \p obj_name parameter 2195 * pair and, if that object is a group, all objects in and below it 2196 * in an HDF5 file, thus providing a mechanism for an application to 2197 * perform a common set of operations across all of those objects or 2198 * a dynamically selected subset. For non-recursive iteration across 2199 * the members of a group, see H5Literate1(). 2200 * 2201 * The object serving as the root of the iteration is specified 2202 * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies 2203 * a file or an object in a file; if \p loc_id is an attribute identifier, 2204 * the object where the attribute is attached will be used. 2205 * \p obj_name specifies either an object in the file (with an absolute 2206 * name based on the file's root group) or an object name relative 2207 * to \p loc_id. If \p loc_id fully specifies the object that is to serve 2208 * as the root of the iteration, \p obj_name should be '\c .' (a dot). 2209 * (Note that when \p loc_id fully specifies the object that is to serve 2210 * as the root of the iteration, the user may wish to consider 2211 * using H5Ovisit1() instead of H5Ovisit_by_name1().) 2212 * 2213 * Two parameters are used to establish the iteration: \p idx_type 2214 * and \p order. 2215 * 2216 * \p idx_type specifies the index to be used. If the links in 2217 * a group have not been indexed by the index type, they will 2218 * first be sorted by that index then the iteration will begin; 2219 * if the links have been so indexed, the sorting step will be 2220 * unnecessary, so the iteration may begin more quickly. 2221 * 2222 * Note that the index type passed in \p idx_type is a 2223 * <em>best effort</em> setting. If the application passes in a 2224 * value indicating iteration in creation order and a group is 2225 * encountered that was not tracked in creation order, that group 2226 * will be iterated over in alphanumeric order by name, or 2227 * <em>name order</em>. (<em>Name order</em> is the native order 2228 * used by the HDF5 library and is always available.) 2229 * 2230 * \p order specifies the order in which objects are to be inspected 2231 * along the index specified in \p idx_type. 2232 * 2233 * The \p op callback function and the effect of the callback 2234 * function's return value on the application are described 2235 * in H5Ovisit1(). 2236 * 2237 * The H5O_info1_t \c struct is defined in H5Opublic.h 2238 * and described in the H5Oget_info1() function entry. 2239 * 2240 * The H5Ovisit_by_name1() \p op_data parameter is a user-defined 2241 * pointer to the data required to process objects in the course 2242 * of the iteration. This pointer is passed back to each step of 2243 * the iteration in the callback function's \p op_data parameter. 2244 * 2245 * \p lapl_id is a link access property list. In the general case, 2246 * when default link access properties are acceptable, this can 2247 * be passed in as #H5P_DEFAULT. An example of a situation that 2248 * requires a non-default link access property list is when 2249 * the link is an external link; an external link may require 2250 * that a link prefix be set in a link access property list 2251 * (see H5Pset_elink_prefix()). 2252 * 2253 * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion 2254 * functions: one for examining and operating on links; the other 2255 * for examining and operating on the objects that those links point to. 2256 * Both functions ensure that by the time the function completes 2257 * successfully, every link or object below the specified point 2258 * in the file has been presented to the application for whatever 2259 * processing the application requires. 2260 * 2261 * \callback_note 2262 * 2263 * \version 1.10.5 The macro #H5Ovisit_by_name was removed and the function 2264 * H5Ovisit_by_name1() was copied to #H5Ovisit_by_name. 2265 * \version 1.10.3 The H5Ovisit_by_name() function was renamed to H5Ovisit_by_name1(), 2266 * and the macro #H5Ovisit_by_name was created. 2267 * \version 1.8.11 Fortran subroutine introduced in this release. 2268 * 2269 * \since 1.8.0 2270 * 2271 */ 2272 H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 2273 H5_iter_order_t order, H5O_iterate1_t op, void *op_data, hid_t lapl_id); 2274 2275 /** 2276 *------------------------------------------------------------------------- 2277 * \ingroup H5O 2278 * 2279 * \brief Recursively visits all objects accessible from a specified object 2280 * 2281 * \fgdta_loc_obj_id{obj_id} 2282 * \idx_type 2283 * \order 2284 * \param[in] op Callback function passing data regarding the object 2285 * to the calling application 2286 * \param[in] op_data User-defined pointer to data required by the application 2287 * for its processing of the object 2288 * \param[in] fields Flags specifying the fields to be retrieved to the 2289 * callback \p op 2290 * 2291 * \return On success, returns the return value of the first operator 2292 * that returns a positive value, or zero if all members were 2293 * processed with no operator returning non-zero. 2294 * 2295 * \return On failure, returns a negative value if something goes wrong 2296 * within the library, or the first negative value returned by 2297 * an operator. 2298 * 2299 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 2300 * the function H5Ovisit3() or the macro #H5Ovisit. 2301 * 2302 * \details H5Ovisit2() is a recursive iteration function to visit the 2303 * object \p obj_id and, if \p obj_id is a group, all objects in 2304 * and below it in an HDF5 file, thus providing a mechanism for 2305 * an application to perform a common set of operations across all 2306 * of those objects or a dynamically selected subset. For 2307 * non-recursive iteration across the members of a group, 2308 * see H5Literate1(). 2309 * 2310 * If \p obj_id is a group identifier, that group serves as the 2311 * root of a recursive iteration. If \p obj_id is a file identifier, 2312 * that file's root group serves as the root of the recursive 2313 * iteration. If \p obj_id is an attribute identifier, 2314 * then the object where the attribute is attached will be iterated. 2315 * If \p obj_id is any other type of object, such as a dataset or 2316 * named datatype, there is no iteration. 2317 * 2318 * Two parameters are used to establish the iteration: \p idx_type 2319 * and \p order. 2320 * 2321 * \p idx_type specifies the index to be used. If the links in 2322 * a group have not been indexed by the index type, they will 2323 * first be sorted by that index then the iteration will begin; 2324 * if the links have been so indexed, the sorting step will be 2325 * unnecessary, so the iteration may begin more quickly. 2326 * 2327 * Note that the index type passed in \p idx_type is a 2328 * <em>best effort</em> setting. If the application passes in 2329 * a value indicating iteration in creation order and a group is 2330 * encountered that was not tracked in creation order, that group 2331 * will be iterated over in alphanumeric order by name, or 2332 * <em>name order</em>. (<em>Name order</em> is the native order 2333 * used by the HDF5 library and is always available.) 2334 * 2335 * \p order specifies the order in which objects are to be inspected 2336 * along the index specified in \p idx_type. 2337 * 2338 * The \p fields parameter contains flags to determine which fields will 2339 * be retrieved by the \p op callback function. These flags are defined 2340 * in the H5Opublic.h file: 2341 * \obj_info_fields 2342 * 2343 * H5Lvisit() and H5Ovisit() are companion functions: one for 2344 * examining and operating on links; the other for examining 2345 * and operating on the objects that those links point to. Both 2346 * functions ensure that by the time the function completes 2347 * successfully, every link or object below the specified point 2348 * in the file has been presented to the application for whatever 2349 * processing the application requires. These functions assume 2350 * that the membership of the group being iterated over remains 2351 * unchanged through the iteration; if any of the links in the 2352 * group change during the iteration, the resulting behavior 2353 * is undefined. 2354 * 2355 * \callback_note 2356 * 2357 * \since 1.10.3 2358 * 2359 */ 2360 H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, 2361 void *op_data, unsigned fields); 2362 2363 /** 2364 *------------------------------------------------------------------------- 2365 * \ingroup H5O 2366 * 2367 * \brief Recursively visits all objects starting from a specified object 2368 * 2369 * \fgdta_loc_obj_id{loc_id} 2370 * \param[in] obj_name Name of the object, generally relative to 2371 * \p loc_id, that will serve as root of the iteration 2372 * \idx_type 2373 * \order 2374 * \param[in] op Callback function passing data regarding the object 2375 * to the calling application 2376 * \param[in] op_data User-defined pointer to data required by the application 2377 * for its processing of the object 2378 * \param[in] fields Flags specifying the fields to be retrieved to the 2379 * callback function \p op 2380 * \lapl_id 2381 * 2382 * \return On success, returns the return value of the first operator 2383 * that returns a positive value, or zero if all members were 2384 * processed with no operator returning non-zero. 2385 * 2386 * \return On failure, returns a negative value if something goes wrong 2387 * within the library, or the first negative value returned by 2388 * an operator. 2389 * 2390 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 2391 * the function H5Ovisit_by_name3() or the macro #H5Ovisit_by_name. 2392 * 2393 * \details H5Ovisit_by_name2() is a recursive iteration function to visit 2394 * the object specified by the \p loc_id / \p obj_name parameter 2395 * pair and, if that object is a group, all objects in and below it 2396 * in an HDF5 file, thus providing a mechanism for an application to 2397 * perform a common set of operations across all of those objects or 2398 * a dynamically selected subset. For non-recursive iteration across 2399 * the members of a group, see #H5Literate. 2400 * 2401 * The object serving as the root of the iteration is specified 2402 * by the \p loc_id / \p obj_name parameter pair. \p loc_id specifies 2403 * a file or an object in a file; if \p loc_id is an attribute identifier, 2404 * the object where the attribute is attached will be used. 2405 * \p obj_name specifies either an object in the file (with an absolute 2406 * name based in the file's root group) or an object name relative 2407 * to \p loc_id. If \p loc_id fully specifies the object that is to serve 2408 * as the root of the iteration, \p obj_name should be '\c .' (a dot). 2409 * (Note that when \p loc_id fully specifies the object that is to serve 2410 * as the root of the iteration, the user may wish to consider 2411 * using H5Ovisit2() instead of #H5Ovisit_by_name.) 2412 * 2413 * Two parameters are used to establish the iteration: \p idx_type 2414 * and \p order. 2415 * 2416 * \p idx_type specifies the index to be used. If the links in 2417 * a group have not been indexed by the index type, they will 2418 * first be sorted by that index then the iteration will begin; 2419 * if the links have been so indexed, the sorting step will be 2420 * unnecessary, so the iteration may begin more quickly. 2421 * 2422 * Note that the index type passed in \p idx_type is a 2423 * <em>best effort</em> setting. If the application passes in a 2424 * value indicating iteration in creation order and a group is 2425 * encountered that was not tracked in creation order, that group 2426 * will be iterated over in alphanumeric order by name, or 2427 * <em>name order</em>. (<em>Name order</em> is the native order 2428 * used by the HDF5 library and is always available.) 2429 * 2430 * \p order specifies the order in which objects are to be inspected 2431 * along the index specified in \p idx_type. 2432 * 2433 * The \p op callback function and the effect of the callback 2434 * function's return value on the application are described 2435 * in H5Ovisit2(). 2436 * 2437 * The H5O_info1_t \c struct is defined in H5Opublic.h 2438 * and described in the H5Oget_info1() function entry. 2439 * 2440 * The H5Ovisit_by_name2() \p op_data parameter is a user-defined 2441 * pointer to the data required to process objects in the course 2442 * of the iteration. This pointer is passed back to each step of 2443 * the iteration in the callback function's \p op_data parameter. 2444 * 2445 * \p lapl_id is a link access property list. In the general case, 2446 * when default link access properties are acceptable, this can 2447 * be passed in as #H5P_DEFAULT. An example of a situation that 2448 * requires a non-default link access property list is when 2449 * the link is an external link; an external link may require 2450 * that a link prefix be set in a link access property list 2451 * (see H5Pset_elink_prefix()). 2452 * 2453 * The \p fields parameter contains flags to determine which fields will 2454 * be retrieved by the \p op callback function. These flags are defined 2455 * in the H5Opublic.h file: 2456 * \obj_info_fields 2457 * 2458 * #H5Lvisit_by_name and #H5Ovisit_by_name are companion 2459 * functions: one for examining and operating on links; the other 2460 * for examining and operating on the objects that those links point to. 2461 * Both functions ensure that by the time the function completes 2462 * successfully, every link or object below the specified point 2463 * in the file has been presented to the application for whatever 2464 * processing the application requires. 2465 * 2466 * \callback_note 2467 * 2468 * \since 1.10.3 2469 * 2470 */ 2471 H5_DLL herr_t H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, 2472 H5_iter_order_t order, H5O_iterate1_t op, void *op_data, unsigned fields, 2473 hid_t lapl_id); 2474 2475 #endif /* H5_NO_DEPRECATED_SYMBOLS */ 2476 2477 #ifdef __cplusplus 2478 } 2479 #endif 2480 #endif /* H5Opublic_H */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|