![]() |
|
|||
File indexing completed on 2025-09-18 09:39:16
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: H5Lpublic.h 0016 * 0017 * Purpose: Public declarations for the H5L package (links) 0018 * 0019 *------------------------------------------------------------------------- 0020 */ 0021 #ifndef H5Lpublic_H 0022 #define H5Lpublic_H 0023 0024 #include "H5public.h" /* Generic Functions */ 0025 #include "H5Ipublic.h" /* Identifiers */ 0026 #include "H5Opublic.h" /* Object Headers */ 0027 #include "H5Tpublic.h" /* Datatypes */ 0028 0029 /*****************/ 0030 /* Public Macros */ 0031 /*****************/ 0032 0033 /** Maximum length of a link's name \since 1.8.0 */ 0034 #define H5L_MAX_LINK_NAME_LEN UINT32_MAX 0035 0036 /** Macro to indicate operation occurs on same location \since 1.8.0 */ 0037 #define H5L_SAME_LOC 0 /* (hid_t) */ 0038 0039 #ifdef __cplusplus 0040 extern "C" { 0041 #endif 0042 0043 /*******************/ 0044 /* Public Typedefs */ 0045 /*******************/ 0046 0047 /** 0048 * \brief Link class types. 0049 * 0050 * Values less than 64 are reserved for the HDF5 library's internal use. Values 0051 * 64 to 255 are for "user-defined" link class types; these types are defined 0052 * by HDF5 but their behavior can be overridden by users. Users who want to 0053 * create new classes of links should contact the HDF5 development team at 0054 * mailto:help@hdfgroup.org. These values can never change because they appear 0055 * in HDF5 files. 0056 */ 0057 typedef enum { 0058 H5L_TYPE_ERROR = (-1), /**< Invalid link type id */ 0059 H5L_TYPE_HARD = 0, /**< Hard link id */ 0060 H5L_TYPE_SOFT = 1, /**< Soft link id */ 0061 H5L_TYPE_EXTERNAL = 64, /**< External link id */ 0062 H5L_TYPE_MAX = 255 /**< Maximum link type id */ 0063 } H5L_type_t; 0064 0065 /** Maximum value link value for "built-in" link types \since 1.8.0 */ 0066 #define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT 0067 /** Link ids at or above this value are "user-defined" link types. \since 1.8.0 */ 0068 #define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL 0069 /** Maximum link id value for "user-defined" link types. \since 1.12.1 */ 0070 #define H5L_TYPE_UD_MAX H5L_TYPE_MAX 0071 0072 /** 0073 * \brief Information struct for links 0074 */ 0075 //! <!-- [H5L_info2_t_snip] --> 0076 typedef struct { 0077 H5L_type_t type; /**< Type of link */ 0078 hbool_t corder_valid; /**< Indicate if creation order is valid */ 0079 int64_t corder; /**< Creation order */ 0080 H5T_cset_t cset; /**< Character set of link name */ 0081 union { 0082 H5O_token_t token; /**< Token of location that hard link points to */ 0083 size_t val_size; /**< Size of a soft link or user-defined link value */ 0084 } u; 0085 } H5L_info2_t; 0086 //! <!-- [H5L_info2_t_snip] --> 0087 0088 /** 0089 * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator 0090 * 0091 * The H5O_token_t version is used in the VOL layer and future public API calls. 0092 */ 0093 //! <!-- [H5L_iterate2_t_snip] --> 0094 typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data); 0095 //! <!-- [H5L_iterate2_t_snip] --> 0096 0097 /** 0098 * \brief Callback for external link traversal 0099 */ 0100 typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char *parent_group_name, 0101 const char *child_file_name, const char *child_object_name, 0102 unsigned *acc_flags, hid_t fapl_id, void *op_data); 0103 0104 /********************/ 0105 /* Public Variables */ 0106 /********************/ 0107 0108 /*********************/ 0109 /* Public Prototypes */ 0110 /*********************/ 0111 /** 0112 * \ingroup H5L 0113 * 0114 * \brief Moves a link within an HDF5 file 0115 * 0116 * \fgdta_loc_id{src_loc} 0117 * \param[in] src_name Original link name 0118 * \fgdta_loc_id{dst_loc} 0119 * \param[in] dst_name New link name 0120 * \lcpl_id 0121 * \lapl_id 0122 * 0123 * \return \herr_t 0124 * 0125 * \details H5Lmove() moves a link within an HDF5 file. The original link, 0126 * \p src_name, is removed from \p src_loc and the new link, 0127 * \p dst_name, is inserted at dst_loc. This change is 0128 * accomplished as an atomic operation. 0129 * 0130 * \p src_loc and \p src_name identify the original link. 0131 * \p src_loc is the original location identifier; \p src_name is 0132 * the path to the link and is interpreted relative to \p src_loc. 0133 * 0134 * \p dst_loc and \p dst_name identify the new link. \p dst_loc is 0135 * either a file or group identifier; \p dst_name is the path to 0136 * the link and is interpreted relative to \p dst_loc. 0137 * 0138 * \p lcpl_id and \p lapl_id are the link creation and link access 0139 * property lists, respectively, associated with the new link, 0140 * \p dst_name. 0141 * 0142 * Through these property lists, several properties are available to 0143 * govern the behavior of H5Lmove(). The property controlling creation 0144 * of missing intermediate groups is set in the link creation property 0145 * list with H5Pset_create_intermediate_group(); H5Lmove() ignores any 0146 * other properties in the link creation property list. Properties 0147 * controlling character encoding, link traversals, and external link 0148 * prefixes are set in the link access property list with 0149 * H5Pset_char_encoding(), H5Pset_nlinks(), and H5Pset_elink_prefix(), 0150 * respectively. 0151 * 0152 * \note Note that H5Lmove() does not modify the value of the link; the new 0153 * link points to the same object as the original link pointed to. 0154 * Furthermore, if the object pointed to by the original link was already 0155 * open with a valid object identifier, that identifier will remain valid 0156 * after the call to H5Lmove(). 0157 * 0158 * \attention Exercise care in moving links as it is possible to render data in 0159 * a file inaccessible with H5Lmove(). If the link being moved is on 0160 * the only path leading to an HDF5 object, that object may become 0161 * permanently inaccessible in the file. 0162 * 0163 * \since 1.8.0 0164 * 0165 *------------------------------------------------------------------------- 0166 */ 0167 H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc, const char *dst_name, hid_t lcpl_id, 0168 hid_t lapl_id); 0169 /** 0170 * \ingroup H5L 0171 * 0172 * \brief Creates an identical copy of a link with the same creation time and 0173 * target. The new link can have a different name and be in a different 0174 * location than the original. 0175 * 0176 * \fgdt_loc_id{src_loc} 0177 * \param[in] src_name Name of the link to be copied 0178 * \fgdt_loc_id{dst_loc} 0179 * \param[in] dst_name Name to be assigned to the new copy 0180 * \lcpl_id 0181 * \lapl_id 0182 * \return \herr_t 0183 * 0184 * \details H5Lcopy() copies the link specified by \p src_name from the location 0185 * specified by \p src_loc_id to the location specified by 0186 * \p dst_loc_id. The new copy of the link is created with the name 0187 * \p dst_name. 0188 * 0189 * If \p dst_loc_id is a file identifier, \p dst_name will be 0190 * interpreted relative to that file's root group. 0191 * 0192 * The new link is created with the creation and access property lists 0193 * specified by \p lcpl_id and \p lapl_id. The interpretation of 0194 * \p lcpl_id is limited in the manner described in the next paragraph. 0195 * 0196 * H5Lcopy() retains the creation time and the target of the original 0197 * link. However, since the link may be renamed, the character 0198 * encoding is specified in \p lcpl_id rather than in that of the 0199 * original link. Other link creation properties are ignored. 0200 * 0201 * If the link is a soft link, also known as a symbolic link, its 0202 * target is interpreted relative to the location of the copy. 0203 * 0204 * Several properties are available to govern the behavior of 0205 * H5Lcopy(). These properties are set in the link creation and access 0206 * property lists, \p lcpl_id and \p lapl_id, respectively. The 0207 * property controlling creation of missing intermediate groups is set 0208 * in the link creation property list with 0209 * H5Pset_create_intermediate_group(); this function ignores any 0210 * other properties in the link creation property list. Properties 0211 * controlling character encoding, link traversals, and external link 0212 * prefixes are set in the link access property list with 0213 * H5Pset_char_encoding(), H5Pset_nlinks(), and 0214 * H5Pset_elink_prefix(). 0215 * 0216 * \note H5Lcopy() does not affect the object that the link points to. 0217 * 0218 * \attention H5Lcopy() cannot copy hard links across files as a hard link is 0219 * not valid without a target object; to copy objects from one file 0220 * to another, see H5Ocopy(). 0221 * 0222 * \see H5Ocopy() 0223 * 0224 * \since 1.8.0 0225 * 0226 */ 0227 H5_DLL herr_t H5Lcopy(hid_t src_loc, const char *src_name, hid_t dst_loc, const char *dst_name, hid_t lcpl_id, 0228 hid_t lapl_id); 0229 /** 0230 * \ingroup H5L 0231 * 0232 * \brief Creates a hard link to an object 0233 * 0234 * \fgdta_loc_id{cur_loc} 0235 * \param[in] cur_name Name of the target object, which must already exist 0236 * \fgdta_loc_id{dst_loc} 0237 * \param[in] dst_name The name of the new link 0238 * \lcpl_id 0239 * \lapl_id 0240 * 0241 * \return \herr_t 0242 * 0243 * \details H5Lcreate_hard() creates a new hard link to a pre-existing object 0244 * in an HDF5 file. 0245 * 0246 * \p cur_loc and \p cur_name specify the location 0247 * and name, respectively, of the target object, i.e., the object that 0248 * the new hard link points to. \p dst_loc and \p dst_name specify the 0249 * location and name, respectively, of the new hard link. 0250 * 0251 * \p cur_name and \p dst_name are interpreted relative to \p cur_loc 0252 * and \p dst_loc, respectively. If a given name begins with \c /, 0253 * then it will be interpreted as absolute path in the file. 0254 * The names of the created links will be the last element of 0255 * each provided path. Prior elements in each path are used to 0256 * locate the parent groups of each new link. If \p cur_loc and 0257 * \p dst_loc are the same location, the HDF5 macro 0258 * #H5L_SAME_LOC can be used for either parameter (but not both). 0259 * 0260 * \p lcpl_id and \p lapl_id are the link creation and access property 0261 * lists associated with the new link. 0262 * 0263 * \note Hard and soft links are for use only if the target object is in the 0264 * current file. If the desired target object is in a different file from 0265 * the new link, an external link may be created with 0266 * H5Lcreate_external(). 0267 * 0268 * \note The HDF5 library keeps a count of all hard links pointing to an 0269 * object; if the hard link count reaches zero (0), the object will be 0270 * deleted from the file. Creating new hard links to an object will 0271 * prevent it from being deleted if other links are removed. The 0272 * library maintains no similar count for soft links and they can dangle. 0273 * 0274 * \note The new link may be one of many that point to that object. 0275 * 0276 * \since 1.8.0 0277 * 0278 */ 0279 H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, const char *dst_name, 0280 hid_t lcpl_id, hid_t lapl_id); 0281 /** 0282 * -------------------------------------------------------------------------- 0283 * \ingroup ASYNC 0284 * \async_variant_of{H5Lcreate_hard} 0285 */ 0286 #ifndef H5_DOXYGEN 0287 H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_line, 0288 hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, 0289 const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); 0290 #else 0291 H5_DLL herr_t H5Lcreate_hard_async(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, 0292 const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); 0293 #endif 0294 /** 0295 * \ingroup H5L 0296 * 0297 * \brief Creates a soft link 0298 * 0299 * \param[in] link_target An HDF5 path name 0300 * \fgdta_loc_id{link_loc_id} 0301 * \param[in] link_name The name of the new link 0302 * \lcpl_id 0303 * \lapl_id 0304 * 0305 * \return \herr_t 0306 * 0307 * \details H5Lcreate_soft() creates a new soft link to an object in an HDF5 0308 * file. 0309 * 0310 * \p link_target specifies the HDF5 path name the soft link contains. 0311 * \p link_target can be an arbitrary HDF5 path name and is 0312 * interpreted only at lookup time. This path may be absolute in the 0313 * file or relative to \p link_loc_id. 0314 * 0315 * \p link_loc_id and \p link_name specify the location and name, 0316 * respectively, of the new soft link. \p link_name is interpreted 0317 * as a path relative to \p link_loc_id, or an absolute path if it 0318 * begins with \c /. The name of the created link will be the last 0319 * element of the provided path. Prior elements in the path are 0320 * used to locate the parent group of the new link. 0321 * 0322 * If \p link_loc_id is a group identifier, the object pointed to by 0323 * \p link_name will be accessed as a member of that group. If 0324 * \p link_loc_id is a file identifier, the object will be accessed as a 0325 * member of the file's root group. 0326 * 0327 * \p lcpl_id and \p lapl_id are the link creation and access property 0328 * lists associated with the new link. 0329 * 0330 * For instance, if target_path is \c ./foo, \p link_loc_id specifies 0331 * \c ./x/y/bar, and the name of the new link is \c new_link, then a 0332 * subsequent request for \c ./x/y/bar/new_link will return the same 0333 * object as would be found at \c ./foo. 0334 * 0335 * \note H5Lcreate_soft() is for use only if the target object is in the 0336 * current file. If the desired target object is in a different file from 0337 * the new link, use H5Lcreate_external() to create an external link. 0338 * 0339 * \note Soft links and external links are also known as symbolic links as they 0340 * use a name to point to an object; hard links employ an object's 0341 * address in the file. 0342 * 0343 * \note Unlike hard links, a soft link in an HDF5 file is allowed to dangle, 0344 * meaning that the target object need not exist at the time that the 0345 * link is created. 0346 * 0347 * \note The HDF5 library does not keep a count of soft links as it does of 0348 * hard links. 0349 * 0350 * \note The new link may be one of many that point to that object. 0351 * 0352 * \see H5Lcreate_hard(), H5Lcreate_external() 0353 * 0354 * \since 1.8.0 0355 * 0356 0357 */ 0358 H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, 0359 hid_t lapl_id); 0360 /** 0361 * -------------------------------------------------------------------------- 0362 * \ingroup ASYNC 0363 * \async_variant_of{H5Lcreate_soft} 0364 */ 0365 #ifndef H5_DOXYGEN 0366 H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_line, 0367 const char *link_target, hid_t link_loc_id, const char *link_name, 0368 hid_t lcpl_id, hid_t lapl_id, hid_t es_id); 0369 #else 0370 H5_DLL herr_t H5Lcreate_soft_async(const char *link_target, hid_t link_loc_id, const char *link_name, 0371 hid_t lcpl_id, hid_t lapl_id, hid_t es_id); 0372 #endif 0373 /** 0374 * \ingroup H5L 0375 * 0376 * \brief Removes a link from a group 0377 * 0378 * \fgdta_loc_id 0379 * \param[in] name Name of the link to delete 0380 * \lapl_id 0381 * 0382 * \return \herr_t 0383 * 0384 * \details H5Ldelete() removes the link specified by \p name from the location 0385 * \p loc_id. 0386 * 0387 * If the link being removed is a hard link, H5Ldelete() also 0388 * decrements the link count for the object to which name points. 0389 * Unless there is a duplicate hard link in that group, this action 0390 * removes the object to which name points from the group that 0391 * previously contained it. 0392 * 0393 * Object headers keep track of how many hard links refer to an 0394 * object; when the hard link count, also referred to as the reference 0395 * count, reaches zero, the object can be removed from the file. The 0396 * file space associated will then be released, i.e., identified in 0397 * memory as freespace. Objects which are open are not removed until 0398 * all identifiers to the object are closed. 0399 * 0400 * \attention Exercise caution in the use of H5Ldelete(); if the link being 0401 * removed is on the only path leading to an HDF5 object, that 0402 * object may become permanently inaccessible in the file. 0403 * 0404 * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_external() 0405 * 0406 * \since 1.8.0 0407 * 0408 */ 0409 H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id); 0410 /** 0411 * -------------------------------------------------------------------------- 0412 * \ingroup ASYNC 0413 * \async_variant_of{H5Ldelete} 0414 */ 0415 #ifndef H5_DOXYGEN 0416 H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, 0417 const char *name, hid_t lapl_id, hid_t es_id); 0418 #else 0419 H5_DLL herr_t H5Ldelete_async(hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); 0420 #endif 0421 /** 0422 * \ingroup H5L 0423 * 0424 * \brief Removes the \Emph{n}-th link in a group 0425 * 0426 * \fgdta_loc_id 0427 * \param[in] group_name Name of subject group 0428 * \param[in] idx_type Index or field which determines the order 0429 * \param[in] order Order within field or index 0430 * \param[in] n Link for which to retrieve information 0431 * \lapl_id 0432 * 0433 * \return \herr_t 0434 * 0435 * \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group 0436 * according to the specified order, \p order, in the specified index, 0437 * \p index. 0438 * 0439 * If \p loc_id specifies the group in which the link resides, 0440 * \p group_name can be a dot (\c .). 0441 * 0442 * \see H5Ldelete() 0443 * 0444 * \since 1.8.0 0445 * 0446 */ 0447 H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0448 H5_iter_order_t order, hsize_t n, hid_t lapl_id); 0449 /** 0450 * -------------------------------------------------------------------------- 0451 * \ingroup ASYNC 0452 * \async_variant_of{H5Ldelete_by_idx} 0453 */ 0454 #ifndef H5_DOXYGEN 0455 H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, 0456 hid_t loc_id, const char *group_name, H5_index_t idx_type, 0457 H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); 0458 #else 0459 H5_DLL herr_t H5Ldelete_by_idx_async(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0460 H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); 0461 #endif 0462 /** 0463 * \ingroup H5L 0464 * 0465 * \brief Returns the value of a link 0466 * 0467 * \fgdta_loc_id 0468 * \param[in] name Link name 0469 * \param[out] buf The buffer to hold the link value 0470 * \param[in] size Maximum number of bytes of link value to be returned 0471 * \lapl_id 0472 * 0473 * \return \herr_t 0474 * 0475 * \details H5Lget_val() returns the value of link \p name. For symbolic links, 0476 * this is the path to which the link points, including the null 0477 * terminator. For external and user-defined links, it is the link 0478 * buffer. 0479 * 0480 * \p size is the size of \p buf and should be the size of the link 0481 * value being returned. This size value can be determined through a 0482 * call to H5Lget_info(); it is returned in the \c val_size field of 0483 * the \ref H5L_info_t \c struct. 0484 * 0485 * If \p size is smaller than the size of the returned value, then the 0486 * string stored in \p buf will be truncated to \p size bytes. For 0487 * soft links, this means that the value will not be null terminated. 0488 * 0489 * In the case of external links, the target file and object names are 0490 * extracted from \p buf by calling H5Lunpack_elink_val(). 0491 * 0492 * The link class of link \p name can be determined with a call to 0493 * H5Lget_info(). 0494 * 0495 * \p lapl_id specifies the link access property list associated with 0496 * the link \p name. In the general case, when default link access 0497 * properties are acceptable, this can be passed in as #H5P_DEFAULT. An 0498 * example of a situation that requires a non-default link access 0499 * property list is when the link is an external link; an external 0500 * link may require that a link prefix be set in a link access 0501 * property list (see H5Pset_elink_prefix()). 0502 * 0503 * This function should be used only after H5Lget_info() has been 0504 * called to verify that \p name is a symbolic link. This can be 0505 * determined from the \c link_type field of the \ref H5L_info_t 0506 * \c struct. 0507 * 0508 * \note This function will fail if called on a hard link. 0509 * 0510 * \see H5Lget_val_by_idx() 0511 * 0512 * \since 1.8.0 0513 * 0514 */ 0515 H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id); 0516 /** 0517 * \ingroup H5L 0518 * 0519 * \brief Retrieves value of the \Emph{n}-th link in a group, according to the order within an index 0520 * 0521 * \fgdta_loc_id 0522 * \param[in] group_name Group name 0523 * \param[in] idx_type Type of index 0524 * \param[in] order Order within field or index 0525 * \param[in] n Link position for which to retrieve information 0526 * \param[out] buf The buffer to hold the link value 0527 * \param[in] size Maximum number of bytes of link value to be returned 0528 * \lapl_id 0529 * 0530 * \return \herr_t 0531 * 0532 * \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in 0533 * a group, according to the specified order, \p order, within an 0534 * index, \p index. 0535 * 0536 * For soft links, the value is an HDF5 path name. 0537 * 0538 * For external links, this is a compound value containing file and 0539 * path name information; to use this external link information, it 0540 * must first be decoded with H5Lunpack_elink_val() 0541 * 0542 * For user-defined links, this value will be described in the 0543 * definition of the user-defined link type. 0544 * 0545 * \p loc_id specifies the location identifier of the group specified 0546 * by \p group_name. 0547 * 0548 * \p group_name specifies the group in which the link exists. If 0549 * \p loc_id already specifies the group in which the link exists, 0550 * \p group_name must be a dot (\c .). 0551 * 0552 * The size in bytes of link_val is specified in \p size. The size 0553 * value can be determined through a call to H5Lget_info_by_idx(); it 0554 * is returned in the \c val_size field of the \ref H5L_info_t 0555 * \c struct. If 0556 * size is smaller than the size of the returned value, then the 0557 * string stored in link_val will be truncated to size bytes. For soft 0558 * links, this means that the value will not be null terminated. 0559 * 0560 * If the type of the link is unknown or uncertain, H5Lget_val_by_idx() 0561 * should be called only after the type has been determined via a call 0562 * to H5Lget_info_by_idx(). 0563 * 0564 * \note This function will fail if called on a hard link. 0565 * 0566 * \see H5Lget_val() 0567 * 0568 * \since 1.8.0 0569 * 0570 */ 0571 H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0572 H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size, 0573 hid_t lapl_id); 0574 /** 0575 * \ingroup H5L 0576 * 0577 * \brief Determines whether a link with the specified name exists in a group 0578 * 0579 * \fgdta_loc_id 0580 * \param[in] name Link name 0581 * \lapl_id 0582 * 0583 * \return \herr_t 0584 * 0585 * \details H5Lexists() allows an application to determine whether the link \p 0586 * name exists in the location specified by \p loc_id. The link may be 0587 * of any type; only the presence of a link with that name is checked. 0588 * 0589 * Note that H5Lexists() verifies only that the target link exists. If 0590 * name includes either a relative path or an absolute path to the 0591 * target link, intermediate steps along the path must be verified 0592 * before the existence of the target link can be safely checked. If 0593 * the path is not verified, and an intermediate element of the path 0594 * does not exist, H5Lexists() will fail. The example in the next 0595 * paragraph illustrates one step-by-step method for verifying the 0596 * existence of a link with a relative or absolute path. 0597 * 0598 * \Bold{Example:} Use the following steps to verify the existence of 0599 * the link \c datasetD in the \c group group1/group2/softlink_to_group3/, 0600 * where \c group1 is a member of the group specified by \c loc_id: 0601 * 0602 * 1. First, use H5Lexists() to verify that the \c group1 exists. 0603 * 2. If \c group1 exists, use H5Lexists() again, this time with name 0604 * set to \c group1/group2, to verify that \c group2 exists. 0605 * 3. If \c group2 exists, use H5Lexists() with name set to 0606 * \c group1/group2/softlink_to_group3 to verify that 0607 * \c softlink_to_group3 exists. 0608 * 4. If \c softlink_to_group3 exists, you can now safely use 0609 * H5Lexists() with \c name set to 0610 * \c group1/group2/softlink_to_group3/datasetD to verify that the 0611 * target link, \c datasetD, exists. 0612 * 0613 * If the link to be verified is specified with an absolute path, the 0614 * same approach should be used, but starting with the first link in 0615 * the file's root group. For instance, if \c datasetD were in 0616 * \c /group1/group2/softlink_to_group3, the first call to H5Lexists() 0617 * would have name set to \c /group1. 0618 * 0619 * Note that this is an outline and does not include all the necessary 0620 * details. Depending on circumstances, for example, you may need to 0621 * verify that an intermediate link points to a group and that a soft 0622 * link points to an existing target. 0623 * 0624 * \note The behavior of H5Lexists() was changed in the 1.10 release in the 0625 * case where the root group, \c "/", is the name of the link. This 0626 * change is described below: 0627 * <ol> 0628 * <li>Let \c file denote a valid HDF5 file identifier, and let \c lapl 0629 * denote a valid link access property list identifier. A call to 0630 * H5Lexists() with arguments \c file, \c "/", and \c lapl 0631 * returns a positive value; in other words, 0632 * \TText{H5Lexists(file, "/", lapl)} returns a positive value. 0633 * In the HDF5 1.8 release, this function returns 0.</li> 0634 * <li>Let \c root denote a valid HDF5 group identifier that refers to the 0635 * root group of an HDF5 file, and let \c lapl denote a valid link 0636 * access property list identifier. A call to H5Lexists() with 0637 * arguments c root, \c "/", and \c lapl returns a positive value; 0638 * in other words, \TText{H5Lexists(root, "/", lapl)} returns a positive 0639 * value. In the HDF5 1.8 release, this function returns 0.</li> 0640 * </ol> 0641 * Note that the function accepts link names and path names. This is 0642 * potentially misleading to callers, and we plan to separate the 0643 * functionality for link names and path names in a future release. 0644 * 0645 * \attention H5Lexists() checks the existence of only the final element in a 0646 * relative or absolute path; it does not check any other path 0647 * elements. The function will therefore fail when both of the 0648 * following conditions exist: 0649 * - \c name is not local to the group specified by \c loc_id or, 0650 * if \c loc_id is something other than a group identifier, \c name 0651 * is not local to the root group. 0652 * - Any element of the relative path or absolute path in name, 0653 * except the target link, does not exist. 0654 * 0655 * \version 1.10.0 Function behavior changed in this release. (See the note.) 0656 * \since 1.8.0 0657 * 0658 */ 0659 H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); 0660 /** 0661 * -------------------------------------------------------------------------- 0662 * \ingroup ASYNC 0663 * \async_variant_of{H5Lexists} 0664 */ 0665 #ifndef H5_DOXYGEN 0666 H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, 0667 const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id); 0668 #else 0669 H5_DLL herr_t H5Lexists_async(hid_t loc_id, const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id); 0670 #endif 0671 /** 0672 * \ingroup H5L 0673 * 0674 * \brief Returns information about a link 0675 * 0676 * \fgdta_loc_id 0677 * \param[in] name Link name 0678 * \param[out] linfo Buffer in which link information is returned 0679 * \lapl_id 0680 * 0681 * \return \herr_t 0682 * 0683 * \details H5Lget_info2() returns information about the specified link through 0684 * the \p linfo argument. 0685 * 0686 * The location identifier, \p loc_id, specifies the location of the 0687 * link. A link name, \p name, interpreted relative to \p loc_id, 0688 * specifies the link being queried. 0689 * 0690 * \p lapl_id is the link access property list associated with the 0691 * link name. In the general case, when default link access properties 0692 * are acceptable, this can be passed in as #H5P_DEFAULT. An example 0693 * of a situation that requires a non-default link access property 0694 * list is when the link is an external link; an external link may 0695 * require that a link prefix be set in a link access property list 0696 * (see H5Pset_elink_prefix()). 0697 * 0698 * H5Lget_info2() returns information about name in the data structure 0699 * H5L_info2_t, which is described below and defined in H5Lpublic.h. 0700 * This structure is returned in the buffer \p linfo. 0701 * \snippet this H5L_info2_t_snip 0702 * In the above struct, \c type specifies the link class. Valid values 0703 * include the following: 0704 * \link_types 0705 * There will be additional valid values if user-defined links have 0706 * been registered. 0707 * 0708 * \p corder specifies the link's creation order position, while 0709 * \p corder_valid indicates whether the value in corder is valid. 0710 * 0711 * If \p corder_valid is \c true, the value in \p corder is known to 0712 * be valid; if \p corder_valid is \c false, the value in \p corder is 0713 * presumed to be invalid; \p corder starts at zero (0) and is 0714 * incremented by one (1) as new links are created. But 0715 * higher-numbered entries are not adjusted when a lower-numbered link 0716 * is deleted; the deleted link's creation order position is simply 0717 * left vacant. In such situations, the value of \p corder for the 0718 * last link created will be larger than the number of links remaining 0719 * in the group. 0720 * 0721 * \p cset specifies the character set in which the link name is 0722 * encoded. Valid values include the following: 0723 * \csets 0724 * This value is set with #H5Pset_char_encoding. 0725 * 0726 * \c token is the location that a hard link points to, and 0727 * \c val_size is the size of a soft link or user-defined link value. 0728 * H5O_token_t is used in the VOL layer. It is defined in H5public.h 0729 * as: 0730 * \snippet H5public.h H5O_token_t_snip 0731 * 0732 * If the link is a symbolic link, \c val_size will be the length of 0733 * the link value, e.g., the length of the HDF5 path name with a null 0734 * terminator. 0735 * 0736 * \since 1.12.0 0737 * 0738 */ 0739 H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, hid_t lapl_id); 0740 /** 0741 * \ingroup H5L 0742 * 0743 * \brief Retrieves metadata for a link in a group, according to the order 0744 * within a field or index 0745 * 0746 * \loc_id 0747 * \param[in] group_name Group name 0748 * \idx_type 0749 * \order 0750 * \param[in] n Link position for which to retrieve information 0751 * \param[out] linfo Buffer in which link information is returned 0752 * \lapl_id 0753 * 0754 * \return \herr_t 0755 * 0756 * \details H5Lget_info_by_idx2() returns the metadata for a link in a group 0757 * according to a specified field or index and a specified order. The 0758 * link for which information is to be returned is specified by \p 0759 * idx_type, \p order, and \p n as follows: 0760 * 0761 * - \p idx_type specifies the field by which the links in \p 0762 * group_name are ordered. The links may be indexed on this field, 0763 * in which case operations seeking specific links are likely to 0764 * complete more quickly. 0765 * - \p order specifies the order in which 0766 * the links are to be referenced for the purposes of this function. 0767 * - \p n specifies the position of the subject link. Note that this 0768 * count is zero-based; 0 (zero) indicates that the function will 0769 * return the value of the first link; if \p n is 5, the function 0770 * will return the value of the sixth link; etc. 0771 * 0772 * For example, assume that \p idx_type, \p order, and \p n are 0773 * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME 0774 * indicates that the links are accessed in lexicographic order by 0775 * their names. #H5_ITER_DEC specifies that the list be traversed in 0776 * reverse order, or in decremented order. And 5 specifies that this 0777 * call to the function will return the metadata for the 6th link 0778 * (\c n + 1) from the end. 0779 * 0780 * See H5Literate2() for a list of valid values and further discussion 0781 * regarding \p idx_type and \p order. 0782 * 0783 * If \p loc_id specifies the group in which the link resides, 0784 * \p group_name can be a dot (\c .). 0785 * 0786 * \since 1.12.0 0787 * 0788 * \see H5Lget_info2() 0789 * 0790 */ 0791 H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0792 H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id); 0793 /** 0794 * \ingroup H5L 0795 * 0796 * \brief Retrieves name of the \Emph{n}-th link in a group, according to the 0797 * order within a specified field or index 0798 * 0799 * \loc_id 0800 * \param[in] group_name Group name 0801 * \idx_type 0802 * \order 0803 * \param[in] n Link position for which to retrieve information 0804 * \param[out] name Buffer in which link name is returned 0805 * \param[in] size Size in bytes of \p name 0806 * \lapl_id 0807 * 0808 * \return Returns the size of the link name if successful; otherwise returns a 0809 * negative value. 0810 * 0811 * \details H5Lget_name_by_idx() retrieves the name of the \Emph{n}-th link in a 0812 * group, according to the specified order, \p order, within a specified 0813 * field or index, \p idx_type. 0814 * 0815 * \p idx_type specifies the index that is used. Valid values include 0816 * the following: 0817 * \indexes 0818 * 0819 * \p order specifies the order in which objects are inspected along 0820 * the index specified in \p idx_type. Valid values include the 0821 * following: 0822 * \orders 0823 * 0824 * If \p loc_id specifies the group in which the link resides, 0825 * \p group_name can be a dot (\c .). 0826 * 0827 * \details_namelen{link,H5Lget_name_by_idx} 0828 * 0829 * \note Please note that in order for the specified index to correspond to the 0830 * creation order index, \p order must be set to #H5_ITER_INC or 0831 * #H5_ITER_DEC when calling H5Lget_name_by_idx(). \note The index \p n 0832 * passed to H5Lget_name_by_idx() is the index of the link within the 0833 * link table, sorted according to \p order and \p idx_type. If order is 0834 * #H5_ITER_NATIVE, then the link table is not sorted, and it does not 0835 * matter what \p idx_type is. Specifying #H5_ITER_NATIVE does not 0836 * guarantee any particular order, only that it remains consistent. 0837 * 0838 * \since 1.8.0 0839 * 0840 */ 0841 H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, 0842 H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, 0843 hid_t lapl_id); 0844 /** 0845 * \ingroup TRAV 0846 * 0847 * \brief Iterates over links in a group, with user callback routine, 0848 * according to the order within an index. 0849 * 0850 * \group_id{grp_id} 0851 * \idx_type 0852 * \order 0853 * \param[in,out] idx Pointer to an iteration index to allow 0854 * continuing a previous iteration 0855 * \op 0856 * \op_data 0857 * \return \success{The return value of the first operator that returns 0858 * non-zero, or zero if all members were processed with no 0859 * operator returning non-zero.} 0860 * \return \failure{Negative if an error occurs in the library, or the negative 0861 * value returned by one of the operators.} 0862 * 0863 * \details H5Literate2() iterates through the links in a file or 0864 * group, \p group_id, in the order of the specified 0865 * index, \p idx_type, using a user-defined callback routine 0866 * \p op. H5Literate2() does not recursively follow links into 0867 * subgroups of the specified group. 0868 * 0869 * Three parameters are used to manage progress of the iteration: 0870 * \p idx_type, \p order, and \p idx_p. 0871 * 0872 * \p idx_type specifies the index to be used. If the links have 0873 * not been indexed by the index type, they will first be sorted by 0874 * that index then the iteration will begin; if the links have been 0875 * so indexed, the sorting step will be unnecessary, so the iteration 0876 * may begin more quickly. Valid values include the following: 0877 * \indexes 0878 * 0879 * \p order specifies the order in which objects are to be inspected 0880 * along the index \p idx_type. Valid values include the following: 0881 * \orders 0882 * 0883 * \p idx_p tracks the iteration and allows an iteration to be 0884 * resumed if it was stopped before all members were processed. It is 0885 * passed in by the application with a starting point and returned by 0886 * the library with the point at which the iteration stopped. 0887 * 0888 * \p op_data is a user-defined pointer to the data required to 0889 * process links in the course of the iteration. This pointer is 0890 * passed back to each step of the iteration in the \p op callback 0891 * function's \p op_data parameter. \p op is invoked for each link 0892 * encounter. 0893 * 0894 * \p op_data is passed to and from each iteration and can be used to 0895 * supply or aggregate information across iterations. 0896 * 0897 * \remark Same pattern of behavior as H5Giterate(). 0898 * 0899 * \note This function is also available through the H5Literate() macro. 0900 * 0901 * \warning The behavior of H5Literate2() is undefined if the link 0902 * membership of \p group_id changes during the iteration. 0903 * This does not limit the ability to change link destinations 0904 * while iterating, but caution is advised. 0905 * 0906 * \callback_note 0907 * 0908 * \since 1.12.0 0909 * 0910 * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2() 0911 * 0912 */ 0913 H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, 0914 H5L_iterate2_t op, void *op_data); 0915 /** 0916 * -------------------------------------------------------------------------- 0917 * \ingroup ASYNC 0918 * 0919 * \warning The returned value of the callback routine op will not be set 0920 * in the return value for H5Literate_async(), so the \p herr_t value 0921 * should not be used for determining the return state of the callback routine. 0922 * 0923 * \async_variant_of{H5Literate} 0924 */ 0925 #ifndef H5_DOXYGEN 0926 H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id, 0927 H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, 0928 void *op_data, hid_t es_id); 0929 #else 0930 H5_DLL herr_t H5Literate_async(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, 0931 H5L_iterate2_t op, void *op_data, hid_t es_id); 0932 #endif 0933 /** 0934 * \ingroup TRAV 0935 * 0936 * \brief Iterates through links in a group 0937 * 0938 * \loc_id 0939 * \param[in] group_name Group name 0940 * \idx_type 0941 * \order 0942 * \param[in,out] idx iteration position at which to start (\Emph{IN}) or 0943 * position at which an interrupted iteration may be restarted 0944 * (\Emph{OUT}) 0945 * \op 0946 * \op_data 0947 * \lapl_id 0948 * \return \success{The return value of the first operator that returns 0949 * non-zero, or zero if all members were processed with no 0950 * operator returning non-zero.} 0951 * \return \failure{Negative if an error occurs in the library, or the negative 0952 * value returned by one of the operators.} 0953 * 0954 * \details H5Literate_by_name2() iterates through the links in a group 0955 * specified by \p loc_id and \p group_name, in the order of the 0956 * specified index, \p idx_type, using a user-defined callback routine 0957 * \p op. H5Literate_by_name2() does not recursively follow links into 0958 * subgroups of the specified group. 0959 * 0960 * \p idx_type specifies the index to be used. If the links have not 0961 * been indexed by the index type, they will first be sorted by that 0962 * index then the iteration will begin; if the links have been so 0963 * indexed, the sorting step will be unnecessary, so the iteration may 0964 * begin more quickly. Valid values include the following: 0965 * \indexes 0966 * 0967 * \p order specifies the order in which objects are to be inspected 0968 * along the index specified in \p idx_type. Valid values include the 0969 * following: 0970 * \orders 0971 * 0972 * \p idx_p allows an interrupted iteration to be resumed; it is 0973 * passed in by the application with a starting point and returned by 0974 * the library with the point at which the iteration stopped. 0975 * 0976 * \warning H5Literate_by_name2() assumes that the membership of the group being 0977 * iterated over remains unchanged through the iteration; if any of the 0978 * links in the group change during the iteration, the function's 0979 * behavior is undefined. Note, however, that objects pointed to by the 0980 * links can be modified. 0981 * 0982 * \note H5Literate_by_name2() is not recursive. In particular, if a member of 0983 * \p group_name is found to be a group, call it \c subgroup_a, 0984 * H5Literate_by_name2() does not examine the members of \c subgroup_a. 0985 * When recursive iteration is required, the application must handle the 0986 * recursion, explicitly calling H5Literate_by_name2() on discovered 0987 * subgroups. 0988 * 0989 * \note H5Literate_by_name2() is the same as H5Literate2(), except that 0990 * H5Literate2() always proceeds in alphanumeric order. 0991 * 0992 * \callback_note 0993 * 0994 * \since 1.12.0 0995 * 0996 * \see H5Literate(), H5Lvisit() 0997 * 0998 */ 0999 H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1000 H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data, 1001 hid_t lapl_id); 1002 /** 1003 * \ingroup TRAV 1004 * 1005 * \brief Recursively visits all links starting from a specified group 1006 * 1007 * \group_id{grp_id} 1008 * \idx_type 1009 * \order 1010 * \op 1011 * \op_data 1012 * \return \success{The return value of the first operator that returns 1013 * non-zero, or zero if all members were processed with no 1014 * operator returning non-zero.} 1015 * \return \failure{Negative if an error occurs in the library, or the negative 1016 * value returned by one of the operators.} 1017 * 1018 * \details H5Lvisit2() is a recursive iteration function to visit all links in 1019 * and below a group in an HDF5 file, thus providing a mechanism for 1020 * an application to perform a common set of operations across all of 1021 * those links or a dynamically selected subset. For non-recursive 1022 * iteration across the members of a group, see H5Literate2(). 1023 * 1024 * The group serving as the root of the iteration is specified by its 1025 * group or file identifier, \p group_id. 1026 * 1027 * Two parameters are used to establish the iteration: \p idx_type and 1028 * \p order. 1029 * 1030 * \p idx_type specifies the index to be used. If the links have not 1031 * been indexed by the index type, they will first be sorted by that 1032 * index then the iteration will begin; if the links have been so 1033 * indexed, the sorting step will be unnecessary, so the iteration may 1034 * begin more quickly. Valid values include the following: 1035 * \indexes 1036 * 1037 * Note that the index type passed in \p idx_type is a best effort 1038 * setting. If the application passes in a value indicating iteration 1039 * in creation order and a group is encountered that was not tracked 1040 * in creation order, that group will be iterated over in 1041 * lexicographic order by name, or name order. (Name order is the 1042 * native order used by the HDF5 library and is always available.) 1043 * 1044 * \p order specifies the order in which objects are to be inspected 1045 * along the index specified in \p idx_type. Valid values include the 1046 * following: 1047 * \orders 1048 * 1049 * \p op is a callback function of type \ref H5L_iterate2_t that is invoked 1050 * for each link encountered. 1051 * \snippet this H5L_iterate2_t_snip 1052 * 1053 * The \ref H5L_info2_t struct is defined (in H5Lpublic.h) as follows: 1054 * \snippet this H5L_info2_t_snip 1055 * 1056 * The possible return values from the callback function, and the 1057 * effect of each, are as follows: 1058 * \li Zero causes the visit iterator to continue, returning zero when 1059 * all group members have been processed. 1060 * \li A positive value causes the visit iterator to immediately 1061 * return that positive value, indicating short-circuit success. 1062 * \li A negative value causes the visit iterator to immediately 1063 * return that value, indicating failure. 1064 * 1065 * The H5Lvisit2() \p op_data parameter is a user-defined pointer to 1066 * the data required to process links in the course of the iteration. 1067 * This pointer is passed back to each step of the iteration in the 1068 * \p op callback function's \p op_data parameter. 1069 * 1070 * H5Lvisit2() and H5Ovisit2() are companion functions: one for 1071 * examining and operating on links; the other for examining and 1072 * operating on the objects that those links point to. Both functions 1073 * ensure that by the time the function completes successfully, every 1074 * link or object below the specified point in the file has been 1075 * presented to the application for whatever processing the 1076 * application requires. 1077 * 1078 * \callback_note 1079 * 1080 * \since 1.12.0 1081 * 1082 * \see H5Literate() 1083 * 1084 */ 1085 H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, 1086 void *op_data); 1087 /** 1088 * \ingroup TRAV 1089 * 1090 * \brief Recursively visits all links starting from a specified group 1091 * 1092 * \loc_id 1093 * \param[in] group_name Group name 1094 * \idx_type 1095 * \order 1096 * \op 1097 * \op_data 1098 * \lapl_id 1099 * 1100 * \return \herr_t 1101 * 1102 * \details H5Lvisit_by_name2() is a recursive iteration function to visit all 1103 * links in and below a group in an HDF5 file, thus providing a 1104 * mechanism for an application to perform a common set of operations 1105 * across all of those links or a dynamically selected subset. For 1106 * non-recursive iteration across the members of a group, see 1107 * H5Literate2(). 1108 * 1109 * The group serving as the root of the iteration is specified by the 1110 * \p loc_id / \p group_name parameter pair. \p loc_id specifies a 1111 * file or group; group_name specifies either a group in the file 1112 * (with an absolute name based in the file's root group) or a group 1113 * relative to \p loc_id. If \p loc_id fully specifies the group that 1114 * is to serve as the root of the iteration, group_name should be '.' 1115 * (a dot). (Note that when \p loc_id fully specifies the group 1116 * that is to serve as the root of the iteration, the user may wish to 1117 * consider using H5Lvisit2() instead of H5Lvisit_by_name2().) 1118 * 1119 * Two parameters are used to establish the iteration: \p idx_type and 1120 * \p order. 1121 * 1122 * \p idx_type specifies the index to be used. If the links have not 1123 * been indexed by the index type, they will first be sorted by that 1124 * index then the iteration will begin; if the links have been so 1125 * indexed, the sorting step will be unnecessary, so the iteration may 1126 * begin more quickly. Valid values include the following: 1127 * \indexes 1128 * 1129 * Note that the index type passed in \p idx_type is a best effort 1130 * setting. If the application passes in a value indicating iteration 1131 * in creation order and a group is encountered that was not tracked 1132 * in creation order, that group will be iterated over in 1133 * lexicographic order by name, or name order. (Name order is the 1134 * native order used by the HDF5 library and is always available.) 1135 * 1136 * \p order specifies the order in which objects are to be inspected 1137 * along the index specified in \p idx_type. Valid values include the 1138 * following: 1139 * \orders 1140 * 1141 * The \p op callback function, the related \ref H5L_info2_t 1142 * \c struct, and the effect that the callback function's return value 1143 * has on the application are described in H5Lvisit2(). 1144 * 1145 * The H5Lvisit_by_name2() \p op_data parameter is a user-defined 1146 * pointer to the data required to process links in the course of the 1147 * iteration. This pointer is passed back to each step of the 1148 * iteration in the callback function's \p op_data parameter. 1149 * 1150 * \p lapl_id is a link access property list. In the general case, 1151 * when default link access properties are acceptable, this can be 1152 * passed in as #H5P_DEFAULT. An example of a situation that requires 1153 * a non-default link access property list is when the link is an 1154 * external link; an external link may require that a link prefix be 1155 * set in a link access property list (see H5Pset_elink_prefix()). 1156 * 1157 * H5Lvisit_by_name2() and H5Ovisit_by_name2() are companion 1158 * functions: one for examining and operating on links; the other for 1159 * examining and operating on the objects that those links point to. 1160 * Both functions ensure that by the time the function completes 1161 * successfully, every link or object below the specified point in the 1162 * file has been presented to the application for whatever processing 1163 * the application requires. 1164 * 1165 * \callback_note 1166 * 1167 * \since 1.12.0 1168 * 1169 */ 1170 H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1171 H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id); 1172 /* UD link functions */ 1173 /** 1174 * \ingroup H5L 1175 * 1176 * \brief Creates a link of a user-defined type 1177 * 1178 * \loc_id{link_loc_id} 1179 * \param[in] link_name Link name 1180 * \param[in] link_type User-defined link class 1181 * \param[in] udata User-supplied link information 1182 * \param[in] udata_size Size of udata buffer 1183 * \lcpl_id 1184 * \lapl_id 1185 * 1186 * \return \herr_t 1187 * 1188 * \details H5Lcreate_ud() creates a link of user-defined type \p link_type 1189 * named \p link_name at the location specified in \p link_loc_id with 1190 * user-specified data \p udata. 1191 * 1192 * \p link_name is interpreted relative to \p link_loc_id. If 1193 * \p link_name begins with \c /, then it will be interpreted as 1194 * an absolute path in the file. The name of the created link 1195 * will be the last element of the provided path. Prior elements 1196 * in the path are used to locate the parent group of the new link. 1197 * 1198 * Valid values for the link class of the new link, \p link_type, 1199 * include #H5L_TYPE_EXTERNAL and any user-defined link classes that 1200 * have been registered with the library. See H5Lregister() for 1201 * further information. 1202 * 1203 * The format of the information pointed to by \p udata is defined by 1204 * the user. \p udata_size specifies the size of the \p udata buffer. 1205 * \p udata may be NULL if \p udata_size is zero (0). 1206 * 1207 * The property lists specified by \p lcpl_id and \p lapl_id specify 1208 * properties used to create and access the link. 1209 * 1210 * \note The external link type, #H5L_TYPE_EXTERNAL, included in the HDF5 1211 * library distribution, is implemented as a user-defined link type. This 1212 * was done, in part, to provide a model for the implementation of other 1213 * user-defined links. 1214 * 1215 * \since 1.8.0 1216 * 1217 */ 1218 H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, 1219 size_t udata_size, hid_t lcpl_id, hid_t lapl_id); 1220 /** 1221 * \ingroup H5LA 1222 * 1223 * \brief Determines whether a class of user-defined links is registered 1224 * 1225 * \param[in] id User-defined link class identifier 1226 * 1227 * \return \htri_t 1228 * 1229 * \details H5Lis_registered() tests whether a user-defined link class is 1230 * currently registered, either by the HDF5 library or by the user 1231 * through the use of H5Lregister(). 1232 * 1233 * \note A link class must be registered to create new links of that type or to 1234 * traverse existing links of that type. 1235 * 1236 * \since 1.8.0 1237 * 1238 */ 1239 H5_DLL htri_t H5Lis_registered(H5L_type_t id); 1240 1241 /* External link functions */ 1242 /** 1243 * \ingroup H5L 1244 * 1245 * \brief Decodes external link information 1246 * 1247 * \param[in] ext_linkval Buffer containing external link information 1248 * \param[in] link_size Size, in bytes, of the \p ext_linkval buffer 1249 * \param[out] flags External link flags, packed as a bitmap (\Emph{Reserved as 1250 * a bitmap for flags; no flags are currently defined, so the 1251 * only valid value * is 0.}) 1252 * \param[out] filename Returned filename \param[out] obj_path Returned 1253 * object path, relative to \p filename 1254 * 1255 * \return \herr_t 1256 * 1257 * \details H5Lunpack_elink_val() decodes the external link information 1258 * returned by H5Lget_val() in the \p ext_linkval buffer. 1259 * 1260 * \p ext_linkval should be the buffer set by H5Lget_val() and will 1261 * consist of two NULL-terminated strings, the filename and object 1262 * path, one after the other. 1263 * 1264 * Given this buffer, H5Lunpack_elink_val() creates pointers to the 1265 * filename and object path within the buffer and returns them in 1266 * \p filename and \p obj_path, unless they are passed in as NULL. 1267 * 1268 * H5Lunpack_elink_val() requires that \p ext_linkval contain a 1269 * concatenated pair of null-terminated strings, so use of this 1270 * function on a string that is not an external link \p udata buffer 1271 * may result in a segmentation fault. This failure can be avoided by 1272 * adhering to the following procedure: 1273 * <ol> 1274 * <li>Call H5Lget_info() to get the link type and the size of the 1275 * link value.<li> 1276 * <li>Verify that the link is an external link, i.e., that its link 1277 * type is #H5L_TYPE_EXTERNAL.</li> 1278 * <li>Call H5Lget_val() to get the link value.</li> 1279 * <li>Call H5Lunpack_elink_val() to unpack that value.</li> 1280 * </ol> 1281 * 1282 * \since 1.8.0 1283 * 1284 */ 1285 H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_size, unsigned *flags, 1286 const char **filename /*out*/, const char **obj_path /*out*/); 1287 /** 1288 * \ingroup H5L 1289 * 1290 * \brief Creates an external link, a soft link to an object in a different file. 1291 * 1292 * \param[in] file_name Name of the target file containing the target object. 1293 * \param[in] obj_name Path within the target file to the target object 1294 * \fgdt_loc_id{link_loc_id} 1295 * \param[in] link_name Name of the new link, relative to \p link_loc_id 1296 * \lcpl_id 1297 * \lapl_id 1298 * \return \herr_t 1299 * 1300 * \details H5Lcreate_external() creates a new external link. An external link 1301 * is a soft link to an object in a different HDF5 file from the 1302 * location of the link, i.e., to an external object. 1303 * 1304 * \p file_name identifies the target file containing the target 1305 * object; \p obj_name specifies the path of the target object within 1306 * that file. \p obj_name must be an absolute pathname in 1307 * \p file_name, i.e., it must start at the target file's root group, 1308 * but it is not interpreted until an application attempts to traverse 1309 * it. 1310 * 1311 * \p link_loc_id and \p link_name specify the location and name, 1312 * respectively, of the new link. \p link_name is interpreted relative 1313 * to \p link_loc_id. If \p link_name begins with \c /, then it is 1314 * interpreted as an absolute path in the file. The name of the created 1315 * link will be the last element of the provided path. Prior elements in 1316 * the path are used to locate the parent group of the new link. 1317 * 1318 * \p lcpl_id is the link creation property list used in creating the 1319 * new link. 1320 * 1321 * \p lapl_id is the link access property list used in traversing the 1322 * new link. Note that an external file opened by the traversal of an 1323 * external link is always opened with the weak file close degree 1324 * property setting, #H5F_CLOSE_WEAK (see H5Pset_fclose_degree()); 1325 * any file close degree property setting in \p lapl_id is ignored. 1326 * 1327 * An external link behaves similarly to a soft link, and like a soft 1328 * link in an HDF5 file, it may dangle: the target file and object 1329 * need not exist at the time that the external link is created. 1330 * 1331 * When the external link \p link_name is accessed, the library will 1332 * search for the target file \p file_name as described below: 1333 * 1334 * - If \p file_name is a relative pathname, the following steps are 1335 * performed: 1336 * - The library will get the prefix(es) set in the environment 1337 * variable \c HDF5_EXT_PREFIX and will try to prepend each prefix 1338 * to \p file_name to form a new \p file_name. 1339 * - If the new \p file_name does not exist or if \c HDF5_EXT_PREFIX 1340 * is not set, the library will get the prefix set via 1341 * H5Pset_elink_prefix() and prepend it to \p file_name to form a 1342 * new \p file_name. 1343 * - If the new \p file_name does not exist or no prefix is being 1344 * set by H5Pset_elink_prefix(), then the path of the file 1345 * associated with \p link_loc_id is obtained. This path can be 1346 * the absolute path or the current working directory plus the 1347 * relative path of that file when it is created/opened. The 1348 * library will prepend this path to \p file_name to form a new 1349 * \p file_name. 1350 * - If the new \p file_name does not exist, then the library will 1351 * look for \p file_name and will return failure/success 1352 * accordingly. 1353 * - If \p file_name is an absolute pathname, the library will first 1354 * try to find \p file_name. If \p file_name does not exist, 1355 * \p file_name is stripped of directory paths to form a new 1356 * \p file_name. The search for the new \p file_name then follows 1357 * the same steps as described above for a relative pathname. See 1358 * examples below illustrating how target_file_name is stripped to 1359 * form a new \p file_name. 1360 * 1361 * Note that \p file_name is considered to be an absolute pathname 1362 * when the following condition is true: 1363 * 1364 * - For Unix, the first character of \p file_name is a slash (\c /). 1365 * For example, consider a \p file_name of \c /tmp/A.h5. 1366 * If that target file does not exist, the new \p file_name after 1367 * stripping will be \c A.h5. 1368 * - For Windows, there are 6 cases: 1369 * -# \p file_name is an absolute drive with an absolute pathname. 1370 * For example, consider a \p file_name of \c /tmp/A.h5. If that 1371 * target file does not exist, the new \p file_name after 1372 * stripping will be \c A.h5. 1373 * -# \p file_name is an absolute pathname without specifying drive 1374 * name. For example, consider a \p file_name of \c /tmp/A.h5. 1375 * If that target file does not exist, the new \p file_name after 1376 * stripping will be \c A.h5. 1377 * -# \p file_name is an absolute drive with a relative pathname. 1378 * For example, consider a \p file_name of \c /tmp/A.h5. If that 1379 * target file does not exist, the new \p file_name after 1380 * stripping will be \c tmp\A.h5. 1381 * -# \p file_name is in UNC (Uniform Naming Convention) format with 1382 * a server name, share name, and pathname. For example, consider 1383 * a \p file_name of \c /tmp/A.h5. If that target file does not 1384 * exist, the new \p file_name after stripping will be \c A.h5. 1385 * -# \p file_name is in Long UNC (Uniform Naming Convention) format 1386 * with a server name, share name, and pathname. For example, 1387 * consider a \p file_name of \c /tmp/A.h5. If that target file 1388 * does not exist, the new \p file_name after stripping will be 1389 * \c A.h5. 1390 * -# \p file_name is in Long UNC (Uniform Naming Convention) format 1391 * with an absolute drive and an absolute pathname. For example, 1392 * consider a \p file_name of \c /tmp/A.h5. If that target file 1393 * does not exist, the new \p file_name after stripping will be 1394 * \c A.h5. 1395 * 1396 * The library opens the target file \p file_name with the file access 1397 * property list that is set via H5Pset_elink_fapl() when the external 1398 * link link_name is accessed. If no such property list is set, the 1399 * library uses the file access property list associated with the file 1400 * of \p link_loc_id to open the target file. 1401 * 1402 * If an application requires additional control over file access 1403 * flags or the file access property list, see H5Pset_elink_cb(); this 1404 * function enables the use of an external link callback function as 1405 * described in H5L_elink_traverse_t(). 1406 * 1407 * \attention A file close degree property setting (H5Pset_fclose_degree()) in 1408 * the external link file access property list or in the external 1409 * link callback function will be ignored. A file opened by means of 1410 * traversing an external link is always opened with the weak file 1411 * close degree property setting, #H5F_CLOSE_WEAK . 1412 * 1413 * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_ud() 1414 * 1415 * \since 1.8.0 1416 */ 1417 H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, 1418 const char *link_name, hid_t lcpl_id, hid_t lapl_id); 1419 1420 /// \cond DEV 1421 /* API Wrappers for async routines */ 1422 /* (Must be defined _after_ the function prototype) */ 1423 /* (And must only defined when included in application code, not the library) */ 1424 #ifndef H5L_MODULE 1425 #define H5Lcreate_hard_async(...) H5Lcreate_hard_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1426 #define H5Lcreate_soft_async(...) H5Lcreate_soft_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1427 #define H5Ldelete_async(...) H5Ldelete_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1428 #define H5Ldelete_by_idx_async(...) H5Ldelete_by_idx_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1429 #define H5Lexists_async(...) H5Lexists_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1430 #define H5Literate_async(...) H5Literate_async(__FILE__, __func__, __LINE__, __VA_ARGS__) 1431 1432 /* Define "wrapper" versions of function calls, to allow compile-time values to 1433 * be passed in by language wrapper or library layer on top of HDF5. 1434 */ 1435 #define H5Lcreate_hard_async_wrap H5_NO_EXPAND(H5Lcreate_hard_async) 1436 #define H5Lcreate_soft_async_wrap H5_NO_EXPAND(H5Lcreate_soft_async) 1437 #define H5Ldelete_async_wrap H5_NO_EXPAND(H5Ldelete_async) 1438 #define H5Ldelete_by_idx_async_wrap H5_NO_EXPAND(H5Ldelete_by_idx_async) 1439 #define H5Lexists_async_wrap H5_NO_EXPAND(H5Lexists_async) 1440 #define H5Literate_async_wrap H5_NO_EXPAND(H5Literate_async) 1441 #endif /* H5L_MODULE */ 1442 /// \endcond 1443 1444 /* Symbols defined for compatibility with previous versions of the HDF5 API. 1445 * 1446 * Use of these symbols is deprecated. 1447 */ 1448 #ifndef H5_NO_DEPRECATED_SYMBOLS 1449 1450 /* Macros */ 1451 1452 /* Typedefs */ 1453 1454 //! <!-- [H5L_info1_t_snip] --> 1455 /** 1456 * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1()) 1457 */ 1458 typedef struct { 1459 H5L_type_t type; /**< Type of link */ 1460 hbool_t corder_valid; /**< Indicate if creation order is valid */ 1461 int64_t corder; /**< Creation order */ 1462 H5T_cset_t cset; /**< Character set of link name */ 1463 union { 1464 haddr_t address; /**< Address hard link points to */ 1465 size_t val_size; /**< Size of a soft link or UD link value */ 1466 } u; 1467 } H5L_info1_t; 1468 //! <!-- [H5L_info1_t_snip] --> 1469 1470 /** Prototype for H5Literate1() / H5Literate_by_name1() operator */ 1471 //! <!-- [H5L_iterate1_t_snip] --> 1472 typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data); 1473 //! <!-- [H5L_iterate1_t_snip] --> 1474 1475 /* Function prototypes */ 1476 /** 1477 * \ingroup H5L 1478 * 1479 * \brief Returns information about a link 1480 * 1481 * \fgdta_loc_id 1482 * \param[in] name Link name 1483 * \param[out] linfo Buffer in which link information is returned 1484 * \lapl_id 1485 * 1486 * \return \herr_t 1487 * 1488 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1489 * the function H5Lget_info2() or the macro H5Lget_info(). 1490 * 1491 * \details H5Lget_info1() returns information about the specified link through 1492 * the \p linfo argument. 1493 * 1494 * The location identifier, \p loc_id, specifies the location of the 1495 * link. A link name, \p name, interpreted relative to \p loc_id, 1496 * specifies the link being queried. 1497 * 1498 * \p lapl_id is the link access property list associated with the 1499 * link \p name. In the general case, when default link access 1500 * properties are acceptable, this can be passed in as #H5P_DEFAULT. 1501 * An example of a situation that requires a non-default link access 1502 * property list is when the link is an external link; an external 1503 * link may require that a link prefix be set in a link access 1504 * property list (see H5Pset_elink_prefix()). 1505 * 1506 * H5Lget_info1() returns information about name in the data structure 1507 * \ref H5L_info1_t, which is described below and defined in 1508 * H5Lpublic.h. This structure is returned in the buffer \p linfo. 1509 * \snippet this H5L_info1_t_snip 1510 * In the above struct, type specifies the link class. Valid values 1511 * include the following: 1512 * \link_types 1513 * There will be additional valid values if user-defined links have 1514 * been registered. 1515 * 1516 * \c corder specifies the link's creation order position while 1517 * \c corder_valid indicates whether the value in \c corder is valid. 1518 * 1519 * If \c corder_valid is \c true, the value in \c corder is known to 1520 * be valid; if \c corder_valid is \c false, the value in \c corder is 1521 * presumed to be invalid; 1522 * 1523 * \c corder starts at zero (0) and is incremented by one (1) as new 1524 * links are created. But higher-numbered entries are not adjusted 1525 * when a lower-numbered link is deleted; the deleted link's creation 1526 * order position is simply left vacant. In such situations, the value 1527 * of \c corder for the last link created will be larger than the 1528 * number of links remaining in the group. 1529 * 1530 * \c cset specifies the character set in which the link name is 1531 * encoded. Valid values include the following: 1532 * \csets 1533 * This value is set with #H5Pset_char_encoding. 1534 * 1535 * \c address and \c val_size are returned for hard and symbolic 1536 * links, respectively. Symbolic links include soft and external links 1537 * and some user-defined links. 1538 * 1539 * If the link is a hard link, \c address specifies the file address 1540 * that the link points to. 1541 * 1542 * If the link is a symbolic link, \c val_size will be the length of 1543 * the link value, e.g., the length of the HDF5 path name with a null 1544 * terminator. 1545 * 1546 * \version 1.12.0 Function was deprecated. 1547 * \version 1.8.2 Fortran subroutine added in this release. 1548 * \version 1.8.4 Fortran subroutine syntax changed in this release. 1549 * 1550 * \since 1.8.0 1551 * 1552 */ 1553 H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t lapl_id); 1554 /** 1555 * \ingroup H5L 1556 * 1557 * \brief Retrieves metadata for a link in a group, according to the order 1558 * within a field or index 1559 * 1560 * \loc_id 1561 * \param[in] group_name Group name 1562 * \idx_type 1563 * \order 1564 * \param[in] n Link position for which to retrieve information 1565 * \param[out] linfo Buffer in which link information is returned 1566 * \lapl_id 1567 * 1568 * \return \herr_t 1569 * 1570 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1571 * the function H5Lget_info_by_idx2() and the macro 1572 * H5Lget_info_by_idx(). 1573 * 1574 * \details H5Lget_info_by_idx1() returns the metadata for a link in a group 1575 * according to a specified field or index and a specified order. 1576 * 1577 * The link for which information is to be returned is specified by \p 1578 * idx_type, \p order, and \p n as follows: 1579 * 1580 * - \p idx_type specifies the field by which the links in \p 1581 * group_name are ordered. The links may be indexed on this field, 1582 * in which case operations seeking specific links are likely to 1583 * complete more quickly. 1584 * - \p order specifies the order in which 1585 * the links are to be referenced for the purposes of this function. 1586 * - \p n specifies the position of the subject link. Note that this 1587 * count is zero-based; 0 (zero) indicates that the function will 1588 * return the value of the first link; if \p n is 5, the function 1589 * will return the value of the sixth link; etc. 1590 * 1591 * For example, assume that \p idx_type, \p order, and \p n are 1592 * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME 1593 * indicates that the links are accessed in lexicographic order by 1594 * their names. #H5_ITER_DEC specifies that the list be traversed in 1595 * reverse order, or in decremented order. And 5 specifies that this 1596 * call to the function will return the metadata for the 6th link 1597 * (\c n + 1) from the end. 1598 * 1599 * See H5Literate1() for a list of valid values and further discussion 1600 * regarding \p idx_type and \p order. 1601 * 1602 * If \p loc_id specifies the group in which the link resides, 1603 * \p group_name can be a dot (\c .). 1604 * 1605 * \version 1.12.0 Function was renamed to H5Lget_index_by_idx1() and deprecated. 1606 * \version 1.8.4 Fortran subroutine syntax changed in this release. 1607 * \version 1.8.2 Fortran subroutine added in this release. 1608 * 1609 * \since 1.8.0 1610 * 1611 */ 1612 H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1613 H5_iter_order_t order, hsize_t n, H5L_info1_t *linfo /*out*/, 1614 hid_t lapl_id); 1615 /** 1616 * \ingroup TRAV 1617 * 1618 * \brief Iterates over links in a group, with user callback routine, 1619 * according to the order within an index. 1620 * 1621 * \group_id{grp_id} 1622 * \idx_type 1623 * \order 1624 * \param[in,out] idx Pointer to an iteration index to allow 1625 * continuing a previous iteration 1626 * \op 1627 * \op_data 1628 * \return \success{The return value of the first operator that returns 1629 * non-zero, or zero if all members were processed with no 1630 * operator returning non-zero.} 1631 * \return \failure{Negative if an error occurs in the library, or the negative 1632 * value returned by one of the operators.} 1633 * 1634 * \deprecated Deprecated in favor of H5Literate2(). 1635 * 1636 * \details H5Literate1() iterates through the links in a file or 1637 * group, \p group_id, in the order of the specified 1638 * index, \p idx_type, using a user-defined callback routine 1639 * \p op. H5Literate1() does not recursively follow links into 1640 * subgroups of the specified group. 1641 * 1642 * Three parameters are used to manage progress of the iteration: 1643 * \p idx_type, \p order, and \p idx_p. 1644 * 1645 * \p idx_type specifies the index to be used. If the links have 1646 * not been indexed by the index type, they will first be sorted by 1647 * that index then the iteration will begin; if the links have been 1648 * so indexed, the sorting step will be unnecessary, so the iteration 1649 * may begin more quickly. Valid values include the following: 1650 * \indexes 1651 * 1652 * \p order specifies the order in which objects are to be inspected 1653 * along the index \p idx_type. Valid values include the following: 1654 * \orders 1655 * 1656 * \p idx_p tracks the iteration and allows an iteration to be 1657 * resumed if it was stopped before all members were processed. It is 1658 * passed in by the application with a starting point and returned by 1659 * the library with the point at which the iteration stopped. 1660 * 1661 * \p op_data is a user-defined pointer to the data required to 1662 * process links in the course of the iteration. This pointer is 1663 * passed back to each step of the iteration in the \p op callback 1664 * function's \p op_data parameter. \p op is invoked for each link 1665 * encounter. 1666 * 1667 * \p op_data is passed to and from each iteration and can be used to 1668 * supply or aggregate information across iterations. 1669 * 1670 * \remark Same pattern of behavior as H5Giterate(). 1671 * 1672 * \note This function is also available through the H5Literate() macro. 1673 * 1674 * \warning The behavior of H5Literate1() is undefined if the link 1675 * membership of \p group_id changes during the iteration. 1676 * This does not limit the ability to change link destinations 1677 * while iterating, but caution is advised. 1678 * 1679 * \callback_note 1680 * 1681 * \version 1.12.0 Function was deprecated in this release. 1682 * \since 1.8.0 1683 * 1684 * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2() 1685 * 1686 */ 1687 H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, 1688 H5L_iterate1_t op, void *op_data); 1689 /** 1690 * \ingroup TRAV 1691 * 1692 * \brief Iterates through links in a group by its name 1693 * 1694 * \loc_id 1695 * \param[in] group_name Group name 1696 * \idx_type 1697 * \order 1698 * \param[in,out] idx iteration position at which to start (\Emph{IN}) or 1699 * position at which an interrupted iteration may be restarted 1700 * (\Emph{OUT}) 1701 * \op 1702 * \op_data 1703 * \lapl_id 1704 * 1705 * \return \success{The return value of the first operator that returns 1706 * non-zero, or zero if all members were processed with no 1707 * operator returning non-zero.} 1708 * \return \failure{Negative if an error occurs in the library, or the negative 1709 * value returned by one of the operators.} 1710 * 1711 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1712 * the function H5Literate_by_name2() or the macro 1713 * H5Literate_by_name(). 1714 * 1715 * \details H5Literate_by_name1() iterates through the links in a group 1716 * specified by \p loc_id and \p group_name, in the order of the 1717 * specified index, \p idx_type, using a user-defined callback routine 1718 * \p op. H5Literate_by_name1() does not recursively follow links into 1719 * subgroups of the specified group. 1720 * 1721 * \p idx_type specifies the index to be used. If the links have not 1722 * been indexed by the index type, they will first be sorted by that 1723 * index then the iteration will begin; if the links have been so 1724 * indexed, the sorting step will be unnecessary, so the iteration may 1725 * begin more quickly. Valid values include the following: 1726 * \indexes 1727 * 1728 * \p order specifies the order in which objects are to be inspected 1729 * along the index specified in \p idx_type. Valid values include the 1730 * following: 1731 * \orders 1732 * 1733 * \p idx allows an interrupted iteration to be resumed; it is 1734 * passed in by the application with a starting point and returned by 1735 * the library with the point at which the iteration stopped. 1736 * 1737 * \warning H5Literate_by_name1() assumes that the membership of the group being 1738 * iterated over remains unchanged through the iteration; if any of the 1739 * links in the group change during the iteration, the function's 1740 * behavior is undefined. Note, however, that objects pointed to by the 1741 * links can be modified. 1742 * 1743 * \note H5Literate_by_name1() is not recursive. In particular, if a member of 1744 * \p group_name is found to be a group, call it \c subgroup_a, 1745 * H5Literate_by_name1() does not examine the members of \c subgroup_a. 1746 * When recursive iteration is required, the application must handle the 1747 * recursion, explicitly calling H5Literate_by_name1() on discovered 1748 * subgroups. 1749 * 1750 * \callback_note 1751 * 1752 * \note H5Literate_by_name1() is the same as H5Giterate(), except that 1753 * H5Giterate() always proceeds in lexicographic order. 1754 * 1755 * \version 1.12.0 Function H5Literate_by_name() was renamed to 1756 * H5Literate_by_name1() and deprecated. 1757 * \version 1.8.8 Fortran subroutine added. 1758 * 1759 * \since 1.8.0 1760 * 1761 */ 1762 H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1763 H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data, 1764 hid_t lapl_id); 1765 /** 1766 * \ingroup TRAV 1767 * 1768 * \brief Recursively visits all links starting from a specified group 1769 * 1770 * \group_id{grp_id} 1771 * \idx_type 1772 * \order 1773 * \op 1774 * \op_data 1775 * 1776 * \return \success{The return value of the first operator that returns 1777 * non-zero, or zero if all members were processed with no 1778 * operator returning non-zero.} 1779 * \return \failure{Negative if an error occurs in the library, or the negative 1780 * value returned by one of the operators.} 1781 * 1782 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1783 * the function H5Lvisit2() or the macro H5Lvisit(). 1784 * 1785 * \details H5Lvisit1() is a recursive iteration function to visit all links in 1786 * and below a group in an HDF5 file, thus providing a mechanism for 1787 * an application to perform a common set of operations across all of 1788 * those links or a dynamically selected subset. For non-recursive 1789 * iteration across the members of a group, see H5Literate1(). 1790 * 1791 * The group serving as the root of the iteration is specified by its 1792 * group or file identifier, \p group_id. 1793 * 1794 * Two parameters are used to establish the iteration: \p idx_type and 1795 * \p order. 1796 * 1797 * \p idx_type specifies the index to be used. If the links have not 1798 * been indexed by the index type, they will first be sorted by that 1799 * index then the iteration will begin; if the links have been so 1800 * indexed, the sorting step will be unnecessary, so the iteration may 1801 * begin more quickly. Valid values include the following: 1802 * \indexes 1803 * 1804 * Note that the index type passed in \p idx_type is a best effort 1805 * setting. If the application passes in a value indicating iteration 1806 * in creation order and a group is encountered that was not tracked 1807 * in creation order, that group will be iterated over in 1808 * lexicographic order by name, or name order. (Name order is the 1809 * native order used by the HDF5 library and is always available.) 1810 * 1811 * \p order specifies the order in which objects are to be inspected 1812 * along the index specified in \p idx_type. Valid values include the 1813 * following: 1814 * \orders 1815 * 1816 * \p op is a callback function of type \ref H5L_iterate1_t that is invoked 1817 * for each link encountered. 1818 * \snippet this H5L_iterate1_t_snip 1819 * 1820 * The \ref H5L_info1_t struct is defined (in H5Lpublic.h) as follows: 1821 * \snippet this H5L_info1_t_snip 1822 * 1823 * The possible return values from the callback function, and the 1824 * effect of each, are as follows: 1825 * \li Zero causes the visit iterator to continue, returning zero when 1826 * all group members have been processed. 1827 * \li A positive value causes the visit iterator to immediately 1828 * return that positive value, indicating short-circuit success. 1829 * \li A negative value causes the visit iterator to immediately 1830 * return that value, indicating failure. 1831 * 1832 * The H5Lvisit1() \p op_data parameter is a user-defined pointer to 1833 * the data required to process links in the course of the iteration. 1834 * This pointer is passed back to each step of the iteration in the 1835 * \p op callback function's \p op_data parameter. 1836 * 1837 * H5Lvisit1() and H5Ovisit1() are companion functions: one for 1838 * examining and operating on links; the other for examining and 1839 * operating on the objects that those links point to. Both functions 1840 * ensure that by the time the function completes successfully, every 1841 * link or object below the specified point in the file has been 1842 * presented to the application for whatever processing the 1843 * application requires. 1844 * 1845 * \callback_note 1846 * 1847 * \version 1.12.0 Function was renamed from H5Lvisit() to H5Lvisit1() and 1848 * deprecated. 1849 * 1850 * \since 1.8.0 1851 * 1852 */ 1853 H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, 1854 void *op_data); 1855 /** 1856 * \ingroup TRAV 1857 * 1858 * \brief Recursively visits all links starting from a specified group 1859 * 1860 * \loc_id 1861 * \param[in] group_name Group name 1862 * \idx_type 1863 * \order 1864 * \op 1865 * \op_data 1866 * \lapl_id 1867 * 1868 * \return \success{The return value of the first operator that returns 1869 * non-zero, or zero if all members were processed with no 1870 * operator returning non-zero.} 1871 * \return \failure{Negative if an error occurs in the library, or the negative 1872 * value returned by one of the operators.} 1873 * 1874 * \deprecated As of HDF5-1.12 this function has been deprecated in favor of 1875 * the function H5Lvisit_by_name2() or the macro H5Lvisit_by_name(). 1876 * 1877 * \details H5Lvisit_by_name1() is a recursive iteration function to visit all 1878 * links in and below a group in an HDF5 file, thus providing a 1879 * mechanism for an application to perform a common set of operations 1880 * across all of those links or a dynamically selected subset. For 1881 * non-recursive iteration across the members of a group, see 1882 * H5Literate1(). 1883 * 1884 * The group serving as the root of the iteration is specified by the 1885 * \p loc_id / \p group_name parameter pair. \p loc_id specifies a 1886 * file or group; group_name specifies either a group in the file 1887 * (with an absolute name based in the file's root group) or a group 1888 * relative to \p loc_id. If \p loc_id fully specifies the group that 1889 * is to serve as the root of the iteration, group_name should be '.' 1890 * (a dot). (Note that when \p loc_id fully specifies the group 1891 * that is to serve as the root of the iteration, the user may wish to 1892 * consider using H5Lvisit1() instead of H5Lvisit_by_name1().) 1893 * 1894 * Two parameters are used to establish the iteration: \p idx_type and 1895 * \p order. 1896 * 1897 * \p idx_type specifies the index to be used. If the links have not 1898 * been indexed by the index type, they will first be sorted by that 1899 * index then the iteration will begin; if the links have been so 1900 * indexed, the sorting step will be unnecessary, so the iteration may 1901 * begin more quickly. Valid values include the following: 1902 * \indexes 1903 * 1904 * Note that the index type passed in \p idx_type is a best effort 1905 * setting. If the application passes in a value indicating iteration 1906 * in creation order and a group is encountered that was not tracked 1907 * in creation order, that group will be iterated over in 1908 * lexicographic order by name, or name order. (Name order is the 1909 * native order used by the HDF5 library and is always available.) 1910 * 1911 * \p order specifies the order in which objects are to be inspected 1912 * along the index specified in \p idx_type. Valid values include the 1913 * following: 1914 * \orders 1915 * 1916 * The \p op callback function, the related \ref H5L_info1_t 1917 * \c struct, and the effect that the callback function's return value 1918 * has on the application are described in H5Lvisit1(). 1919 * 1920 * The H5Lvisit_by_name1() \p op_data parameter is a user-defined 1921 * pointer to the data required to process links in the course of the 1922 * iteration. This pointer is passed back to each step of the 1923 * iteration in the callback function's \p op_data parameter. 1924 * 1925 * \p lapl_id is a link access property list. In the general case, 1926 * when default link access properties are acceptable, this can be 1927 * passed in as #H5P_DEFAULT. An example of a situation that requires 1928 * a non-default link access property list is when the link is an 1929 * external link; an external link may require that a link prefix be 1930 * set in a link access property list (see H5Pset_elink_prefix()). 1931 * 1932 * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion 1933 * functions: one for examining and operating on links; the other for 1934 * examining and operating on the objects that those links point to. 1935 * Both functions ensure that by the time the function completes 1936 * successfully, every link or object below the specified point in the 1937 * file has been presented to the application for whatever processing 1938 * the application requires. 1939 * 1940 * \callback_note 1941 * 1942 * \version 1.12.0 Function renamed from H5Lvisit_by_name() to 1943 * H5Lvisit_by_name1() and deprecated. 1944 * 1945 * \since 1.8.0 1946 * 1947 */ 1948 H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, 1949 H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id); 1950 1951 #endif /* H5_NO_DEPRECATED_SYMBOLS */ 1952 1953 #ifdef __cplusplus 1954 } 1955 #endif 1956 #endif /* H5Lpublic_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |