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