H5Lpublic.h 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * Copyright by the Board of Trustees of the University of Illinois. *
  4. * All rights reserved. *
  5. * *
  6. * This file is part of HDF5. The full HDF5 copyright notice, including *
  7. * terms governing use, modification, and redistribution, is contained in *
  8. * the COPYING file, which can be found at the root of the source code *
  9. * distribution tree, or in https://www.hdfgroup.org/licenses. *
  10. * If you do not have access to either file, you may request a copy from *
  11. * help@hdfgroup.org. *
  12. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  13. /*-------------------------------------------------------------------------
  14. *
  15. * Created: H5Lpublic.h
  16. * Dec 1 2005
  17. * James Laird
  18. *
  19. * Purpose: Public declarations for the H5L package (links)
  20. *
  21. *-------------------------------------------------------------------------
  22. */
  23. #ifndef H5Lpublic_H
  24. #define H5Lpublic_H
  25. /* Public headers needed by this file */
  26. #include "H5public.h" /* Generic Functions */
  27. #include "H5Ipublic.h" /* IDs */
  28. #include "H5Opublic.h" /* Object Headers */
  29. #include "H5Tpublic.h" /* Datatypes */
  30. /*****************/
  31. /* Public Macros */
  32. /*****************/
  33. /**
  34. * \brief Maximum length of a link's name
  35. *
  36. * The maximum length of a link's name is encoded in a 32-bit unsigned integer.
  37. */
  38. #define H5L_MAX_LINK_NAME_LEN UINT32_MAX
  39. /**
  40. * \brief Macro to indicate operation occurs on same location
  41. */
  42. #define H5L_SAME_LOC 0 /* (hid_t) */
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46. /*******************/
  47. /* Public Typedefs */
  48. /*******************/
  49. /**
  50. * \brief Link class types.
  51. *
  52. * Values less than 64 are reserved for the HDF5 library's internal use. Values
  53. * 64 to 255 are for "user-defined" link class types; these types are defined
  54. * by HDF5 but their behavior can be overridden by users. Users who want to
  55. * create new classes of links should contact the HDF5 development team at
  56. * mailto:help@hdfgroup.org. These values can never change because they appear
  57. * in HDF5 files.
  58. */
  59. typedef enum {
  60. H5L_TYPE_ERROR = (-1), /**< Invalid link type id */
  61. H5L_TYPE_HARD = 0, /**< Hard link id */
  62. H5L_TYPE_SOFT = 1, /**< Soft link id */
  63. H5L_TYPE_EXTERNAL = 64, /**< External link id */
  64. H5L_TYPE_MAX = 255 /**< Maximum link type id */
  65. } H5L_type_t;
  66. /**
  67. * \brief Maximum value link value for "built-in" link types
  68. */
  69. #define H5L_TYPE_BUILTIN_MAX H5L_TYPE_SOFT
  70. /**
  71. * \brief Link ids at or above this value are "user-defined" link types.
  72. */
  73. #define H5L_TYPE_UD_MIN H5L_TYPE_EXTERNAL
  74. /**
  75. * \brief Maximum link id value for "user-defined" link types.
  76. */
  77. #define H5L_TYPE_UD_MAX H5L_TYPE_MAX
  78. /**
  79. * \brief Information struct for links
  80. */
  81. //! <!-- [H5L_info2_t_snip] -->
  82. typedef struct {
  83. H5L_type_t type; /**< Type of link */
  84. hbool_t corder_valid; /**< Indicate if creation order is valid */
  85. int64_t corder; /**< Creation order */
  86. H5T_cset_t cset; /**< Character set of link name */
  87. union {
  88. H5O_token_t token; /**< Token of location that hard link points to */
  89. size_t val_size; /**< Size of a soft link or user-defined link value */
  90. } u;
  91. } H5L_info2_t;
  92. //! <!-- [H5L_info2_t_snip] -->
  93. /**
  94. * \brief Prototype for H5Literate2(), H5Literate_by_name2() operator
  95. *
  96. * The H5O_token_t version is used in the VOL layer and future public API calls.
  97. */
  98. //! <!-- [H5L_iterate2_t_snip] -->
  99. typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, void *op_data);
  100. //! <!-- [H5L_iterate2_t_snip] -->
  101. /**
  102. * \brief Callback for external link traversal
  103. */
  104. typedef herr_t (*H5L_elink_traverse_t)(const char *parent_file_name, const char *parent_group_name,
  105. const char *child_file_name, const char *child_object_name,
  106. unsigned *acc_flags, hid_t fapl_id, void *op_data);
  107. /********************/
  108. /* Public Variables */
  109. /********************/
  110. /*********************/
  111. /* Public Prototypes */
  112. /*********************/
  113. /**
  114. * \ingroup H5L
  115. *
  116. * \brief Moves a link within an HDF5 file
  117. *
  118. * \fgdta_loc_id{src_loc}
  119. * \param[in] src_name Original link name
  120. * \fgdta_loc_id{dst_loc}
  121. * \param[in] dst_name New link name
  122. * \lcpl_id
  123. * \lapl_id
  124. *
  125. * \return \herr_t
  126. *
  127. * \details H5Lmove() moves a link within an HDF5 file. The original link,
  128. * \p src_name, is removed from \p src_loc and the new link,
  129. * \p dst_name, is inserted at dst_loc. This change is
  130. * accomplished as an atomic operation.
  131. *
  132. * \p src_loc and \p src_name identify the original link.
  133. * \p src_loc is the original location identifier; \p src_name is
  134. * the path to the link and is interpreted relative to \p src_loc.
  135. *
  136. * \p dst_loc and \p dst_name identify the new link. \p dst_loc is
  137. * either a file or group identifier; \p dst_name is the path to
  138. * the link and is interpreted relative to \p dst_loc.
  139. *
  140. * \p lcpl_id and \p lapl_id are the link creation and link access
  141. * property lists, respectively, associated with the new link,
  142. * \p dst_name.
  143. *
  144. * Through these property lists, several properties are available to
  145. * govern the behavior of H5Lmove(). The property controlling creation
  146. * of missing intermediate groups is set in the link creation property
  147. * list with H5Pset_create_intermediate_group(); H5Lmove() ignores any
  148. * other properties in the link creation property list. Properties
  149. * controlling character encoding, link traversals, and external link
  150. * prefixes are set in the link access property list with
  151. * H5Pset_char_encoding(), H5Pset_nlinks(), and H5Pset_elink_prefix(),
  152. * respectively.
  153. *
  154. * \note Note that H5Lmove() does not modify the value of the link; the new
  155. * link points to the same object as the original link pointed to.
  156. * Furthermore, if the object pointed to by the original link was already
  157. * open with a valid object identifier, that identifier will remain valid
  158. * after the call to H5Lmove().
  159. *
  160. * \attention Exercise care in moving links as it is possible to render data in
  161. * a file inaccessible with H5Lmove(). If the link being moved is on
  162. * the only path leading to an HDF5 object, that object may become
  163. * permanently inaccessible in the file.
  164. *
  165. * \since 1.8.0
  166. *
  167. *-------------------------------------------------------------------------
  168. */
  169. 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,
  170. hid_t lapl_id);
  171. /**
  172. * \ingroup H5L
  173. *
  174. * \brief Creates an identical copy of a link with the same creation time and
  175. * target. The new link can have a different name and be in a different
  176. * location than the original.
  177. *
  178. * \fgdt_loc_id{src_loc}
  179. * \param[in] src_name Name of the link to be copied
  180. * \fgdt_loc_id{dst_loc}
  181. * \param[in] dst_name Name to be assigned to the new copy
  182. * \lcpl_id
  183. * \lapl_id
  184. * \return \herr_t
  185. *
  186. * \details H5Lcopy() copies the link specified by \p src_name from the location
  187. * specified by \p src_loc_id to the location specified by
  188. * \p dst_loc_id. The new copy of the link is created with the name
  189. * \p dst_name.
  190. *
  191. * If \p dst_loc_id is a file identifier, \p dst_name will be
  192. * interpreted relative to that file’s root group.
  193. *
  194. * The new link is created with the creation and access property lists
  195. * specified by \p lcpl_id and \p lapl_id. The interpretation of
  196. * \p lcpl_id is limited in the manner described in the next paragraph.
  197. *
  198. * H5Lcopy() retains the creation time and the target of the original
  199. * link. However, since the link may be renamed, the character
  200. * encoding is that specified in \p lcpl_id rather than that of the
  201. * original link. Other link creation properties are ignored.
  202. *
  203. * If the link is a soft link, also known as a symbolic link, its
  204. * target is interpreted relative to the location of the copy.
  205. *
  206. * Several properties are available to govern the behavior of
  207. * H5Lcopy(). These properties are set in the link creation and access
  208. * property lists, \p lcpl_id and \p lapl_id, respectively. The
  209. * property controlling creation of missing intermediate groups is set
  210. * in the link creation property list with
  211. * H5Pset_create_intermediate_group(); this function ignores any
  212. * other properties in the link creation property list. Properties
  213. * controlling character encoding, link traversals, and external link
  214. * prefixes are set in the link access property list with
  215. * H5Pset_char_encoding(), H5Pset_nlinks(), and
  216. * H5Pset_elink_prefix().
  217. *
  218. * \note H5Lcopy() does not affect the object that the link points to.
  219. *
  220. * \attention H5Lcopy() cannot copy hard links across files as a hard link is
  221. * not valid without a target object; to copy objects from one file
  222. * to another, see H5Ocopy().
  223. *
  224. * \see H5Ocopy()
  225. *
  226. * \since 1.8.0
  227. *
  228. */
  229. 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,
  230. hid_t lapl_id);
  231. /**
  232. * \ingroup H5L
  233. *
  234. * \brief Creates a hard link to an object
  235. *
  236. * \fgdta_loc_id{cur_loc}
  237. * \param[in] cur_name Name of the target object, which must already exist
  238. * \fgdta_loc_id{dst_loc}
  239. * \param[in] dst_name The name of the new link
  240. * \lcpl_id
  241. * \lapl_id
  242. *
  243. * \return \herr_t
  244. *
  245. * \details H5Lcreate_hard() creates a new hard link to a pre-existing object
  246. * in an HDF5 file.
  247. *
  248. * \p cur_loc and \p cur_name specify the location
  249. * and name, respectively, of the target object, i.e., the object that
  250. * the new hard link points to. \p dst_loc and \p dst_name specify the
  251. * location and name, respectively, of the new hard link.
  252. *
  253. * \p cur_name and \p dst_name are interpreted relative to \p cur_loc
  254. * and \p dst_loc, respectively. If \p cur_loc and \p dst_loc are the
  255. * same location, the HDF5 macro #H5L_SAME_LOC can be used for either
  256. * parameter (but not both).
  257. *
  258. * \p lcpl_id and \p lapl_id are the link creation and access property
  259. * lists associated with the new link.
  260. *
  261. * \note Hard and soft links are for use only if the target object is in the
  262. * current file. If the desired target object is in a different file from
  263. * the new link, an external link may be created with
  264. * H5Lcreate_external().
  265. *
  266. * \note The HDF5 library keeps a count of all hard links pointing to an
  267. * object; if the hard link count reaches zero (0), the object will be
  268. * deleted from the file. Creating new hard links to an object will
  269. * prevent it from being deleted if other links are removed. The
  270. * library maintains no similar count for soft links and they can dangle.
  271. *
  272. * \note The new link may be one of many that point to that object.
  273. *
  274. * \since 1.8.0
  275. *
  276. */
  277. H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, const char *dst_name,
  278. hid_t lcpl_id, hid_t lapl_id);
  279. /**
  280. * --------------------------------------------------------------------------
  281. * \ingroup ASYNC
  282. * \async_variant_of{H5Lcreate_hard}
  283. */
  284. H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_line,
  285. hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id,
  286. const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id);
  287. /**
  288. * \ingroup H5L
  289. *
  290. * \brief Creates a soft link
  291. *
  292. * \param[in] link_target An HDF5 path name
  293. * \fgdta_loc_id{link_loc_id}
  294. * \param[in] link_name The name of the new link
  295. * \lcpl_id
  296. * \lapl_id
  297. *
  298. * \return \herr_t
  299. *
  300. * \details H5Lcreate_soft() creates a new soft link to an object in an HDF5
  301. * file.
  302. *
  303. * \p link_target specifies the HDF5 path name the soft link contains.
  304. * \p link_target can be an arbitrary HDF5 path name and is
  305. * interpreted only at lookup time. This path may be absolute in the
  306. * file or relative to \p link_loc_id.
  307. *
  308. * \p link_loc_id and \p link_name specify the location and name,
  309. * respectively, of the new soft link. \p link_name is interpreted
  310. * relative to \p link_loc_id and must contain only the name of the soft
  311. * link; \p link_name may not contain any additional path elements.
  312. *
  313. * If \p link_loc_id is a group identifier, the object pointed to by
  314. * \p link_name will be accessed as a member of that group. If
  315. * \p link_loc_id is a file identifier, the object will be accessed as a
  316. * member of the file's root group.
  317. *
  318. * \p lcpl_id and \p lapl_id are the link creation and access property
  319. * lists associated with the new link.
  320. *
  321. * For instance, if target_path is \c ./foo, \p link_loc_id specifies
  322. * \c ./x/y/bar, and the name of the new link is \c new_link, then a
  323. * subsequent request for \c ./x/y/bar/new_link will return same the
  324. * object as would be found at \c ./foo.
  325. *
  326. * \note H5Lcreate_soft() is for use only if the target object is in the
  327. * current file. If the desired target object is in a different file from
  328. * the new link, use H5Lcreate_external() to create an external link.
  329. *
  330. * \note Soft links and external links are also known as symbolic links as they
  331. * use a name to point to an object; hard links employ an object’s
  332. * address in the file.
  333. *
  334. * \note Unlike hard links, a soft link in an HDF5 file is allowed to dangle,
  335. * meaning that the target object need not exist at the time that the
  336. * link is created.
  337. *
  338. * \note The HDF5 library does not keep a count of soft links as it does of
  339. * hard links.
  340. *
  341. * \note The new link may be one of many that point to that object.
  342. *
  343. * \see H5Lcreate_hard(), H5Lcreate_external()
  344. *
  345. * \since 1.8.0
  346. *
  347. */
  348. H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id,
  349. hid_t lapl_id);
  350. /**
  351. * --------------------------------------------------------------------------
  352. * \ingroup ASYNC
  353. * \async_variant_of{H5Lcreate_soft}
  354. */
  355. H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_line,
  356. const char *link_target, hid_t link_loc_id, const char *link_name,
  357. hid_t lcpl_id, hid_t lapl_id, hid_t es_id);
  358. /**
  359. * \ingroup H5L
  360. *
  361. * \brief Removes a link from a group
  362. *
  363. * \fgdta_loc_id
  364. * \param[in] name Name of the link to delete
  365. * \lapl_id
  366. *
  367. * \return \herr_t
  368. *
  369. * \details H5Ldelete() removes the link specified by \p name from the location
  370. * \p loc_id.
  371. *
  372. * If the link being removed is a hard link, H5Ldelete() also
  373. * decrements the link count for the object to which name points.
  374. * Unless there is a duplicate hard link in that group, this action
  375. * removes the object to which name points from the group that
  376. * previously contained it.
  377. *
  378. * Object headers keep track of how many hard links refer to an
  379. * object; when the hard link count, also referred to as the reference
  380. * count, reaches zero, the object can be removed from the file. The
  381. * file space associated will then be released, i.e., identified in
  382. * memory as freespace. Objects which are open are not removed until
  383. * all identifiers to the object are closed.
  384. *
  385. * \attention Exercise caution in the use of H5Ldelete(); if the link being
  386. * removed is on the only path leading to an HDF5 object, that
  387. * object may become permanently inaccessible in the file.
  388. *
  389. * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_external()
  390. *
  391. * \since 1.8.0
  392. *
  393. */
  394. H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id);
  395. /**
  396. * --------------------------------------------------------------------------
  397. * \ingroup ASYNC
  398. * \async_variant_of{H5Ldelete}
  399. */
  400. H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
  401. const char *name, hid_t lapl_id, hid_t es_id);
  402. /**
  403. * \ingroup H5L
  404. *
  405. * \brief Removes the \Emph{n}-th link in a group
  406. *
  407. * \fgdta_loc_id
  408. * \param[in] group_name Name of subject group
  409. * \param[in] idx_type Index or field which determines the order
  410. * \param[in] order Order within field or index
  411. * \param[in] n Link for which to retrieve information
  412. * \lapl_id
  413. *
  414. * \return \herr_t
  415. *
  416. * \details H5Ldelete_by_idx() removes the \Emph{n}-th link in a group
  417. * according to the specified order, \p order, in the specified index,
  418. * \p index.
  419. *
  420. * If \p loc_id specifies the group in which the link resides,
  421. * \p group_name can be a dot (\c .).
  422. *
  423. * \see H5Ldelete()
  424. *
  425. * \since 1.8.0
  426. *
  427. */
  428. H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  429. H5_iter_order_t order, hsize_t n, hid_t lapl_id);
  430. /**
  431. * --------------------------------------------------------------------------
  432. * \ingroup ASYNC
  433. * \async_variant_of{H5Ldelete_by_idx}
  434. */
  435. H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_line,
  436. hid_t loc_id, const char *group_name, H5_index_t idx_type,
  437. H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id);
  438. /**
  439. * \ingroup H5L
  440. *
  441. * \brief Returns the value of a link
  442. *
  443. * \fgdta_loc_id
  444. * \param[in] name Link name
  445. * \param[out] buf The buffer to hold the link value
  446. * \param[in] size Maximum number of bytes of link value to be returned
  447. * \lapl_id
  448. *
  449. * \return \herr_t
  450. *
  451. * \details H5Lget_val() returns the value of link \p name. For smbolic links,
  452. * this is the path to which the link points, including the null
  453. * terminator. For external and user-defined links, it is the link
  454. * buffer.
  455. *
  456. * \p size is the size of \p buf and should be the size of the link
  457. * value being returned. This size value can be determined through a
  458. * call to H5Lget_info(); it is returned in the \c val_size field of
  459. * the \ref H5L_info_t \c struct.
  460. *
  461. * If \p size is smaller than the size of the returned value, then the
  462. * string stored in \p buf will be truncated to \p size bytes. For
  463. * soft links, this means that the value will not be null terminated.
  464. *
  465. * In the case of external links, the target file and object names are
  466. * extracted from \p buf by calling H5Lunpack_elink_val().
  467. *
  468. * The link class of link \p name can be determined with a call to
  469. * H5Lget_info().
  470. *
  471. * \p lapl_id specifies the link access property list associated with
  472. * the link \p name. In the general case, when default link access
  473. * properties are acceptable, this can be passed in as #H5P_DEFAULT. An
  474. * example of a situation that requires a non-default link access
  475. * property list is when the link is an external link; an external
  476. * link may require that a link prefix be set in a link access
  477. * property list (see H5Pset_elink_prefix()).
  478. *
  479. * This function should be used only after H5Lget_info() has been
  480. * called to verify that \p name is a symbolic link. This can be
  481. * determined from the \c link_type field of the \ref H5L_info_t
  482. * \c struct.
  483. *
  484. * \note This function will fail if called on a hard link.
  485. *
  486. * \see H5Lget_val_by_idx()
  487. *
  488. * \since 1.8.0
  489. *
  490. */
  491. H5_DLL herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id);
  492. /**
  493. * \ingroup H5L
  494. *
  495. * \brief Retrieves value of the \Emph{n}-th link in a group, according to the order within an index
  496. *
  497. * \fgdta_loc_id
  498. * \param[in] group_name Group name
  499. * \param[in] idx_type Type of index
  500. * \param[in] order Order within field or index
  501. * \param[in] n Link position for which to retrieve information
  502. * \param[out] buf The buffer to hold the link value
  503. * \param[in] size Maximum number of bytes of link value to be returned
  504. * \lapl_id
  505. *
  506. * \return \herr_t
  507. *
  508. * \details H5Lget_val_by_idx() retrieves the value of the \Emph{n}-th link in
  509. * a group, according to the specified order, \p order, within an
  510. * index, \p index.
  511. *
  512. * For soft links, the value is an HDF5 path name.
  513. *
  514. * For external links, this is a compound value containing file and
  515. * path name information; to use this external link information, it
  516. * must first be decoded with H5Lunpack_elink_val()
  517. *
  518. * For user-defined links, this value will be described in the
  519. * definition of the user-defined link type.
  520. *
  521. * \p loc_id specifies the location identifier of the group specified
  522. * by \p group_name.
  523. *
  524. * \p group_name specifies the group in which the link exists. If
  525. * \p loc_id already specifies the group in which the link exists,
  526. * \p group_name must be a dot (\c .).
  527. *
  528. * The size in bytes of link_val is specified in \p size. The size
  529. * value can be determined through a call to H5Lget_info_by_idx(); it
  530. * is returned in the \c val_size field of the \ref H5L_info_t
  531. * \c struct. If
  532. * size is smaller than the size of the returned value, then the
  533. * string stored in link_val will be truncated to size bytes. For soft
  534. * links, this means that the value will not be null terminated.
  535. *
  536. * If the type of the link is unknown or uncertain, H5Lget_val_by_idx()
  537. * should be called only after the type has been determined via a call
  538. * to H5Lget_info_by_idx().
  539. *
  540. * \note This function will fail if called on a hard link.
  541. *
  542. * \see H5Lget_val()
  543. *
  544. * \since 1.8.0
  545. *
  546. */
  547. H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  548. H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size,
  549. hid_t lapl_id);
  550. /**
  551. * \ingroup H5L
  552. *
  553. * \brief Determines whether a link with the specified name exists in a group
  554. *
  555. * \fgdta_loc_id
  556. * \param[in] name Link name
  557. * \lapl_id
  558. *
  559. * \return \herr_t
  560. *
  561. * \details H5Lexists() allows an application to determine whether the link \p
  562. * name exists in the location specified by \p loc_id. The link may be
  563. * of any type; only the presence of a link with that name is checked.
  564. *
  565. * Note that H5Lexists() verifies only that the target link exists. If
  566. * name includes either a relative path or an absolute path to the
  567. * target link, intermediate steps along the path must be verified
  568. * before the existence of the target link can be safely checked. If
  569. * the path is not verified, and an intermediate element of the path
  570. * does not exist, H5Lexists() will fail. The example in the next
  571. * paragraph illustrates one step-by-step method for verifying the
  572. * existence of a link with a relative or absolute path.
  573. *
  574. * \Bold{Example:} Use the following steps to verify the existence of
  575. * the link \c datasetD in the \c group group1/group2/softlink_to_group3/,
  576. * where \c group1 is a member of the group specified by \c loc_id:
  577. *
  578. * 1. First use H5Lexists() to verify that \c group1 exists.
  579. * 2. If \c group1 exists, use H5Lexists() again, this time with name
  580. * set to \c group1/group2, to verify that \c group2 exists.
  581. * 3. If \c group2 exists, use H5Lexists() with name set to
  582. * \c group1/group2/softlink_to_group3 to verify that
  583. * \c softlink_to_group3 exists.
  584. * 4. If \c softlink_to_group3 exists, you can now safely use
  585. * H5Lexists() with \c name set to
  586. * \c group1/group2/softlink_to_group3/datasetD to verify that the
  587. * target link, \c datasetD, exists.
  588. *
  589. * If the link to be verified is specified with an absolute path, the
  590. * same approach should be used, but starting with the first link in
  591. * the file’s root group. For instance, if \c datasetD were in
  592. * \c /group1/group2/softlink_to_group3, the first call to H5Lexists()
  593. * would have name set to \c /group1.
  594. *
  595. * Note that this is an outline and does not include all necessary
  596. * details. Depending on circumstances, for example, you may need to
  597. * verify that an intermediate link points to a group and that a soft
  598. * link points to an existing target.
  599. *
  600. * \note The behavior of H5Lexists() was changed in the 1.10 release in the
  601. * case where the root group, \c "/", is the name of the link. This
  602. * change is described below:
  603. * <ol>
  604. * <li>Let \c file denote a valid HDF5 file identifier, and let \c lapl
  605. * denote a valid link access property list identifier. A call to
  606. * H5Lexists() with arguments \c file, \c "/", and \c lapl
  607. * returns a positive value; in other words,
  608. * \Code{H5Lexists(file, "/", lapl)} returns a positive value.
  609. * In the HDF5 1.8 release, this function returns 0.</li>
  610. * <li>Let \c root denote a valid HDF5 group identifier that refers to the
  611. * root group of an HDF5 file, and let \c lapl denote a valid link
  612. * access property list identifier. A call to H5Lexists() with
  613. * arguments c root, \c "/", and \c lapl returns a positive value;
  614. * in other words, \Code{H5Lexists(root, "/", lapl)} returns a positive
  615. * value. In the HDF5 1.8 release, this function returns 0.</li>
  616. * </ol>
  617. * Note that the function accepts link names and path names. This is
  618. * potentially misleading to callers, and we plan to separate the
  619. * functionality for link names and path names in a future release.
  620. *
  621. * \attention H5Lexists() checks the existence of only the final element in a
  622. * relative or absolute path; it does not check any other path
  623. * elements. The function will therefore fail when both of the
  624. * following conditions exist:
  625. * - \c name is not local to the group specified by \c loc_id or,
  626. * if \c loc_id is something other than a group identifier, \c name
  627. * is not local to the root group.
  628. * - Any element of the relative path or absolute path in name,
  629. * except the target link, does not exist.
  630. *
  631. * \version 1.10.0 Function behavior changed in this release. (See the note.)
  632. * \since 1.8.0
  633. *
  634. */
  635. H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id);
  636. /**
  637. * --------------------------------------------------------------------------
  638. * \ingroup ASYNC
  639. * \async_variant_of{H5Lexists}
  640. */
  641. H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
  642. const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id);
  643. /**
  644. * \ingroup H5L
  645. *
  646. * \brief Returns information about a link
  647. *
  648. * \fgdta_loc_id
  649. * \param[in] name Link name
  650. * \param[out] linfo Buffer in which link information is returned
  651. * \lapl_id
  652. *
  653. * \return \herr_t
  654. *
  655. * \details H5Lget_info2() returns information about the specified link through
  656. * the \p linfo argument.
  657. *
  658. * The location identifier, \p loc_id, specifies the location of the
  659. * link. A link name, \p name, interpreted relative to \p loc_id,
  660. * specifies the link being queried.
  661. *
  662. * \p lapl_id is the link access property list associated with the
  663. * link name. In the general case, when default link access properties
  664. * are acceptable, this can be passed in as #H5P_DEFAULT. An example
  665. * of a situation that requires a non-default link access property
  666. * list is when the link is an external link; an external link may
  667. * require that a link prefix be set in a link access property list
  668. * (see H5Pset_elink_prefix()).
  669. *
  670. * H5Lget_info2() returns information about name in the data structure
  671. * H5L_info2_t, which is described below and defined in H5Lpublic.h.
  672. * This structure is returned in the buffer \p linfo.
  673. * \snippet this H5L_info2_t_snip
  674. * In the above struct, \c type specifies the link class. Valid values
  675. * include the following:
  676. * \link_types
  677. * There will be additional valid values if user-defined links have
  678. * been registered.
  679. *
  680. * \p corder specifies the link’s creation order position while
  681. * \p corder_valid indicates whether the value in corder is valid.
  682. *
  683. * If \p corder_valid is \c TRUE, the value in \p corder is known to
  684. * be valid; if \p corder_valid is \c FALSE, the value in \p corder is
  685. * presumed to be invalid; \p corder starts at zero (0) and is
  686. * incremented by one (1) as new links are created. But
  687. * higher-numbered entries are not adjusted when a lower-numbered link
  688. * is deleted; the deleted link's creation order position is simply
  689. * left vacant. In such situations, the value of \p corder for the
  690. * last link created will be larger than the number of links remaining
  691. * in the group.
  692. *
  693. * \p cset specifies the character set in which the link name is
  694. * encoded. Valid values include the following:
  695. * \csets
  696. * This value is set with H5Pset_char_encoding().
  697. *
  698. * \c token is the location that a hard link points to, and
  699. * \c val_size is the size of a soft link or user defined link value.
  700. * H5O_token_t is used in the VOL layer. It is defined in H5public.h
  701. * as:
  702. * \snippet H5public.h H5O_token_t_snip
  703. *
  704. * If the link is a symbolic link, \c val_size will be the length of
  705. * the link value, e.g., the length of the HDF5 path name with a null
  706. * terminator.
  707. *
  708. * \since 1.12.0
  709. *
  710. */
  711. H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, hid_t lapl_id);
  712. /**
  713. * \ingroup H5L
  714. *
  715. * \brief Retrieves metadata for a link in a group, according to the order
  716. * within a field or index
  717. *
  718. * \loc_id
  719. * \param[in] group_name Group name
  720. * \idx_type
  721. * \order
  722. * \param[in] n Link position for which to retrieve information
  723. * \param[out] linfo Buffer in which link information is returned
  724. * \lapl_id
  725. *
  726. * \return \herr_t
  727. *
  728. * \details H5get_info_by_idx2() returns the metadata for a link in a group
  729. * according to a specified field or index and a specified order. The
  730. * link for which information is to be returned is specified by \p
  731. * idx_type, \p order, and \p n as follows:
  732. *
  733. * - \p idx_type specifies the field by which the links in \p
  734. * group_name are ordered. The links may be indexed on this field,
  735. * in which case operations seeking specific links are likely to
  736. * complete more quickly.
  737. * - \p order specifies the order in which
  738. * the links are to be referenced for the purposes of this function.
  739. * - \p n specifies the position of the subject link. Note that this
  740. * count is zero-based; 0 (zero) indicates that the function will
  741. * return the value of the first link; if \p n is 5, the function
  742. * will return the value of the sixth link; etc.
  743. *
  744. * For example, assume that \p idx_type, \p order, and \p n are
  745. * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME
  746. * indicates that the links are accessed in lexicographic order by
  747. * their names. #H5_ITER_DEC specifies that the list be traversed in
  748. * reverse order, or in decremented order. And 5 specifies that this
  749. * call to the function will return the metadata for the 6th link
  750. * (\c n + 1) from the end.
  751. *
  752. * See H5Literate2() for a list of valid values and further discussion
  753. * regarding \p idx_type and \p order.
  754. *
  755. * If \p loc_id specifies the group in which the link resides,
  756. * \p group_name can be a dot (\c .).
  757. *
  758. * \since 1.12.0
  759. *
  760. * \see H5Lget_info2()
  761. *
  762. */
  763. H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  764. H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id);
  765. /**
  766. * \ingroup H5L
  767. *
  768. * \brief Retrieves name of the \Emph{n}-th link in a group, according to the
  769. * order within a specified field or index
  770. *
  771. * \loc_id
  772. * \param[in] group_name Group name
  773. * \idx_type
  774. * \order
  775. * \param[in] n Link position for which to retrieve information
  776. * \param[out] name Buffer in which link name is returned
  777. * \param[in] size Size in bytes of \p name
  778. * \lapl_id
  779. *
  780. * \return Returns the size of the link name if successful; otherwise returns a
  781. * negative value.
  782. *
  783. * \details H5get_name_by_idx() retrieves the name of the \Emph{n}-th link in a
  784. * group, according to the specified order, \p order, within a specified
  785. * field or index, \p idx_type.
  786. *
  787. * \p idx_type specifies the index that is used. Valid values include
  788. * the following:
  789. * \indexes
  790. *
  791. * \p order specifies the order in which objects are inspected along
  792. * the index specified in \p idx_type. Valid values include the
  793. * following:
  794. * \orders
  795. *
  796. * If \p loc_id specifies the group in which the link resides,
  797. * \p group_name can be a dot (\c .).
  798. *
  799. * The size in bytes of name is specified in \p size. If \p size is
  800. * unknown, it can be determined via an initial H5Lget_name_by_idx()
  801. * call with name set to NULL; the function's return value will be the
  802. * size of the name.
  803. *
  804. * \note Please note that in order for the specified index to correspond to the
  805. * creation order index, \p order must be set to #H5_ITER_INC or
  806. * #H5_ITER_DEC when calling H5Lget_name_by_idx(). \note The index \p n
  807. * passed to H5Lget_name_by_idx() is the index of the link within the
  808. * link table, sorted according to \p order and \p idx_type. If order is
  809. * #H5_ITER_NATIVE, then the link table is not sorted, and it does not
  810. * matter what \p idx_type is. Specifying #H5_ITER_NATIVE does not
  811. * guarantee any particular order, only that it remains consistent.
  812. *
  813. * \since 1.8.0
  814. *
  815. */
  816. H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  817. H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
  818. hid_t lapl_id);
  819. /**
  820. * \ingroup TRAV
  821. *
  822. * \brief Iterates over links in a group, with user callback routine,
  823. * according to the order within an index.
  824. *
  825. * \group_id{grp_id}
  826. * \idx_type
  827. * \order
  828. * \param[in,out] idx Pointer to an iteration index to allow
  829. * continuing a previous iteration
  830. * \op
  831. * \op_data
  832. * \return \success{The return value of the first operator that returns
  833. * non-zero, or zero if all members were processed with no
  834. * operator returning non-zero.}
  835. * \return \failure{Negative if an error occurs in the library, or the negative
  836. * value returned by one of the operators.}
  837. *
  838. * \details H5Literate2() iterates through the links in a file or
  839. * group, \p group_id, in the order of the specified
  840. * index, \p idx_type, using a user-defined callback routine
  841. * \p op. H5Literate2() does not recursively follow links into
  842. * subgroups of the specified group.
  843. *
  844. * Three parameters are used to manage progress of the iteration:
  845. * \p idx_type, \p order, and \p idx_p.
  846. *
  847. * \p idx_type specifies the index to be used. If the links have
  848. * not been indexed by the index type, they will first be sorted by
  849. * that index then the iteration will begin; if the links have been
  850. * so indexed, the sorting step will be unnecessary, so the iteration
  851. * may begin more quickly.
  852. *
  853. * \p order specifies the order in which objects are to be inspected
  854. * along the index \p idx_type.
  855. *
  856. * \p idx_p tracks the iteration and allows an iteration to be
  857. * resumed if it was stopped before all members were processed. It is
  858. * passed in by the application with a starting point and returned by
  859. * the library with the point at which the iteration stopped.
  860. *
  861. * \p op_data is a user-defined pointer to the data required to
  862. * process links in the course of the iteration. This pointer is
  863. * passed back to each step of the iteration in the \p op callback
  864. * function's \p op_data parameter. \p op is invoked for each link
  865. * encounter.
  866. *
  867. * \p op_data is passed to and from each iteration and can be used to
  868. * supply or aggregate information across iterations.
  869. *
  870. * \remark Same pattern of behavior as H5Giterate().
  871. *
  872. * \note This function is also available through the H5Literate() macro.
  873. *
  874. * \warning The behavior of H5Literate2() is undefined if the link
  875. * membership of \p group_id changes during the iteration.
  876. * This does not limit the ability to change link destinations
  877. * while iterating, but caution is advised.
  878. *
  879. *
  880. * \since 1.12.0
  881. *
  882. * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()
  883. *
  884. */
  885. H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
  886. H5L_iterate2_t op, void *op_data);
  887. /**
  888. * --------------------------------------------------------------------------
  889. * \ingroup ASYNC
  890. * \async_variant_of{H5Literate}
  891. */
  892. H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
  893. H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op,
  894. void *op_data, hid_t es_id);
  895. /**
  896. * \ingroup TRAV
  897. *
  898. * \brief Iterates through links in a group
  899. *
  900. * \loc_id
  901. * \param[in] group_name Group name
  902. * \idx_type
  903. * \order
  904. * \param[in,out] idx iteration position at which to start (\Emph{IN}) or
  905. * position at which an interrupted iteration may be restarted
  906. * (\Emph{OUT})
  907. * \op
  908. * \op_data
  909. * \lapl_id
  910. * \return \success{The return value of the first operator that returns
  911. * non-zero, or zero if all members were processed with no
  912. * operator returning non-zero.}
  913. * \return \failure{Negative if an error occurs in the library, or the negative
  914. * value returned by one of the operators.}
  915. *
  916. * \details H5Literate_by_name2() iterates through the links in a group
  917. * specified by \p loc_id and \p group_name, in the order of the
  918. * specified index, \p idx_type, using a user-defined callback routine
  919. * \p op. H5Literate_by_name2() does not recursively follow links into
  920. * subgroups of the specified group.
  921. *
  922. * \p idx_type specifies the index to be used. If the links have not
  923. * been indexed by the index type, they will first be sorted by that
  924. * index then the iteration will begin; if the links have been so
  925. * indexed, the sorting step will be unnecessary, so the iteration may
  926. * begin more quickly. Valid values include the following:
  927. * \indexes
  928. *
  929. * \p order specifies the order in which objects are to be inspected
  930. * along the index specified in \p idx_type. Valid values include the
  931. * following:
  932. * \orders
  933. *
  934. * \p idx_p allows an interrupted iteration to be resumed; it is
  935. * passed in by the application with a starting point and returned by
  936. * the library with the point at which the iteration stopped.
  937. *
  938. * \note H5Literate_by_name2() is not recursive. In particular, if a member of
  939. * \p group_name is found to be a group, call it \c subgroup_a,
  940. * H5Literate_by_name2() does not examine the members of \c subgroup_a.
  941. * When recursive iteration is required, the application must handle the
  942. * recursion, explicitly calling H5Literate_by_name2() on discovered
  943. * subgroups.
  944. *
  945. * \note H5Literate_by_name2() assumes that the membership of the group being
  946. * iterated over remains unchanged through the iteration; if any of the
  947. * links in the group change during the iteration, the function’s
  948. * behavior is undefined. Note, however, that objects pointed to by the
  949. * links can be modified.
  950. *
  951. * \note H5Literate_by_name2() is the same as H5Literate2(), except that
  952. * H5Literate2() always proceeds in alphanumeric order.
  953. *
  954. * \since 1.12.0
  955. *
  956. * \see H5Literate(), H5Lvisit()
  957. *
  958. */
  959. H5_DLL herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  960. H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data,
  961. hid_t lapl_id);
  962. /**
  963. * \ingroup TRAV
  964. *
  965. * \brief Recursively visits all links starting from a specified group
  966. *
  967. * \group_id{grp_id}
  968. * \idx_type
  969. * \order
  970. * \op
  971. * \op_data
  972. * \return \success{The return value of the first operator that returns
  973. * non-zero, or zero if all members were processed with no
  974. * operator returning non-zero.}
  975. * \return \failure{Negative if an error occurs in the library, or the negative
  976. * value returned by one of the operators.}
  977. *
  978. * \details H5Lvisit2() is a recursive iteration function to visit all links in
  979. * and below a group in an HDF5 file, thus providing a mechanism for
  980. * an application to perform a common set of operations across all of
  981. * those links or a dynamically selected subset. For non-recursive
  982. * iteration across the members of a group, see H5Literate2().
  983. *
  984. * The group serving as the root of the iteration is specified by its
  985. * group or file identifier, \p group_id.
  986. *
  987. * Two parameters are used to establish the iteration: \p idx_type and
  988. * \p order.
  989. *
  990. * \p idx_type specifies the index to be used. If the links have not
  991. * been indexed by the index type, they will first be sorted by that
  992. * index then the iteration will begin; if the links have been so
  993. * indexed, the sorting step will be unnecessary, so the iteration may
  994. * begin more quickly. Valid values include the following:
  995. * \indexes
  996. *
  997. * Note that the index type passed in \p idx_type is a best effort
  998. * setting. If the application passes in a value indicating iteration
  999. * in creation order and a group is encountered that was not tracked
  1000. * in creation order, that group will be iterated over in
  1001. * lexicographic order by name, or name order. (Name order is the
  1002. * native order used by the HDF5 library and is always available.)
  1003. *
  1004. * \p order specifies the order in which objects are to be inspected
  1005. * along the index specified in \p idx_type. Valid values include the
  1006. * following:
  1007. * \orders
  1008. *
  1009. * \p op is a callback function of type \ref H5L_iterate2_t that is invoked
  1010. * for each link encountered.
  1011. * \snippet this H5L_iterate2_t_snip
  1012. *
  1013. * The \ref H5L_info2_t struct is defined (in H5Lpublic.h) as follows:
  1014. * \snippet this H5L_info2_t_snip
  1015. *
  1016. * The possible return values from the callback function, and the
  1017. * effect of each, are as follows:
  1018. * \li Zero causes the visit iterator to continue, returning zero when
  1019. * all group members have been processed.
  1020. * \li A positive value causes the visit iterator to immediately
  1021. * return that positive value, indicating short-circuit success.
  1022. * \li A negative value causes the visit iterator to immediately
  1023. * return that value, indicating failure.
  1024. *
  1025. * The H5Lvisit2() \p op_data parameter is a user-defined pointer to
  1026. * the data required to process links in the course of the iteration.
  1027. * This pointer is passed back to each step of the iteration in the
  1028. * \p op callback function's \p op_data parameter.
  1029. *
  1030. * H5Lvisit2() and H5Ovisit2() are companion functions: one for
  1031. * examining and operating on links; the other for examining and
  1032. * operating on the objects that those links point to. Both functions
  1033. * ensure that by the time the function completes successfully, every
  1034. * link or object below the specified point in the file has been
  1035. * presented to the application for whatever processing the
  1036. * application requires.
  1037. *
  1038. * \since 1.12.0
  1039. *
  1040. * \see H5Literate()
  1041. *
  1042. */
  1043. H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op,
  1044. void *op_data);
  1045. /**
  1046. * \ingroup TRAV
  1047. *
  1048. * \brief Recursively visits all links starting from a specified group
  1049. *
  1050. * \loc_id
  1051. * \param[in] group_name Group name
  1052. * \idx_type
  1053. * \order
  1054. * \op
  1055. * \op_data
  1056. * \lapl_id
  1057. *
  1058. * \return \herr_t
  1059. *
  1060. * \details H5Lvisit_by_name2() is a recursive iteration function to visit all
  1061. * links in and below a group in an HDF5 file, thus providing a
  1062. * mechanism for an application to perform a common set of operations
  1063. * across all of those links or a dynamically selected subset. For
  1064. * non-recursive iteration across the members of a group, see
  1065. * H5Literate2().
  1066. *
  1067. * The group serving as the root of the iteration is specified by the
  1068. * \p loc_id / \p group_name parameter pair. \p loc_id specifies a
  1069. * file or group; group_name specifies either a group in the file
  1070. * (with an absolute name based in the file’s root group) or a group
  1071. * relative to \p loc_id. If \p loc_id fully specifies the group that
  1072. * is to serve as the root of the iteration, group_name should be '.'
  1073. * (a dot). (Note that when \p loc_id fully specifies the the group
  1074. * that is to serve as the root of the iteration, the user may wish to
  1075. * consider using H5Lvisit2() instead of H5Lvisit_by_name2().)
  1076. *
  1077. * Two parameters are used to establish the iteration: \p idx_type and
  1078. * \p order.
  1079. *
  1080. * \p idx_type specifies the index to be used. If the links have not
  1081. * been indexed by the index type, they will first be sorted by that
  1082. * index then the iteration will begin; if the links have been so
  1083. * indexed, the sorting step will be unnecessary, so the iteration may
  1084. * begin more quickly. Valid values include the following:
  1085. * \indexes
  1086. *
  1087. * Note that the index type passed in \p idx_type is a best effort
  1088. * setting. If the application passes in a value indicating iteration
  1089. * in creation order and a group is encountered that was not tracked
  1090. * in creation order, that group will be iterated over in
  1091. * lexicographic order by name, or name order. (Name order is the
  1092. * native order used by the HDF5 library and is always available.)
  1093. *
  1094. * \p order specifies the order in which objects are to be inspected
  1095. * along the index specified in \p idx_type. Valid values include the
  1096. * following:
  1097. * \orders
  1098. *
  1099. * The \p op callback function, the related \ref H5L_info2_t
  1100. * \c struct, and the effect that the callback function's return value
  1101. * has on the application are described in H5Lvisit2().
  1102. *
  1103. * The H5Lvisit_by_name2() \p op_data parameter is a user-defined
  1104. * pointer to the data required to process links in the course of the
  1105. * iteration. This pointer is passed back to each step of the
  1106. * iteration in the callback function's \p op_data parameter.
  1107. *
  1108. * \p lapl_id is a link access property list. In the general case,
  1109. * when default link access properties are acceptable, this can be
  1110. * passed in as #H5P_DEFAULT. An example of a situation that requires
  1111. * a non-default link access property list is when the link is an
  1112. * external link; an external link may require that a link prefix be
  1113. * set in a link access property list (see H5Pset_elink_prefix()).
  1114. *
  1115. * H5Lvisit_by_name2() and H5Ovisit_by_name2() are companion
  1116. * functions: one for examining and operating on links; the other for
  1117. * examining and operating on the objects that those links point to.
  1118. * Both functions ensure that by the time the function completes
  1119. * successfully, every link or object below the specified point in the
  1120. * file has been presented to the application for whatever processing
  1121. * the application requires.
  1122. *
  1123. * \since 1.12.0
  1124. *
  1125. */
  1126. H5_DLL herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  1127. H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id);
  1128. /* UD link functions */
  1129. /**
  1130. * \ingroup H5L
  1131. *
  1132. * \brief Creates a link of a user-defined type
  1133. *
  1134. * \loc_id{link_loc_id}
  1135. * \param[in] link_name Link name
  1136. * \param[in] link_type User-defined link class
  1137. * \param[in] udata User-supplied link information
  1138. * \param[in] udata_size Size of udata buffer
  1139. * \lcpl_id
  1140. * \lapl_id
  1141. *
  1142. * \return \herr_t
  1143. *
  1144. * \details H5Lcreate_ud() creates a link of user-defined type \p link_type
  1145. * named \p link_name at the location specified in \p link_loc_id with
  1146. * user-specified data \p udata.
  1147. *
  1148. * \p link_name is interpreted relative to \p link_loc_id.
  1149. *
  1150. * Valid values for the link class of the new link, \p link_type,
  1151. * include #H5L_TYPE_EXTERNAL and any user-defined link classes that
  1152. * have been registered with the library. See H5Lregister() for
  1153. * further information.
  1154. *
  1155. * The format of the information pointed to by \p udata is defined by
  1156. * the user. \p udata_size specifies the size of the \p udata buffer.
  1157. * \p udata may be NULL if \p udata_size is zero (0).
  1158. *
  1159. * The property lists specified by \p lcpl_id and \p lapl_id specify
  1160. * properties used to create and access the link.
  1161. *
  1162. * \note The external link type, #H5L_TYPE_EXTERNAL, included in the HDF5
  1163. * library distribution, is implemented as a user-defined link type. This
  1164. * was done, in part, to provide a model for the implementation of other
  1165. * user-defined links.
  1166. *
  1167. * \since 1.8.0
  1168. *
  1169. */
  1170. H5_DLL herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata,
  1171. size_t udata_size, hid_t lcpl_id, hid_t lapl_id);
  1172. /**
  1173. * \ingroup H5LA
  1174. *
  1175. * \brief Determines whether a class of user-defined links is registered
  1176. *
  1177. * \param[in] id User-defined link class identifier
  1178. *
  1179. * \return \htri_t
  1180. *
  1181. * \details H5Lis_registered() tests whether a user-defined link class is
  1182. * currently registered, either by the HDF5 library or by the user
  1183. * through the use of H5Lregister().
  1184. *
  1185. * \note A link class must be registered to create new links of that type or to
  1186. * traverse existing links of that type.
  1187. *
  1188. * \since 1.8.0
  1189. *
  1190. */
  1191. H5_DLL htri_t H5Lis_registered(H5L_type_t id);
  1192. /* External link functions */
  1193. /**
  1194. * \ingroup H5L
  1195. *
  1196. * \brief Decodes external link information
  1197. *
  1198. * \param[in] ext_linkval Buffer containing external link information
  1199. * \param[in] link_size Size, in bytes, of the \p ext_linkval buffer
  1200. * \param[out] flags External link flags, packed as a bitmap (\Emph{Reserved as
  1201. * a bitmap for flags; no flags are currently defined, so the
  1202. * only valid value * is 0.})
  1203. * \param[out] filename Returned filename \param[out] obj_path Returned
  1204. * object path, relative to \p filename
  1205. *
  1206. * \return \herr_t
  1207. *
  1208. * \details H5Lunpack_elink_val() decodes the external link information
  1209. * returned by H5Lget_val() in the \p ext_linkval buffer.
  1210. *
  1211. * \p ext_linkval should be the buffer set by H5Lget_val() and will
  1212. * consist of two NULL-terminated strings, the filename and object
  1213. * path, one after the other.
  1214. *
  1215. * Given this buffer, H5Lunpack_elink_val() creates pointers to the
  1216. * filename and object path within the buffer and returns them in
  1217. * \p filename and \p obj_path, unless they are passed in as NULL.
  1218. *
  1219. * H5Lunpack_elink_val() requires that \p ext_linkval contain a
  1220. * concatenated pair of null-terminated strings, so use of this
  1221. * function on a string that is not an external link \p udata buffer
  1222. * may result in a segmentation fault. This failure can be avoided by
  1223. * adhering to the following procedure:
  1224. * <ol>
  1225. * <li>Call H5Lget_info() to get the link type and the size of the
  1226. * link value.<li>
  1227. * <li>Verify that the link is an external link, i.e., that its link
  1228. * type is #H5L_TYPE_EXTERNAL.</li>
  1229. * <li>Call H5Lget_val() to get the link value.</li>
  1230. * <li>Call H5Lunpack_elink_val() to unpack that value.</li>
  1231. * </ol>
  1232. *
  1233. * \since 1.8.0
  1234. *
  1235. */
  1236. H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_size, unsigned *flags,
  1237. const char **filename /*out*/, const char **obj_path /*out*/);
  1238. /**
  1239. * \ingroup H5L
  1240. *
  1241. * \brief Creates an external link, a soft link to an object in a different file.
  1242. *
  1243. * \param[in] file_name Name of the target file containing the target object.
  1244. * \param[in] obj_name Path within the target file to the target object
  1245. * \fgdt_loc_id{link_loc_id}
  1246. * \param[in] link_name Name of the new link, relative to \p link_loc_id
  1247. * \lcpl_id
  1248. * \lapl_id
  1249. * \return \herr_t
  1250. *
  1251. * \details H5Lcreate_external() creates a new external link. An external link
  1252. * is a soft link to an object in a different HDF5 file from the
  1253. * location of the link, i.e., to an external object.
  1254. *
  1255. * \p file_name identifies the target file containing the target
  1256. * object; \p obj_name specifies the path of the target object within
  1257. * that file. \p obj_name must be an absolute pathname in
  1258. * \p file_name, i.e., it must start at the target file’s root group,
  1259. * but it is not interpreted until an application attempts to traverse
  1260. * it.
  1261. *
  1262. * \p link_loc_id and \p link_name specify the location and name,
  1263. * respectively, of the new link. \p link_name is interpreted relative
  1264. * to \p link_loc_id.
  1265. *
  1266. * \p lcpl_id is the link creation property list used in creating the
  1267. * new link.
  1268. *
  1269. * \p lapl_id is the link access property list used in traversing the
  1270. * new link. Note that an external file opened by the traversal of an
  1271. * external link is always opened with the weak file close degree
  1272. * property setting, #H5F_CLOSE_WEAK (see H5Pset_fclose_degree());
  1273. * any file close degree property setting in \p lapl_id is ignored.
  1274. *
  1275. * An external link behaves similarly to a soft link, and like a soft
  1276. * link in an HDF5 file, it may dangle: the target file and object
  1277. * need not exist at the time that the external link is created.
  1278. *
  1279. * When the external link \p link_name is accessed, the library will
  1280. * search for the target file \p file_name as described below:
  1281. *
  1282. * - If \p file_name is a relative pathname, the following steps are
  1283. * performed:
  1284. * - The library will get the prefix(es) set in the environment
  1285. * variable \c HDF5_EXT_PREFIX and will try to prepend each prefix
  1286. * to \p file_name to form a new \p file_name.
  1287. * - If the new \p file_name does not exist or if \c HDF5_EXT_PREFIX
  1288. * is not set, the library will get the prefix set via
  1289. * H5Pset_elink_prefix() and prepend it to \p file_name to form a
  1290. * new \p file_name.
  1291. * - If the new \p file_name does not exist or no prefix is being
  1292. * set by H5Pset_elink_prefix(), then the path of the file
  1293. * associated with \p link_loc_id is obtained. This path can be
  1294. * the absolute path or the current working directory plus the
  1295. * relative path of that file when it is created/opened. The
  1296. * library will prepend this path to \p file_name to form a new
  1297. * \p file_name.
  1298. * - If the new \p file_name does not exist, then the library will
  1299. * look for \p file_name and will return failure/success
  1300. * accordingly.
  1301. * - If \p file_name is an absolute pathname, the library will first
  1302. * try to find \p file_name. If \p file_name does not exist,
  1303. * \p file_name is stripped of directory paths to form a new
  1304. * \p file_name. The search for the new \p file_name then follows
  1305. * the same steps as described above for a relative pathname. See
  1306. * examples below illustrating how target_file_name is stripped to
  1307. * form a new \p file_name.
  1308. *
  1309. * Note that \p file_name is considered to be an absolute pathname
  1310. * when the following condition is true:
  1311. *
  1312. * - For Unix, the first character of \p file_name is a slash (\c /).
  1313. * For example, consider a \p file_name of \c /tmp/A.h5.
  1314. * If that target file does not exist, the new \p file_name after
  1315. * stripping will be \c A.h5.
  1316. * - For Windows, there are 6 cases:
  1317. * -# \p file_name is an absolute drive with absolute pathname.
  1318. * For example, consider a \p file_name of \c /tmp/A.h5. If that
  1319. * target file does not exist, the new \p file_name after
  1320. * stripping will be \c A.h5.
  1321. * -# \p file_name is an absolute pathname without specifying drive
  1322. * name. For example, consider a \p file_name of \c /tmp/A.h5.
  1323. * If that target file does not exist, the new \p file_name after
  1324. * stripping will be \c A.h5.
  1325. * -# \p file_name is an absolute drive with relative pathname.
  1326. * For example, consider a \p file_name of \c /tmp/A.h5. If that
  1327. * target file does not exist, the new \p file_name after
  1328. * stripping will be \c tmp\A.h5.
  1329. * -# \p file_name is in UNC (Uniform Naming Convention) format with
  1330. * server name, share name, and pathname. For example, consider
  1331. * a \p file_name of \c /tmp/A.h5. If that target file does not
  1332. * exist, the new \p file_name after stripping will be \c A.h5.
  1333. * -# \p file_name is in Long UNC (Uniform Naming Convention) format
  1334. * with server name, share name, and pathname. For example,
  1335. * consider a \p file_name of \c /tmp/A.h5. If that target file
  1336. * does not exist, the new \p file_name after stripping will be
  1337. * \c A.h5.
  1338. * -# \p file_name is in Long UNC (Uniform Naming Convention) format
  1339. * with an absolute drive and an absolute pathname. For example,
  1340. * consider a \p file_name of \c /tmp/A.h5. If that target file
  1341. * does not exist, the new \p file_name after stripping will be
  1342. * \c A.h5.
  1343. *
  1344. * The library opens target file \p file_name with the file access
  1345. * property list that is set via H5Pset_elink_fapl() when the external
  1346. * link link_name is accessed. If no such property list is set, the
  1347. * library uses the file access property list associated with the file
  1348. * of \p link_loc_id to open the target file.
  1349. *
  1350. * If an application requires additional control over file access
  1351. * flags or the file access property list, see H5Pset_elink_cb(); this
  1352. * function enables the use of an external link callback function as
  1353. * described in H5L_elink_traverse_t().
  1354. *
  1355. * \attention A file close degree property setting (H5Pset_fclose_degree()) in
  1356. * the external link file access property list or in the external
  1357. * link callback function will be ignored. A file opened by means of
  1358. * traversing an external link is always opened with the weak file
  1359. * close degree property setting, #H5F_CLOSE_WEAK .
  1360. *
  1361. * \see H5Lcreate_hard(), H5Lcreate_soft(), H5Lcreate_ud()
  1362. *
  1363. * \since 1.8.0
  1364. */
  1365. H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id,
  1366. const char *link_name, hid_t lcpl_id, hid_t lapl_id);
  1367. /// \cond DEV
  1368. /* API Wrappers for async routines */
  1369. /* (Must be defined _after_ the function prototype) */
  1370. /* (And must only defined when included in application code, not the library) */
  1371. #ifndef H5L_MODULE
  1372. #define H5Lcreate_hard_async(...) H5Lcreate_hard_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1373. #define H5Lcreate_soft_async(...) H5Lcreate_soft_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1374. #define H5Ldelete_async(...) H5Ldelete_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1375. #define H5Ldelete_by_idx_async(...) H5Ldelete_by_idx_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1376. #define H5Lexists_async(...) H5Lexists_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1377. #define H5Literate_async(...) H5Literate_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  1378. /* Define "wrapper" versions of function calls, to allow compile-time values to
  1379. * be passed in by language wrapper or library layer on top of HDF5.
  1380. */
  1381. #define H5Lcreate_hard_async_wrap H5_NO_EXPAND(H5Lcreate_hard_async)
  1382. #define H5Lcreate_soft_async_wrap H5_NO_EXPAND(H5Lcreate_soft_async)
  1383. #define H5Ldelete_async_wrap H5_NO_EXPAND(H5Ldelete_async)
  1384. #define H5Ldelete_by_idx_async_wrap H5_NO_EXPAND(H5Ldelete_by_idx_async)
  1385. #define H5Lexists_async_wrap H5_NO_EXPAND(H5Lexists_async)
  1386. #define H5Literate_async_wrap H5_NO_EXPAND(H5Literate_async)
  1387. #endif /* H5L_MODULE */
  1388. /// \endcond
  1389. /* Symbols defined for compatibility with previous versions of the HDF5 API.
  1390. *
  1391. * Use of these symbols is deprecated.
  1392. */
  1393. #ifndef H5_NO_DEPRECATED_SYMBOLS
  1394. /* Macros */
  1395. /* Typedefs */
  1396. //! <!-- [H5L_info1_t_snip] -->
  1397. /**
  1398. * Information struct for link (for H5Lget_info1() and H5Lget_info_by_idx1())
  1399. */
  1400. typedef struct {
  1401. H5L_type_t type; /**< Type of link */
  1402. hbool_t corder_valid; /**< Indicate if creation order is valid */
  1403. int64_t corder; /**< Creation order */
  1404. H5T_cset_t cset; /**< Character set of link name */
  1405. union {
  1406. haddr_t address; /**< Address hard link points to */
  1407. size_t val_size; /**< Size of a soft link or UD link value */
  1408. } u;
  1409. } H5L_info1_t;
  1410. //! <!-- [H5L_info1_t_snip] -->
  1411. /** Prototype for H5Literate1() / H5Literate_by_name1() operator */
  1412. //! <!-- [H5L_iterate1_t_snip] -->
  1413. typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_t *info, void *op_data);
  1414. //! <!-- [H5L_iterate1_t_snip] -->
  1415. /* Function prototypes */
  1416. /**
  1417. * \ingroup H5L
  1418. *
  1419. * \brief Returns information about a link
  1420. *
  1421. * \fgdta_loc_id
  1422. * \param[in] name Link name
  1423. * \param[out] linfo Buffer in which link information is returned
  1424. * \lapl_id
  1425. *
  1426. * \return \herr_t
  1427. *
  1428. * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
  1429. * the function H5Lget_info2() or the macro H5Lget_info().
  1430. *
  1431. * \details H5Lget_info1() returns information about the specified link through
  1432. * the \p linfo argument.
  1433. *
  1434. * The location identifier, \p loc_id, specifies the location of the
  1435. * link. A link name, \p name, interpreted relative to \p loc_id,
  1436. * specifies the link being queried.
  1437. *
  1438. * \p lapl_id is the link access property list associated with the
  1439. * link \p name. In the general case, when default link access
  1440. * properties are acceptable, this can be passed in as #H5P_DEFAULT.
  1441. * An example of a situation that requires a non-default link access
  1442. * property list is when the link is an external link; an external
  1443. * link may require that a link prefix be set in a link access
  1444. * property list (see H5Pset_elink_prefix()).
  1445. *
  1446. * H5Lget_info1() returns information about name in the data structure
  1447. * \ref H5L_info1_t, which is described below and defined in
  1448. * H5Lpublic.h. This structure is returned in the buffer \p linfo.
  1449. * \snippet this H5L_info1_t_snip
  1450. * In the above struct, type specifies the link class. Valid values
  1451. * include the following:
  1452. * \link_types
  1453. * There will be additional valid values if user-defined links have
  1454. * been registered.
  1455. *
  1456. * \c corder specifies the link’s creation order position while
  1457. * \c corder_valid indicates whether the value in \c corder is valid.
  1458. *
  1459. * If \c corder_valid is \c TRUE, the value in \c corder is known to
  1460. * be valid; if \c corder_valid is \c FALSE, the value in \c corder is
  1461. * presumed to be invalid;
  1462. *
  1463. * \c corder starts at zero (0) and is incremented by one (1) as new
  1464. * links are created. But higher-numbered entries are not adjusted
  1465. * when a lower-numbered link is deleted; the deleted link’s creation
  1466. * order position is simply left vacant. In such situations, the value
  1467. * of \c corder for the last link created will be larger than the
  1468. * number of links remaining in the group.
  1469. *
  1470. * \c cset specifies the character set in which the link name is
  1471. * encoded. Valid values include the following:
  1472. * \csets
  1473. * This value is set with H5Pset_char_encoding().
  1474. *
  1475. * \c address and \c val_size are returned for hard and symbolic
  1476. * links, respectively. Symbolic links include soft and external links
  1477. * and some user-defined links.
  1478. *
  1479. * If the link is a hard link, \c address specifies the file address
  1480. * that the link points to.
  1481. *
  1482. * If the link is a symbolic link, \c val_size will be the length of
  1483. * the link value, e.g., the length of the HDF5 path name with a null
  1484. * terminator.
  1485. *
  1486. * \version 1.12.0 Function was deprecated.
  1487. * \version 1.8.2 Fortran subroutine added in this release.
  1488. * \version 1.8.4 Fortran subroutine syntax changed in this release.
  1489. *
  1490. * \since 1.8.0
  1491. *
  1492. */
  1493. H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t lapl_id);
  1494. /**
  1495. * \ingroup H5L
  1496. *
  1497. * \brief Retrieves metadata for a link in a group, according to the order
  1498. * within a field or index
  1499. *
  1500. * \loc_id
  1501. * \param[in] group_name Group name
  1502. * \idx_type
  1503. * \order
  1504. * \param[in] n Link position for which to retrieve information
  1505. * \param[out] linfo Buffer in which link information is returned
  1506. * \lapl_id
  1507. *
  1508. * \return \herr_t
  1509. *
  1510. * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
  1511. * the function H5Lget_info_by_idx2() and the macro
  1512. * H5Lget_info_by_idx().
  1513. *
  1514. * \details H5get_info_by_idx1() returns the metadata for a link in a group
  1515. * according to a specified field or index and a specified order.
  1516. *
  1517. * The link for which information is to be returned is specified by \p
  1518. * idx_type, \p order, and \p n as follows:
  1519. *
  1520. * - \p idx_type specifies the field by which the links in \p
  1521. * group_name are ordered. The links may be indexed on this field,
  1522. * in which case operations seeking specific links are likely to
  1523. * complete more quickly.
  1524. * - \p order specifies the order in which
  1525. * the links are to be referenced for the purposes of this function.
  1526. * - \p n specifies the position of the subject link. Note that this
  1527. * count is zero-based; 0 (zero) indicates that the function will
  1528. * return the value of the first link; if \p n is 5, the function
  1529. * will return the value of the sixth link; etc.
  1530. *
  1531. * For example, assume that \p idx_type, \p order, and \p n are
  1532. * #H5_INDEX_NAME, #H5_ITER_DEC, and 5, respectively. #H5_INDEX_NAME
  1533. * indicates that the links are accessed in lexicographic order by
  1534. * their names. #H5_ITER_DEC specifies that the list be traversed in
  1535. * reverse order, or in decremented order. And 5 specifies that this
  1536. * call to the function will return the metadata for the 6th link
  1537. * (\c n + 1) from the end.
  1538. *
  1539. * See H5Literate1() for a list of valid values and further discussion
  1540. * regarding \p idx_type and \p order.
  1541. *
  1542. * If \p loc_id specifies the group in which the link resides,
  1543. * \p group_name can be a dot (\c .).
  1544. *
  1545. * \version 1.12.0 Function was renamed to H5Lget_index_by_idx1() and deprecated.
  1546. * \version 1.8.4 Fortran subroutine syntax changed in this release.
  1547. * \version 1.8.2 Fortran subroutine added in this release.
  1548. *
  1549. * \since 1.8.0
  1550. *
  1551. */
  1552. H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  1553. H5_iter_order_t order, hsize_t n, H5L_info1_t *linfo /*out*/,
  1554. hid_t lapl_id);
  1555. /**
  1556. * \ingroup TRAV
  1557. *
  1558. * \brief Iterates over links in a group, with user callback routine,
  1559. * according to the order within an index.
  1560. *
  1561. * \group_id{grp_id}
  1562. * \idx_type
  1563. * \order
  1564. * \param[in,out] idx Pointer to an iteration index to allow
  1565. * continuing a previous iteration
  1566. * \op
  1567. * \op_data
  1568. * \return \success{The return value of the first operator that returns
  1569. * non-zero, or zero if all members were processed with no
  1570. * operator returning non-zero.}
  1571. * \return \failure{Negative if an error occurs in the library, or the negative
  1572. * value returned by one of the operators.}
  1573. *
  1574. * \deprecated Deprecated in favor of H5Literate2().
  1575. *
  1576. * \details H5Literate1() iterates through the links in a file or
  1577. * group, \p group_id, in the order of the specified
  1578. * index, \p idx_type, using a user-defined callback routine
  1579. * \p op. H5Literate1() does not recursively follow links into
  1580. * subgroups of the specified group.
  1581. *
  1582. * Three parameters are used to manage progress of the iteration:
  1583. * \p idx_type, \p order, and \p idx_p.
  1584. *
  1585. * \p idx_type specifies the index to be used. If the links have
  1586. * not been indexed by the index type, they will first be sorted by
  1587. * that index then the iteration will begin; if the links have been
  1588. * so indexed, the sorting step will be unnecessary, so the iteration
  1589. * may begin more quickly.
  1590. *
  1591. * \p order specifies the order in which objects are to be inspected
  1592. * along the index \p idx_type.
  1593. *
  1594. * \p idx_p tracks the iteration and allows an iteration to be
  1595. * resumed if it was stopped before all members were processed. It is
  1596. * passed in by the application with a starting point and returned by
  1597. * the library with the point at which the iteration stopped.
  1598. *
  1599. * \p op_data is a user-defined pointer to the data required to
  1600. * process links in the course of the iteration. This pointer is
  1601. * passed back to each step of the iteration in the \p op callback
  1602. * function's \p op_data parameter. \p op is invoked for each link
  1603. * encounter.
  1604. *
  1605. * \p op_data is passed to and from each iteration and can be used to
  1606. * supply or aggregate information across iterations.
  1607. *
  1608. * \remark Same pattern of behavior as H5Giterate().
  1609. *
  1610. * \note This function is also available through the H5Literate() macro.
  1611. *
  1612. * \warning The behavior of H5Literate1() is undefined if the link
  1613. * membership of \p group_id changes during the iteration.
  1614. * This does not limit the ability to change link destinations
  1615. * while iterating, but caution is advised.
  1616. *
  1617. *
  1618. * \version 1.12.0 Function was deprecated in this release.
  1619. * \since 1.8.0
  1620. *
  1621. * \see H5Literate_by_name2(), H5Lvisit2(), H5Lvisit_by_name2()
  1622. *
  1623. */
  1624. H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx,
  1625. H5L_iterate1_t op, void *op_data);
  1626. /**
  1627. * \ingroup TRAV
  1628. *
  1629. * \brief Iterates through links in a group by its name
  1630. *
  1631. * \loc_id
  1632. * \param[in] group_name Group name
  1633. * \idx_type
  1634. * \order
  1635. * \param[in,out] idx iteration position at which to start (\Emph{IN}) or
  1636. * position at which an interrupted iteration may be restarted
  1637. * (\Emph{OUT})
  1638. * \op
  1639. * \op_data
  1640. * \lapl_id
  1641. *
  1642. * \return \success{The return value of the first operator that returns
  1643. * non-zero, or zero if all members were processed with no
  1644. * operator returning non-zero.}
  1645. * \return \failure{Negative if an error occurs in the library, or the negative
  1646. * value returned by one of the operators.}
  1647. *
  1648. * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
  1649. * the function H5Literate_by_name2() or the macro
  1650. * H5Literate_by_name().
  1651. *
  1652. * \details H5Literate_by_name1() iterates through the links in a group
  1653. * specified by \p loc_id and \p group_name, in the order of the
  1654. * specified index, \p idx_type, using a user-defined callback routine
  1655. * \p op. H5Literate_by_name1() does not recursively follow links into
  1656. * subgroups of the specified group.
  1657. *
  1658. * \p idx_type specifies the index to be used. If the links have not
  1659. * been indexed by the index type, they will first be sorted by that
  1660. * index then the iteration will begin; if the links have been so
  1661. * indexed, the sorting step will be unnecessary, so the iteration may
  1662. * begin more quickly. Valid values include the following:
  1663. * \indexes
  1664. *
  1665. * \p order specifies the order in which objects are to be inspected
  1666. * along the index specified in \p idx_type. Valid values include the
  1667. * following:
  1668. * \orders
  1669. *
  1670. * \p idx allows an interrupted iteration to be resumed; it is
  1671. * passed in by the application with a starting point and returned by
  1672. * the library with the point at which the iteration stopped.
  1673. *
  1674. * \note H5Literate_by_name1() is not recursive. In particular, if a member of
  1675. * \p group_name is found to be a group, call it \c subgroup_a,
  1676. * H5Literate_by_name1() does not examine the members of \c subgroup_a.
  1677. * When recursive iteration is required, the application must handle the
  1678. * recursion, explicitly calling H5Literate_by_name1() on discovered
  1679. * subgroups.
  1680. *
  1681. * \note H5Literate_by_name1() assumes that the membership of the group being
  1682. * iterated over remains unchanged through the iteration; if any of the
  1683. * links in the group change during the iteration, the function’s
  1684. * behavior is undefined. Note, however, that objects pointed to by the
  1685. * links can be modified.
  1686. *
  1687. * \note H5Literate_by_name1() is the same as H5Giterate(), except that
  1688. * H5Giterate() always proceeds in lexicographic order.
  1689. *
  1690. * \version 1.12.0 Function H5Literate_by_name() was renamed to
  1691. * H5Literate_by_name1() and deprecated.
  1692. * \version 1.8.8 Fortran subroutine added.
  1693. *
  1694. * \since 1.8.0
  1695. *
  1696. */
  1697. H5_DLL herr_t H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  1698. H5_iter_order_t order, hsize_t *idx, H5L_iterate1_t op, void *op_data,
  1699. hid_t lapl_id);
  1700. /**
  1701. * \ingroup TRAV
  1702. *
  1703. * \brief Recursively visits all links starting from a specified group
  1704. *
  1705. * \group_id{grp_id}
  1706. * \idx_type
  1707. * \order
  1708. * \op
  1709. * \op_data
  1710. *
  1711. * \return \success{The return value of the first operator that returns
  1712. * non-zero, or zero if all members were processed with no
  1713. * operator returning non-zero.}
  1714. * \return \failure{Negative if an error occurs in the library, or the negative
  1715. * value returned by one of the operators.}
  1716. *
  1717. * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
  1718. * the function H5Lvisit2() or the macro H5Lvisit().
  1719. *
  1720. * \details H5Lvisit1() is a recursive iteration function to visit all links in
  1721. * and below a group in an HDF5 file, thus providing a mechanism for
  1722. * an application to perform a common set of operations across all of
  1723. * those links or a dynamically selected subset. For non-recursive
  1724. * iteration across the members of a group, see H5Literate1().
  1725. *
  1726. * The group serving as the root of the iteration is specified by its
  1727. * group or file identifier, \p group_id.
  1728. *
  1729. * Two parameters are used to establish the iteration: \p idx_type and
  1730. * \p order.
  1731. *
  1732. * \p idx_type specifies the index to be used. If the links have not
  1733. * been indexed by the index type, they will first be sorted by that
  1734. * index then the iteration will begin; if the links have been so
  1735. * indexed, the sorting step will be unnecessary, so the iteration may
  1736. * begin more quickly. Valid values include the following:
  1737. * \indexes
  1738. *
  1739. * Note that the index type passed in \p idx_type is a best effort
  1740. * setting. If the application passes in a value indicating iteration
  1741. * in creation order and a group is encountered that was not tracked
  1742. * in creation order, that group will be iterated over in
  1743. * lexicographic order by name, or name order. (Name order is the
  1744. * native order used by the HDF5 library and is always available.)
  1745. *
  1746. * \p order specifies the order in which objects are to be inspected
  1747. * along the index specified in \p idx_type. Valid values include the
  1748. * following:
  1749. * \orders
  1750. *
  1751. * \p op is a callback function of type \ref H5L_iterate1_t that is invoked
  1752. * for each link encountered.
  1753. * \snippet this H5L_iterate1_t_snip
  1754. *
  1755. * The \ref H5L_info1_t struct is defined (in H5Lpublic.h) as follows:
  1756. * \snippet this H5L_info1_t_snip
  1757. *
  1758. * The possible return values from the callback function, and the
  1759. * effect of each, are as follows:
  1760. * \li Zero causes the visit iterator to continue, returning zero when
  1761. * all group members have been processed.
  1762. * \li A positive value causes the visit iterator to immediately
  1763. * return that positive value, indicating short-circuit success.
  1764. * \li A negative value causes the visit iterator to immediately
  1765. * return that value, indicating failure.
  1766. *
  1767. * The H5Lvisit1() \p op_data parameter is a user-defined pointer to
  1768. * the data required to process links in the course of the iteration.
  1769. * This pointer is passed back to each step of the iteration in the
  1770. * \p op callback function's \p op_data parameter.
  1771. *
  1772. * H5Lvisit1() and H5Ovisit1() are companion functions: one for
  1773. * examining and operating on links; the other for examining and
  1774. * operating on the objects that those links point to. Both functions
  1775. * ensure that by the time the function completes successfully, every
  1776. * link or object below the specified point in the file has been
  1777. * presented to the application for whatever processing the
  1778. * application requires.
  1779. *
  1780. * \version 1.12.0 Function was renamed from H5Lvisit() to H5Lvisit1() and
  1781. * deprecated.
  1782. *
  1783. * \since 1.8.0
  1784. *
  1785. */
  1786. H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op,
  1787. void *op_data);
  1788. /**
  1789. * \ingroup TRAV
  1790. *
  1791. * \brief Recursively visits all links starting from a specified group
  1792. *
  1793. * \loc_id
  1794. * \param[in] group_name Group name
  1795. * \idx_type
  1796. * \order
  1797. * \op
  1798. * \op_data
  1799. * \lapl_id
  1800. *
  1801. * \return \success{The return value of the first operator that returns
  1802. * non-zero, or zero if all members were processed with no
  1803. * operator returning non-zero.}
  1804. * \return \failure{Negative if an error occurs in the library, or the negative
  1805. * value returned by one of the operators.}
  1806. *
  1807. * \deprecated As of HDF5-1.12 this function has been deprecated in favor of
  1808. * the function H5Lvisit_by_name2() or the macro H5Lvisit_by_name().
  1809. *
  1810. * \details H5Lvisit_by_name1() is a recursive iteration function to visit all
  1811. * links in and below a group in an HDF5 file, thus providing a
  1812. * mechanism for an application to perform a common set of operations
  1813. * across all of those links or a dynamically selected subset. For
  1814. * non-recursive iteration across the members of a group, see
  1815. * H5Literate1().
  1816. *
  1817. * The group serving as the root of the iteration is specified by the
  1818. * \p loc_id / \p group_name parameter pair. \p loc_id specifies a
  1819. * file or group; group_name specifies either a group in the file
  1820. * (with an absolute name based in the file’s root group) or a group
  1821. * relative to \p loc_id. If \p loc_id fully specifies the group that
  1822. * is to serve as the root of the iteration, group_name should be '.'
  1823. * (a dot). (Note that when \p loc_id fully specifies the the group
  1824. * that is to serve as the root of the iteration, the user may wish to
  1825. * consider using H5Lvisit1() instead of H5Lvisit_by_name1().)
  1826. *
  1827. * Two parameters are used to establish the iteration: \p idx_type and
  1828. * \p order.
  1829. *
  1830. * \p idx_type specifies the index to be used. If the links have not
  1831. * been indexed by the index type, they will first be sorted by that
  1832. * index then the iteration will begin; if the links have been so
  1833. * indexed, the sorting step will be unnecessary, so the iteration may
  1834. * begin more quickly. Valid values include the following:
  1835. * \indexes
  1836. *
  1837. * Note that the index type passed in \p idx_type is a best effort
  1838. * setting. If the application passes in a value indicating iteration
  1839. * in creation order and a group is encountered that was not tracked
  1840. * in creation order, that group will be iterated over in
  1841. * lexicographic order by name, or name order. (Name order is the
  1842. * native order used by the HDF5 library and is always available.)
  1843. *
  1844. * \p order specifies the order in which objects are to be inspected
  1845. * along the index specified in \p idx_type. Valid values include the
  1846. * following:
  1847. * \orders
  1848. *
  1849. * The \p op callback function, the related \ref H5L_info1_t
  1850. * \c struct, and the effect that the callback function's return value
  1851. * has on the application are described in H5Lvisit1().
  1852. *
  1853. * The H5Lvisit_by_name1() \p op_data parameter is a user-defined
  1854. * pointer to the data required to process links in the course of the
  1855. * iteration. This pointer is passed back to each step of the
  1856. * iteration in the callback function's \p op_data parameter.
  1857. *
  1858. * \p lapl_id is a link access property list. In the general case,
  1859. * when default link access properties are acceptable, this can be
  1860. * passed in as #H5P_DEFAULT. An example of a situation that requires
  1861. * a non-default link access property list is when the link is an
  1862. * external link; an external link may require that a link prefix be
  1863. * set in a link access property list (see H5Pset_elink_prefix()).
  1864. *
  1865. * H5Lvisit_by_name1() and H5Ovisit_by_name1() are companion
  1866. * functions: one for examining and operating on links; the other for
  1867. * examining and operating on the objects that those links point to.
  1868. * Both functions ensure that by the time the function completes
  1869. * successfully, every link or object below the specified point in the
  1870. * file has been presented to the application for whatever processing
  1871. * the application requires.
  1872. *
  1873. * \version 1.12.0 Function renamed from H5Lvisit_by_name() to
  1874. * H5Lvisit_by_name1() and deprecated.
  1875. *
  1876. * \since 1.8.0
  1877. *
  1878. */
  1879. H5_DLL herr_t H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type,
  1880. H5_iter_order_t order, H5L_iterate1_t op, void *op_data, hid_t lapl_id);
  1881. #endif /* H5_NO_DEPRECATED_SYMBOLS */
  1882. #ifdef __cplusplus
  1883. }
  1884. #endif
  1885. #endif /* H5Lpublic_H */