H5Rpublic.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930
  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. * This file contains public declarations for the H5R module.
  15. */
  16. #ifndef H5Rpublic_H
  17. #define H5Rpublic_H
  18. /* Public headers needed by this file */
  19. #include "H5public.h"
  20. #include "H5Gpublic.h"
  21. #include "H5Ipublic.h"
  22. /*****************/
  23. /* Public Macros */
  24. /*****************/
  25. /* Deprecated reference buffer sizes that are kept for backward compatibility */
  26. #define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
  27. #define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
  28. /**
  29. * Default reference buffer size.
  30. *
  31. * \internal Note! Be careful with the sizes of the references because they
  32. * should really depend on the run-time values in the file.
  33. */
  34. #define H5R_REF_BUF_SIZE (64)
  35. /*******************/
  36. /* Public Typedefs */
  37. /*******************/
  38. //! <!-- [H5R_type_t_snip] -->
  39. /**
  40. * Reference types allowed.
  41. *
  42. * \internal DO NOT CHANGE THE ORDER or VALUES as reference type values are
  43. * encoded into the datatype message header.
  44. */
  45. typedef enum {
  46. H5R_BADTYPE = (-1), /**< Invalid reference type */
  47. H5R_OBJECT1 = 0, /**< Backward compatibility (object) */
  48. H5R_DATASET_REGION1 = 1, /**< Backward compatibility (region) */
  49. H5R_OBJECT2 = 2, /**< Object reference */
  50. H5R_DATASET_REGION2 = 3, /**< Region reference */
  51. H5R_ATTR = 4, /**< Attribute Reference */
  52. H5R_MAXTYPE = 5 /**< Highest type (invalid) */
  53. } H5R_type_t;
  54. //! <!-- [H5R_type_t_snip] -->
  55. /* Deprecated types are kept for backward compatibility with previous versions */
  56. //! <!-- [hobj_ref_t_snip] -->
  57. /**
  58. * \deprecated Deprecated object reference type that is used with deprecated
  59. * reference APIs.
  60. *
  61. * \note This type can only be used with the "native" HDF5 VOL connector.
  62. */
  63. typedef haddr_t hobj_ref_t;
  64. //! <!-- [hobj_ref_t_snip] -->
  65. //! <!-- [hdset_reg_ref_t_snip] -->
  66. /**
  67. * Buffer to store heap ID and index
  68. *
  69. * This needs to be large enough to store largest #haddr_t in a worst case
  70. * machine (8 bytes currently) plus an int.
  71. *
  72. * \deprecated Dataset region reference type that is used with deprecated
  73. * reference APIs.
  74. *
  75. * \note This type can only be used with the "native" HDF5 VOL connector.
  76. */
  77. typedef struct {
  78. uint8_t __data[H5R_DSET_REG_REF_BUF_SIZE];
  79. } hdset_reg_ref_t;
  80. //! <!-- [hdset_reg_ref_t_snip] -->
  81. //! <!-- [H5R_ref_t_snip] -->
  82. /**
  83. * Opaque reference type. The same reference type is used for object,
  84. * dataset region and attribute references. This is the type that
  85. * should always be used with the current reference API.
  86. */
  87. typedef struct {
  88. union {
  89. uint8_t __data[H5R_REF_BUF_SIZE]; /**< opaque data */
  90. int64_t align; /**< ensures alignment */
  91. } u;
  92. } H5R_ref_t;
  93. //! <!-- [H5R_ref_t_snip] -->
  94. /********************/
  95. /* Public Variables */
  96. /********************/
  97. /*********************/
  98. /* Public Prototypes */
  99. /*********************/
  100. #ifdef __cplusplus
  101. extern "C" {
  102. #endif
  103. /* Constructors */
  104. /**
  105. * --------------------------------------------------------------------------
  106. * \ingroup H5R
  107. *
  108. * \brief Creates an object reference
  109. *
  110. * \fgdta_loc_id
  111. * \param[in] name Name of object
  112. * \oapl_id
  113. * \param[out] ref_ptr Pointer to reference
  114. *
  115. * \return \herr_t
  116. *
  117. * \details H5Rcreate_object() creates a reference pointing to the
  118. * object named \p name located at \p loc_id. The parameters \p
  119. * loc_id and \p name are used to locate the object.
  120. *
  121. * The parameter \p oapl_id is an object access property list
  122. * identifier for the referenced object. The access property list
  123. * must be of the same type as the object being referenced, that is
  124. * a group, dataset or committed datatype property list.
  125. *
  126. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  127. * \snippet this H5R_ref_t_snip
  128. *
  129. * H5Rdestroy() should be used to release the resource from the
  130. * reference.
  131. *
  132. */
  133. H5_DLL herr_t H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr);
  134. /**
  135. * --------------------------------------------------------------------------
  136. * \ingroup H5R
  137. *
  138. * \brief Creates a region reference
  139. *
  140. * \fgdta_loc_id
  141. * \param[in] name Name of object
  142. * \space_id
  143. * \oapl_id
  144. * \param[out] ref_ptr Pointer to reference
  145. *
  146. * \return \herr_t
  147. *
  148. * \details H5Rcreate_region() creates the reference, \p ref_ptr,
  149. * pointing to the region represented by \p space_id within the
  150. * object named name located at \p loc_id.
  151. *
  152. * The parameters \p loc_id and \p name are used to locate the
  153. * object. The parameter \p space_id identifies the dataset region
  154. * that a dataset region reference points to.
  155. *
  156. * The parameter \p oapl_id is an object access property list
  157. * identifier for the referenced object. The access property list
  158. * must be of the same type as the object being referenced, that is
  159. * a dataset property list in this case.
  160. *
  161. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  162. * \snippet this H5R_ref_t_snip
  163. *
  164. * H5Rdestroy() should be used to release the resource from the
  165. * reference.
  166. *
  167. */
  168. H5_DLL herr_t H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
  169. H5R_ref_t *ref_ptr);
  170. /**
  171. * --------------------------------------------------------------------------
  172. * \ingroup H5R
  173. *
  174. * \brief Creates an attribute reference
  175. *
  176. * \fgdta_loc_id
  177. * \param[in] name Name of object
  178. * \param[in] attr_name Name of attribute
  179. * \oapl_id
  180. * \param[out] ref_ptr Pointer to reference
  181. *
  182. * \return \herr_t
  183. *
  184. * \details H5Rcreate_attr() creates the reference, \p ref_ptr, pointing
  185. * to the attribute named \p attr_name and attached to the object
  186. * named \p name located at \p loc_id.
  187. *
  188. * The parameters \p loc_id and \p name locate the object. The
  189. * parameter \p attr_name specifies the attribute within the object.
  190. *
  191. * The parameter \p oapl_id is an object access property list
  192. * identifier for the object that the referenced attribute is
  193. * attached to. The access property list must be of the same type
  194. * as that object, that is a group, dataset or committed datatype
  195. * property list.
  196. *
  197. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  198. * \snippet this H5R_ref_t_snip
  199. *
  200. * H5Rdestroy() should be used to release the resource from the
  201. * reference.
  202. *
  203. */
  204. H5_DLL herr_t H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id,
  205. H5R_ref_t *ref_ptr);
  206. /**
  207. * --------------------------------------------------------------------------
  208. * \ingroup H5R
  209. *
  210. * \brief Closes a reference
  211. *
  212. * \param[in] ref_ptr Pointer to reference
  213. *
  214. * \return \herr_t
  215. *
  216. * \details Given a reference, \p ref_ptr, to an object, region or attribute
  217. * attached to an object, H5Rdestroy() releases allocated resources
  218. * from a previous create call.
  219. *
  220. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  221. * \snippet this H5R_ref_t_snip
  222. *
  223. */
  224. H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr);
  225. /* Info */
  226. /**
  227. * --------------------------------------------------------------------------
  228. * \ingroup H5R
  229. *
  230. * \brief Retrieves the type of a reference
  231. *
  232. * \param[in] ref_ptr Pointer to reference
  233. *
  234. * \return Returns a valid reference type if successful; otherwise returns #H5R_BADTYPE .
  235. *
  236. * \details Given a reference, \p ref_ptr, H5Rget_type() returns the
  237. * type of the reference.
  238. *
  239. * Valid returned reference types are:
  240. * \snippet this H5R_type_t_snip
  241. *
  242. * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be
  243. * associated to an \ref H5R_ref_t reference and can therefore never be
  244. * returned through that function.
  245. *
  246. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  247. * \snippet this H5R_ref_t_snip
  248. *
  249. */
  250. H5_DLL H5R_type_t H5Rget_type(const H5R_ref_t *ref_ptr);
  251. /**
  252. * --------------------------------------------------------------------------
  253. * \ingroup H5R
  254. *
  255. * \brief Determines whether two references are equal
  256. *
  257. * \param[in] ref1_ptr Pointer to reference to compare
  258. * \param[in] ref2_ptr Pointer to reference to compare
  259. *
  260. * \return Returns a positive value if the references are equal. Returns
  261. * 0 if the references are not equal. Returns a negative value when the
  262. * function fails.
  263. *
  264. * \details H5Requal() determines whether two references point to the
  265. * same object, region or attribute.
  266. *
  267. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  268. * \snippet this H5R_ref_t_snip
  269. *
  270. */
  271. H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr);
  272. /**
  273. * --------------------------------------------------------------------------
  274. * \ingroup H5R
  275. *
  276. * \brief Copies an existing reference
  277. *
  278. * \param[in] src_ref_ptr Pointer to reference to copy
  279. * \param[out] dst_ref_ptr Pointer to output reference
  280. *
  281. * \return \herr_t
  282. *
  283. * \details H5Rcopy() creates a copy of an existing reference.
  284. * \p src_ref_ptr points to the reference to copy and \p dst_ref_ptr is the
  285. * pointer to the destination reference.
  286. *
  287. */
  288. H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr);
  289. /* Dereference */
  290. /**
  291. * --------------------------------------------------------------------------
  292. * \ingroup H5R
  293. *
  294. * \brief Opens the HDF5 object referenced
  295. *
  296. * \param[in] ref_ptr Pointer to reference to open
  297. * \rapl_id
  298. * \oapl_id
  299. *
  300. * \return \hid_t{object}
  301. *
  302. * \details Given a reference, \p ref_ptr, to an object, a region in
  303. * an object, or an attribute attached to an object, H5Ropen_object()
  304. * opens that object and returns an identifier.
  305. *
  306. * The parameter \p oapl_id is an object access property list
  307. * identifier for the referenced object. The access property list
  308. * must be of the same type as the object being referenced, that is
  309. * a group or dataset property list.
  310. *
  311. * \ref H5R_ref_t is defined in H5Rpublic.h as:
  312. * \snippet this H5R_ref_t_snip
  313. *
  314. * The object opened with this function should be closed when it
  315. * is no longer needed so that resource leaks will not develop. Use
  316. * the appropriate close function such as H5Oclose() or H5Dclose()
  317. * for datasets.
  318. *
  319. */
  320. H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
  321. /**
  322. * --------------------------------------------------------------------------
  323. * \ingroup ASYNC
  324. * \async_variant_of{H5Ropen}
  325. */
  326. H5_DLL hid_t H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_line,
  327. H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id);
  328. /**
  329. * --------------------------------------------------------------------------
  330. * \ingroup H5R
  331. *
  332. * \brief Sets up a dataspace and selection as specified by a region reference.
  333. *
  334. * \param[in] ref_ptr Pointer to reference to open
  335. * \rapl_id
  336. * \oapl_id
  337. *
  338. * \return \hid_t{dataspace}
  339. *
  340. * \details H5Ropen_region() creates a copy of the dataspace of the
  341. * dataset pointed to by a region reference, \p ref_ptr, and defines
  342. * a selection matching the selection pointed to by \p ref_ptr within
  343. * the dataspace copy.
  344. *
  345. * The parameter \p rapl id is a reference access property list
  346. * identifier for the reference. The access property list can
  347. * be used to access external files that the reference points to
  348. * (through a file access property list).
  349. *
  350. * The parameter \p oapl id is an object access property list
  351. * identifier for the referenced object. The access property list
  352. * must be of the same type as the object being referenced, that is
  353. * a dataset property list in that case.
  354. *
  355. * Use H5Sclose() to release the dataspace identifier returned by
  356. * this function when the identifier is no longer needed.
  357. *
  358. */
  359. H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id);
  360. /**
  361. * --------------------------------------------------------------------------
  362. * \ingroup ASYNC
  363. * \async_variant_of{H5Ropen_region}
  364. */
  365. H5_DLL hid_t H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_line,
  366. H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id);
  367. /**
  368. * --------------------------------------------------------------------------
  369. * \ingroup H5R
  370. *
  371. * \brief Opens the HDF5 attribute referenced
  372. *
  373. * \param[in] ref_ptr Pointer to reference to open
  374. * \rapl_id
  375. * \aapl_id
  376. *
  377. * \return \hid_t{attribute}
  378. *
  379. * \details Given a reference, \p ref_ptr, to an attribute attached to
  380. * an object, H5Ropen_attr() opens the attribute attached to that
  381. * object and returns an identifier.
  382. *
  383. * The parameter \p rapl id is a reference access property list
  384. * identifier for the reference. The access property list can
  385. * be used to access external files that the reference points to
  386. * (through a file access property list).
  387. *
  388. * The parameter \p aapl_id is an attribute access property list
  389. * identifier for the referenced attribute.
  390. *
  391. * The attribute opened with this function should be closed with
  392. * H5Aclose() when it is no longer needed.
  393. *
  394. */
  395. H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id);
  396. /**
  397. * --------------------------------------------------------------------------
  398. * \ingroup ASYNC
  399. * \async_variant_of{H5Ropen_attr}
  400. */
  401. H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line,
  402. H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, hid_t es_id);
  403. /* Get type */
  404. /**
  405. * --------------------------------------------------------------------------
  406. * \ingroup H5R
  407. *
  408. * \brief Retrieves the type of object that an object reference points to
  409. *
  410. * \param[in] ref_ptr Pointer to reference to query
  411. * \rapl_id
  412. * \param[out] obj_type Type of referenced object
  413. *
  414. * \return \herr_t
  415. *
  416. * \details Given a reference, \p ref_ptr, H5Rget_obj_type3() retrieves
  417. * the type of the referenced object in \p obj_type.
  418. *
  419. * The parameter \p rapl id is a reference access property list
  420. * identifier for the reference. The access property list can
  421. * be used to access external files that the reference points to
  422. * (through a file access property list).
  423. *
  424. * Upon success, the function returns in \p obj_type the type of
  425. * the object that the reference points to. Valid values for this
  426. * referenced object type are as followed (defined in H5Opublic.h):
  427. * \snippet H5Opublic.h H5O_type_t_snip
  428. *
  429. */
  430. H5_DLL herr_t H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type);
  431. /* Get name */
  432. /**
  433. * --------------------------------------------------------------------------
  434. * \ingroup H5R
  435. *
  436. * \brief Retrieves the file name for a referenced object
  437. *
  438. * \param[in] ref_ptr Pointer to reference to query
  439. * \param[in,out] name Buffer to place the file name of the reference
  440. * \param[in] size Size of the \p name buffer
  441. *
  442. * \return Returns the length of the name if successful, otherwise, a negative value.
  443. *
  444. * \details H5Rget_file_name() retrieves the file name for the object,
  445. * region or attribute reference pointed to by \p ref_ptr.
  446. *
  447. * Up to \p size characters of the name are returned in \p name;
  448. * additional characters, if any, are not returned to the user
  449. * application. If the length of the name, which determines
  450. * the required value of size, is unknown, a preliminary
  451. * H5Rget_file_name() call can be made. The return value of this
  452. * call will be the size of the file name. That value can then be
  453. * passed in for size in the second call to H5Rget_file_name(),
  454. * which will retrieve the actual name.
  455. *
  456. */
  457. H5_DLL ssize_t H5Rget_file_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
  458. /**
  459. * --------------------------------------------------------------------------
  460. * \ingroup H5R
  461. *
  462. * \brief Retrieves the object name for a referenced object
  463. *
  464. * \param[in] ref_ptr Pointer to reference to query
  465. * \rapl_id
  466. * \param[in,out] name Buffer to place the file name of the reference
  467. * \param[in] size Size of the \p name buffer
  468. *
  469. * \return Returns the length of the name if successful, returning
  470. * 0 (zero) if no name is associated with the identifier. Otherwise
  471. * returns a negative value.
  472. *
  473. * \details H5Rget_obj_name() retrieves the object name for the object,
  474. * region or attribute reference pointed to by \p ref_ptr.
  475. *
  476. * The parameter \p rapl_id is a reference access property list
  477. * identifier for the reference. The access property list can
  478. * be used to access external files that the reference points to
  479. * (through a file access property list).
  480. *
  481. * Up to size characters of the name are returned in \p name; additional
  482. * characters, if any, are not returned to the user application. If
  483. * the length of the name, which determines the required value of
  484. * \p size, is unknown, a preliminary call to H5Rget_obj_name() call
  485. * can be made. The return value of this call will be the size of the
  486. * object name. That value can then be passed in for \p size in the
  487. * second call to H5Rget_obj_name(), which will retrieve the actual
  488. * name. If there is no name associated with the object identifier
  489. * or if the name is NULL, H5Rget_obj_name() returns the size of
  490. * the name buffer (the size does not include the \c \0 terminator).
  491. *
  492. * If \p ref_ptr is an object reference, \p name will be returned with
  493. * a name for the referenced object. If \p ref_ptr is a dataset region
  494. * reference, \p name will contain a name for the object containing
  495. * the referenced region. If \p ref_ptr is an attribute reference, \p
  496. * name will contain a name for the object the attribute is attached
  497. * to. Note that an object in an HDF5 file may have multiple paths
  498. * if there are multiple links pointing to it. This function may
  499. * return any one of these paths.
  500. *
  501. */
  502. H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, size_t size);
  503. /**
  504. * --------------------------------------------------------------------------
  505. * \ingroup H5R
  506. *
  507. * \brief Retrieves the attribute name for a referenced object
  508. *
  509. * \param[in] ref_ptr Pointer to reference to query
  510. * \param[in,out] name Buffer to place the attribute name of the reference
  511. * \param[in] size Size of the \p name buffer
  512. *
  513. * \return Returns the length of the name if successful, otherwise, a negative value.
  514. *
  515. * \details H5Rget_attr_name() retrieves the attribute name for the
  516. * attribute reference pointed to by \p ref_ptr.
  517. *
  518. * Up to size characters of the name are returned in \p name;
  519. * additional characters, if any, are not returned to the user
  520. * application. If the length of the name, which determines
  521. * the required value of \p size, is unknown, a preliminary
  522. * H5Rget_attr_name() call can be made. The return value of this
  523. * call will be the size of the attribute name. That value can then
  524. * be passed in for size in the second call to H5Rget_attr_name(),
  525. * which will retrieve the actual name.
  526. *
  527. */
  528. H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
  529. /// \cond DEV
  530. /* API Wrappers for async routines */
  531. /* (Must be defined _after_ the function prototype) */
  532. /* (And must only defined when included in application code, not the library) */
  533. #ifndef H5R_MODULE
  534. #define H5Ropen_object_async(...) H5Ropen_object_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  535. #define H5Ropen_region_async(...) H5Ropen_region_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  536. #define H5Ropen_attr_async(...) H5Ropen_attr_async(__FILE__, __func__, __LINE__, __VA_ARGS__)
  537. /* Define "wrapper" versions of function calls, to allow compile-time values to
  538. * be passed in by language wrapper or library layer on top of HDF5. */
  539. #define H5Ropen_object_async_wrap H5_NO_EXPAND(H5Ropen_object_async)
  540. #define H5Ropen_region_async_wrap H5_NO_EXPAND(H5Ropen_region_async)
  541. #define H5Ropen_attr_async_wrap H5_NO_EXPAND(H5Ropen_attr_async)
  542. #endif /* H5R_MODULE */
  543. /// \endcond
  544. /* Symbols defined for compatibility with previous versions of the HDF5 API.
  545. *
  546. * Use of these symbols is or will be deprecated.
  547. */
  548. /* Macros */
  549. /* Versions for compatibility */
  550. #define H5R_OBJECT H5R_OBJECT1
  551. #define H5R_DATASET_REGION H5R_DATASET_REGION1
  552. /* Function prototypes */
  553. #ifndef H5_NO_DEPRECATED_SYMBOLS
  554. /**
  555. * --------------------------------------------------------------------------
  556. * \ingroup H5R
  557. *
  558. * \brief Retrieves the type of object that an object reference points to
  559. *
  560. * \param[in] id The dataset containing the reference object or the group
  561. * containing that dataset
  562. * \param[in] ref_type Type of reference to query
  563. * \param[in] ref Reference to query
  564. *
  565. * \return Returns a valid object type if successful; otherwise returns a
  566. * negative value (#H5G_UNKNOWN).
  567. *
  568. * \deprecated This function has been renamed from H5Rget_obj_type() and is
  569. * deprecated in favor of the macro H5Rget_obj_type() or the
  570. * function H5Rget_obj_type2().
  571. *
  572. * \details Given an object reference, \p ref, H5Rget_obj_type1() returns the
  573. * type of the referenced object.
  574. *
  575. * A \Emph{reference type} is the type of reference, either an object
  576. * reference or a dataset region reference. An \Emph{object reference}
  577. * points to an HDF5 object while a \Emph{dataset region reference}
  578. * points to a defined region within a dataset.
  579. *
  580. * The \Emph{referenced object} is the object the reference points
  581. * to. The \Emph{referenced object type}, or the type of the referenced
  582. * object, is the type of the object that the reference points to.
  583. *
  584. * The location identifier, \p id, is the identifier for either the
  585. * dataset containing the object reference or the group containing that
  586. * dataset.
  587. *
  588. * Valid reference types, to pass in as \p ref_type, include the
  589. * following:
  590. * \snippet this H5R_type_t_snip
  591. *
  592. * If the application does not already know the object reference type,
  593. * that can be determined with three preliminary calls:
  594. *
  595. * \li Call H5Dget_type() on the dataset containing the reference to
  596. * get a datatype identifier for the dataset’s datatype.
  597. * \li Using that datatype identifier, H5Tget_class() returns a datatype
  598. * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
  599. * then be used to determine whether the reference’s datatype is
  600. * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
  601. * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
  602. * is #H5R_OBJECT.
  603. * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
  604. * type is #H5R_DATASET_REGION.
  605. *
  606. * When the function completes successfully, it returns one of the
  607. * following valid object type values (defined in H5Gpublic.h):
  608. * \snippet H5Gpublic.h H5G_obj_t_snip
  609. *
  610. * \version 1.8.0 Function H5Rget_obj_type() renamed to H5Rget_obj_type1() and
  611. * deprecated in this release.
  612. * \since 1.6.0
  613. *
  614. */
  615. H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref);
  616. /**
  617. * --------------------------------------------------------------------------
  618. * \ingroup H5R
  619. *
  620. * \brief Opens the HDF5 object referenced
  621. *
  622. * \obj_id
  623. * \param[in] ref_type The reference type of \p ref
  624. * \param[in] ref Reference to open
  625. *
  626. * \return Returns identifier of referenced object if successful; otherwise
  627. * returns a negative value.
  628. *
  629. * \deprecated This function has been renamed from H5Rdereference() and is
  630. * deprecated in favor of the macro H5Rdereference() or the function
  631. * H5Rdereference2().
  632. *
  633. * \details Given a reference, \p ref, to an object or a region in an object,
  634. * H5Rdereference1() opens that object and returns an identifier.
  635. *
  636. * The parameter \p obj_id must be a valid identifier for an object in
  637. * the HDF5 file containing the referenced object, including the file
  638. * identifier.
  639. *
  640. * The parameter \p ref_type specifies the reference type of the
  641. * reference \p ref. \p ref_type may contain either of the following
  642. * values:
  643. * - #H5R_OBJECT
  644. * - #H5R_DATASET_REGION
  645. *
  646. * The object opened with this function should be closed when it is no
  647. * longer needed so that resource leaks will not develop. Use the
  648. * appropriate close function such as H5Oclose() or H5Dclose() for
  649. * datasets.
  650. *
  651. * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and
  652. * deprecated in this release.
  653. * \since 1.8.0
  654. *
  655. */
  656. H5_DLL hid_t H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref);
  657. #endif /* H5_NO_DEPRECATED_SYMBOLS */
  658. /**
  659. * --------------------------------------------------------------------------
  660. * \ingroup H5R
  661. *
  662. * \brief Creates a reference
  663. *
  664. * \param[out] ref Reference created by the function call
  665. * \param[in] loc_id Location identifier used to locate the object being pointed to
  666. * \param[in] name Name of object at location \p loc_id
  667. * \param[in] ref_type Type of reference
  668. * \param[in] space_id Dataspace identifier with selection. Used only for
  669. * dataset region references; pass as -1 if reference is
  670. * an object reference, i.e., of type #H5R_OBJECT
  671. *
  672. * \return \herr_t
  673. *
  674. * \details H5Rcreate() creates the reference, \p ref, of the type specified in
  675. * \p ref_type, pointing to the object \p name located at \p loc_id.
  676. *
  677. * The HDF5 library maps the void type specified above for \p ref to
  678. * the type specified in \p ref_type, which will be one of the following:
  679. * \snippet this H5R_type_t_snip
  680. *
  681. * The parameters \p loc_id and \p name are used to locate the object.
  682. *
  683. * The parameter \p space_id identifies the dataset region that a
  684. * dataset region reference points to. This parameter is used only with
  685. * dataset region references and should be set to -1 if the reference
  686. * is an object reference, #H5R_OBJECT.
  687. *
  688. * \since 1.8.0
  689. */
  690. H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id);
  691. /**
  692. * --------------------------------------------------------------------------
  693. * \ingroup H5R
  694. *
  695. * \brief Retrieves the type of object that an object reference points to
  696. *
  697. * \param[in] id The dataset containing the reference object or the group
  698. * containing that dataset
  699. * \param[in] ref_type Type of reference to query
  700. * \param[in] ref Reference to query
  701. * \param[out] obj_type Type of referenced object
  702. *
  703. * \return \herr_t
  704. *
  705. * \details Given an object reference, \p ref, H5Rget_obj_type2() returns the
  706. * type of the referenced object in \p obj_type.
  707. *
  708. * A \Emph{reference type} is the type of reference, either an object
  709. * reference or a dataset region reference. An \Emph{object reference}
  710. * points to an HDF5 object while a \Emph{dataset region reference}
  711. * points to a defined region within a dataset.
  712. *
  713. * The \Emph{referenced object} is the object the reference points
  714. * to. The \Emph{referenced object type}, or the type of the referenced
  715. * object, is the type of the object that the reference points to.
  716. *
  717. * The location identifier, \p id, is the identifier for either the
  718. * dataset containing the object reference or the group containing that
  719. * dataset.
  720. *
  721. * Valid reference types, to pass in as \p ref_type, include the
  722. * following:
  723. * \snippet this H5R_type_t_snip
  724. *
  725. * If the application does not already know the object reference type,
  726. * that can be determined with three preliminary calls:
  727. *
  728. * \li Call H5Dget_type() on the dataset containing the reference to
  729. * get a datatype identifier for the dataset’s datatype.
  730. * \li Using that datatype identifier, H5Tget_class() returns a datatype
  731. * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can
  732. * then be used to determine whether the reference’s datatype is
  733. * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG:
  734. * - If the datatype is #H5T_STD_REF_OBJ, the reference object type
  735. * is #H5R_OBJECT.
  736. * - If the datatype is #H5T_STD_REF_DSETREG, the reference object
  737. * type is #H5R_DATASET_REGION.
  738. *
  739. * When the function completes successfully, it returns one of the
  740. * following valid object type values (defined in H5Opublic.h):
  741. * \snippet H5Opublic.h H5O_type_t_snip
  742. *
  743. * \since 1.8.0
  744. *
  745. */
  746. H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type);
  747. /**
  748. * --------------------------------------------------------------------------
  749. * \ingroup H5R
  750. *
  751. * \brief Opens the HDF5 object referenced
  752. *
  753. * \obj_id
  754. * \oapl_id
  755. * \param[in] ref_type The reference type of \p ref
  756. * \param[in] ref Reference to open
  757. *
  758. * \return Returns identifier of referenced object if successful; otherwise
  759. * returns a negative value.
  760. *
  761. * \details Given a reference, \p ref, to an object or a region in an object,
  762. * H5Rdereference2() opens that object and returns an identifier.
  763. *
  764. * The parameter \p obj_id must be a valid identifier for the HDF5 file
  765. * containing the referenced object or for any object in that HDF5
  766. * file.
  767. *
  768. * The parameter \p oapl_id is an object access property list
  769. * identifier for the referenced object. The access property list must
  770. * be of the same type as the object being referenced, that is a group,
  771. * dataset, or datatype property list.
  772. *
  773. * The parameter \p ref_type specifies the reference type of the
  774. * reference \p ref. \p ref_type may contain either of the following
  775. * values:
  776. * - #H5R_OBJECT
  777. * - #H5R_DATASET_REGION
  778. *
  779. * The object opened with this function should be closed when it is no
  780. * longer needed so that resource leaks will not develop. Use the
  781. * appropriate close function such as H5Oclose() or H5Dclose() for
  782. * datasets.
  783. *
  784. * \since 1.10.0
  785. *
  786. */
  787. H5_DLL hid_t H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *ref);
  788. /**
  789. * --------------------------------------------------------------------------
  790. * \ingroup H5R
  791. *
  792. * \brief Sets up a dataspace and selection as specified by a region reference
  793. *
  794. * \param[in] dataset File identifier or identifier for any object in the file
  795. * containing the referenced region
  796. * \param[in] ref_type Reference type of \p ref, which must be #H5R_DATASET_REGION
  797. * \param[in] ref Region reference to open
  798. *
  799. * \return Returns a valid dataspace identifier if successful; otherwise returns
  800. * a negative value.
  801. *
  802. * \details H5Rget_region() creates a copy of the dataspace of the dataset
  803. * pointed to by a region reference, \p ref, and defines a selection
  804. * matching the selection pointed to by ref within the dataspace copy.
  805. *
  806. * \p dataset is used to identify the file containing the referenced
  807. * region; it can be a file identifier or an identifier for any object
  808. * in the file.
  809. *
  810. * The parameter \p ref_type specifies the reference type of \p ref and
  811. * must contain the value #H5R_DATASET_REGION.
  812. *
  813. * Use H5Sclose() to release the dataspace identifier returned by this
  814. * function when the identifier is no longer needed.
  815. *
  816. */
  817. H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref);
  818. /**
  819. * --------------------------------------------------------------------------
  820. * \ingroup H5R
  821. *
  822. * \brief Retrieves a name for a referenced object
  823. *
  824. * \param[in] loc_id Identifier for the file containing the reference or for
  825. * any object in that file
  826. * \param[in] ref_type Type of reference
  827. * \param[in] ref An object or dataset region reference
  828. * \param[out] name A buffer to place the name of the referenced object or
  829. * dataset region. If \c NULL, then this call will return the
  830. * size in bytes of the name.
  831. * \param[in] size The size of the \p name buffer. When the size is passed in,
  832. * the \c NULL terminator needs to be included.
  833. *
  834. * \return Returns the length of the name if successful, returning 0 (zero) if
  835. * no name is associated with the identifier. Otherwise returns a
  836. * negative value.
  837. *
  838. * \details H5Rget_name() retrieves a name for the object identified by \p ref.\n
  839. * \p loc_id is used to identify the file containing the reference. It
  840. * can be the file identifier for the file containing the reference or
  841. * an identifier for any object in that file.
  842. *
  843. * \ref H5R_type_t is the reference type of \p ref. Valid values
  844. * include the following:
  845. * \snippet this H5R_type_t_snip
  846. *
  847. * \p ref is the reference for which the target object’s name is
  848. * sought.
  849. *
  850. * If \p ref is an object reference, \p name will be returned with a
  851. * name for the referenced object. If \p ref is a dataset region
  852. * reference, \p name will contain a name for the object containing the
  853. * referenced region.
  854. *
  855. * Up to \p size characters of the name are returned in \p name;
  856. * additional characters, if any, are not returned to the user
  857. * application.
  858. *
  859. * If the length of the name, which determines the required value of \p
  860. * size, is unknown, a preliminary H5Rget_name() call can be made. The
  861. * return value of this call will be the size of the object name. That
  862. * value can then be assigned to \p size for a second H5Rget_name()
  863. * call, which will retrieve the actual name.
  864. *
  865. * If there is no name associated with the object identifier or if the
  866. * \p name is \c NULL, H5Rget_name() returns the size of the \p name
  867. * buffer (the size does not include the \p NULL terminator).
  868. *
  869. * Note that an object in an HDF5 file may have multiple paths if there
  870. * are multiple links pointing to it. This function may return any one
  871. * of these paths.
  872. *
  873. * \since 1.8.0
  874. */
  875. H5_DLL ssize_t H5Rget_name(hid_t loc_id, H5R_type_t ref_type, const void *ref, char *name, size_t size);
  876. #ifdef __cplusplus
  877. }
  878. #endif
  879. #endif /* H5Rpublic_H */