H5Idevelop.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. * Copyright by The HDF Group. *
  3. * All rights reserved. *
  4. * *
  5. * This file is part of HDF5. The full HDF5 copyright notice, including *
  6. * terms governing use, modification, and redistribution, is contained in *
  7. * the COPYING file, which can be found at the root of the source code *
  8. * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
  9. * If you do not have access to either file, you may request a copy from *
  10. * help@hdfgroup.org. *
  11. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  12. /*
  13. * This file contains public declarations for the H5I (ID management) developer
  14. * support routines.
  15. */
  16. #ifndef _H5Idevelop_H
  17. #define _H5Idevelop_H
  18. /* Include package's public header */
  19. #include "H5Ipublic.h" /* ID management */
  20. /*****************/
  21. /* Public Macros */
  22. /*****************/
  23. /*******************/
  24. /* Public Typedefs */
  25. /*******************/
  26. /**
  27. * The type of the realize_cb callback for H5Iregister_future
  28. */
  29. //! <!-- [H5I_future_realize_func_t_snip] -->
  30. typedef herr_t (*H5I_future_realize_func_t)(void *future_object, hid_t *actual_object_id);
  31. //! <!-- [H5I_future_realize_func_t_snip] -->
  32. /**
  33. * The type of the discard_cb callback for H5Iregister_future
  34. */
  35. //! <!-- [H5I_future_discard_func_t_snip] -->
  36. typedef herr_t (*H5I_future_discard_func_t)(void *future_object);
  37. //! <!-- [H5I_future_discard_func_t_snip] -->
  38. /********************/
  39. /* Public Variables */
  40. /********************/
  41. /*********************/
  42. /* Public Prototypes */
  43. /*********************/
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. /**
  48. * \ingroup H5I
  49. *
  50. * \brief Registers a "future" object under a type and returns an ID for it
  51. *
  52. * \param[in] type The identifier of the type of the new ID
  53. * \param[in] object Pointer to "future" object for which a new ID is created
  54. * \param[in] realize_cb Function pointer to realize a future object
  55. * \param[in] discard_cb Function pointer to destroy a future object
  56. *
  57. * \return \hid_t{object}
  58. *
  59. * \details H5Iregister_future() creates and returns a new ID for a "future" object.
  60. * Future objects are a special kind of object and represent a
  61. * placeholder for an object that has not yet been created or opened.
  62. * The \p realize_cb will be invoked by the HDF5 library to 'realize'
  63. * the future object as an actual object. A call to H5Iobject_verify()
  64. * will invoke the \p realize_cb callback and if it successfully
  65. * returns, will return the actual object, not the future object.
  66. *
  67. * \details The \p type parameter is the identifier for the ID type to which
  68. * this new future ID will belong. This identifier may have been created
  69. * by a call to H5Iregister_type() or may be one of the HDF5 pre-defined
  70. * ID classes (e.g. H5I_FILE, H5I_GROUP, H5I_DATASPACE, etc).
  71. *
  72. * \details The \p object parameter is a pointer to the memory which the new ID
  73. * will be a reference to. This pointer will be stored by the library,
  74. * but will not be returned to a call to H5Iobject_verify() until the
  75. * \p realize_cb callback has returned the actual pointer for the object.
  76. *
  77. * A NULL value for \p object is allowed.
  78. *
  79. * \details The \p realize_cb parameter is a function pointer that will be
  80. * invoked by the HDF5 library to convert a future object into an
  81. * actual object. The \p realize_cb function may be invoked by
  82. * H5Iobject_verify() to return the actual object for a user-defined
  83. * ID class (i.e. an ID class registered with H5Iregister_type()) or
  84. * internally by the HDF5 library in order to use or get information
  85. * from an HDF5 pre-defined ID type. For example, the \p realize_cb
  86. * for a future dataspace object will be called during the process
  87. * of returning information from H5Sget_simple_extent_dims().
  88. *
  89. * Note that although the \p realize_cb routine returns
  90. * an ID (as a parameter) for the actual object, the HDF5 library
  91. * will swap the actual object in that ID for the future object in
  92. * the future ID. This ensures that the ID value for the object
  93. * doesn't change for the user when the object is realized.
  94. *
  95. * Note that the \p realize_cb callback could receive a NULL value
  96. * for a future object pointer, if one was used when H5Iregister_future()
  97. * was initially called. This is permitted as a means of allowing
  98. * the \p realize_cb to act as a generator of new objects, without
  99. * requiring creation of unnecessary future objects.
  100. *
  101. * It is an error to pass NULL for \p realize_cb.
  102. *
  103. * \details The \p discard_cb parameter is a function pointer that will be
  104. * invoked by the HDF5 library to destroy a future object. This
  105. * callback will always be invoked for _every_ future object, whether
  106. * the \p realize_cb is invoked on it or not. It's possible that
  107. * the \p discard_cb is invoked on a future object without the
  108. * \p realize_cb being invoked, e.g. when a future ID is closed without
  109. * requiring the future object to be realized into an actual one.
  110. *
  111. * Note that the \p discard_cb callback could receive a NULL value
  112. * for a future object pointer, if one was used when H5Iregister_future()
  113. * was initially called.
  114. *
  115. * It is an error to pass NULL for \p discard_cb.
  116. *
  117. * \note The H5Iregister_future() function is primarily targeted at VOL connector
  118. * authors and is _not_ designed for general-purpose application use.
  119. *
  120. */
  121. H5_DLL hid_t H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_t realize_cb,
  122. H5I_future_discard_func_t discard_cb);
  123. #ifdef __cplusplus
  124. }
  125. #endif
  126. #endif /* _H5Idevelop_H */