Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-18 09:29:57

0001 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
0002  * Copyright by The HDF Group.                                               *
0003  * All rights reserved.                                                      *
0004  *                                                                           *
0005  * This file is part of HDF5.  The full HDF5 copyright notice, including     *
0006  * terms governing use, modification, and redistribution, is contained in    *
0007  * the COPYING file, which can be found at the root of the source code       *
0008  * distribution tree, or in https://www.hdfgroup.org/licenses.               *
0009  * If you do not have access to either file, you may request a copy from     *
0010  * help@hdfgroup.org.                                                        *
0011  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
0012 
0013 /*
0014  * This file contains public declarations for the HDF5 module.
0015  */
0016 #ifndef H5public_H
0017 #define H5public_H
0018 
0019 /* Include files for public use... */
0020 /*
0021  * Since H5pubconf.h is a generated header file, it is messy to try
0022  * to put a #ifndef H5pubconf_H ... #endif guard in it.
0023  * HDF5 has set an internal rule that it is being included here.
0024  * Source files should NOT include H5pubconf.h directly but include
0025  * it via H5public.h.  The #ifndef H5public_H guard above would
0026  * prevent repeated include.
0027  */
0028 #include "H5pubconf.h" /* From configure */
0029 
0030 /* API Version macro wrapper definitions */
0031 #include "H5version.h"
0032 
0033 #ifdef H5_HAVE_FEATURES_H
0034 #include <features.h> /* For setting POSIX, BSD, etc. compatibility */
0035 #endif
0036 
0037 /* C library header files for things that appear in HDF5 public headers */
0038 #ifdef __cplusplus
0039 #include <cinttypes>
0040 #else
0041 #include <inttypes.h>
0042 #endif
0043 #include <limits.h>
0044 #include <stdarg.h>
0045 #include <stdbool.h>
0046 #include <stddef.h>
0047 #include <stdint.h>
0048 
0049 /* Unlike most sys/ headers, which are POSIX-only, sys/types.h is available
0050  * on Windows, though it doesn't necessarily contain all the POSIX types
0051  * we need for HDF5 (e.g. ssize_t).
0052  */
0053 #ifdef H5_HAVE_SYS_TYPES_H
0054 #include <sys/types.h>
0055 #endif
0056 
0057 #ifdef H5_HAVE_PARALLEL
0058 /* Don't link against MPI C++ bindings */
0059 #ifndef MPICH_SKIP_MPICXX
0060 #define MPICH_SKIP_MPICXX 1
0061 #endif
0062 #ifndef OMPI_SKIP_MPICXX
0063 #define OMPI_SKIP_MPICXX 1
0064 #endif
0065 #include <mpi.h>
0066 #ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */
0067 #include <mpio.h>
0068 #endif
0069 #endif
0070 
0071 /* Macro to hide a symbol from further preprocessor substitutions */
0072 #define H5_NO_EXPAND(x) (x)
0073 
0074 /* Version numbers */
0075 /**
0076  * For major interface/format changes
0077  */
0078 #define H5_VERS_MAJOR 1
0079 /**
0080  * For minor interface/format changes
0081  */
0082 #define H5_VERS_MINOR 14
0083 /**
0084  * For tweaks, bug-fixes, or development
0085  */
0086 #define H5_VERS_RELEASE 6
0087 /**
0088  * For pre-releases like \c snap0. Empty string for official releases.
0089  */
0090 #define H5_VERS_SUBRELEASE ""
0091 /**
0092  * Short version string
0093  */
0094 #define H5_VERS_STR "1.14.6"
0095 /**
0096  * Full version string
0097  */
0098 #define H5_VERS_INFO "HDF5 library version: 1.14.6"
0099 
0100 #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE)
0101 
0102 /* macros for comparing the version */
0103 /**
0104  * \brief Determines whether the version of the library being used is greater
0105  *        than or equal to the specified version
0106  *
0107  * \param[in] Maj Major version number - A non-negative integer value
0108  * \param[in] Min Minor version number - A non-negative integer value
0109  * \param[in] Rel Release version number - A non-negative integer value
0110  * \return A value of 1 is returned if the library version is greater than
0111  *          or equal to the version number specified.\n
0112  *          A value of 0 is returned if the library version is less than the
0113  *          version number specified.\n
0114  *          A library version is greater than the specified version number if
0115  *          its major version is larger than the specified major version
0116  *          number. If the major version numbers are the same, it is greater
0117  *          than the specified version number if its minor version is larger
0118  *          than the specified minor version number. If the minor version
0119  *          numbers are the same, then a library version would be greater than
0120  *          the specified version number if its release number is larger than
0121  *          the specified release number.
0122  *
0123  * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile
0124  *          time to conditionally include or exclude code based on the version
0125  *          of the HDF5 library against which an application will be linked.
0126  *
0127  *          The #H5_VERSION_GE macro compares the version of the HDF5 library
0128  *          being used against the version number specified in the parameters.
0129  *
0130  *          For more information about release versioning, see \ref RELVERSION.
0131  *
0132  * \since 1.8.7
0133  *
0134  */
0135 #define H5_VERSION_GE(Maj, Min, Rel)                                                                         \
0136     (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE >= Rel)) ||                       \
0137      ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR > Min)) || (H5_VERS_MAJOR > Maj))
0138 
0139 /**
0140  * \brief Determines whether the version of the library being used is less
0141  *        than or equal to the specified version
0142  *
0143  * \param[in] Maj Major version number - A non-negative integer value
0144  * \param[in] Min Minor version number - A non-negative integer value
0145  * \param[in] Rel Release version number - A non-negative integer value
0146  * \return A value of 1 is returned if the library version is less than
0147  *          or equal to the version number specified.\n
0148  *          A value of 0 is returned if the library version is greater than the
0149  *          version number specified.\n
0150  *          A library version is less than the specified version number if
0151  *          its major version is smaller than the specified major version
0152  *          number. If the major version numbers are the same, it is smaller
0153  *          than the specified version number if its minor version is smaller
0154  *          than the specified minor version number. If the minor version
0155  *          numbers are the same, then a library version would be smaller than
0156  *          the specified version number if its release number is smaller than
0157  *          the specified release number.
0158  *
0159  * \details The #H5_VERSION_GE and #H5_VERSION_LE macros are used at compile
0160  *          time to conditionally include or exclude code based on the version
0161  *          of the HDF5 library against which an application will be linked.
0162  *
0163  *          The #H5_VERSION_LE macro compares the version of the HDF5 library
0164  *          being used against the version number specified in the parameters.
0165  *
0166  *          For more information about release versioning, see \ref RELVERSION.
0167  *
0168  * \since 1.8.7
0169  *
0170  */
0171 #define H5_VERSION_LE(Maj, Min, Rel)                                                                         \
0172     (((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR == Min) && (H5_VERS_RELEASE <= Rel)) ||                       \
0173      ((H5_VERS_MAJOR == Maj) && (H5_VERS_MINOR < Min)) || (H5_VERS_MAJOR < Maj))
0174 
0175 /* Macros for various environment variables that HDF5 interprets */
0176 /**
0177  * Used to specify the name of an HDF5 Virtual File Driver to use as
0178  * the default file driver for file access. Setting this environment
0179  * variable overrides the default file driver for File Access Property
0180  * Lists.
0181  */
0182 #define HDF5_DRIVER "HDF5_DRIVER"
0183 /**
0184  * Used to specify a configuration string for the HDF5 Virtual File
0185  * Driver being used for file access.
0186  */
0187 #define HDF5_DRIVER_CONFIG "HDF5_DRIVER_CONFIG"
0188 /**
0189  * Used to specify the name of an HDF5 Virtual Object Layer Connector
0190  * to use as the default VOL connector for file access. Setting this
0191  * environment variable overrides the default VOL connector for File
0192  * Access Property Lists.
0193  */
0194 #define HDF5_VOL_CONNECTOR "HDF5_VOL_CONNECTOR"
0195 /**
0196  * Used to specify a delimiter-separated (currently, ';' for Windows
0197  * and ':' for other systems) list of paths that HDF5 should search
0198  * when loading plugins.
0199  */
0200 #define HDF5_PLUGIN_PATH "HDF5_PLUGIN_PATH"
0201 /**
0202  * Used to control the loading of HDF5 plugins at runtime. If this
0203  * environment variable is set to the special string "::" (defined
0204  * in H5PLpublic.h as H5PL_NO_PLUGIN), then dynamic loading of any
0205  * HDF5 plugins will be disabled. No other values are valid for this
0206  * environment variable.
0207  */
0208 #define HDF5_PLUGIN_PRELOAD "HDF5_PLUGIN_PRELOAD"
0209 /**
0210  * Used to control whether HDF5 uses file locking when creating or
0211  * opening a file. Valid values for this environment variable are
0212  * as follows:
0213  *
0214  *  "TRUE" or "1"  - Request that file locks should be used
0215  *  "FALSE" or "0" - Request that file locks should NOT be used
0216  *  "BEST_EFFORT"  - Request that file locks should be used and
0217  *                     that any locking errors caused by file
0218  *                     locking being disabled on the system
0219  *                     should be ignored
0220  */
0221 #define HDF5_USE_FILE_LOCKING "HDF5_USE_FILE_LOCKING"
0222 /**
0223  * Used to instruct HDF5 not to cleanup files created during testing.
0224  */
0225 #define HDF5_NOCLEANUP "HDF5_NOCLEANUP"
0226 
0227 /**
0228  * Status return values.  Failed integer functions in HDF5 result almost
0229  * always in a negative value (unsigned failing functions sometimes return
0230  * zero for failure) while successful return is non-negative (often zero).
0231  * The negative failure value is most commonly -1, but don't bet on it.
0232  *
0233  * The proper way to detect failure is something like:
0234  * \code
0235  * if((dset = H5Dopen2(file, name)) < 0)
0236  *    fprintf(stderr, "unable to open the requested dataset\n");
0237  * \endcode
0238  */
0239 typedef int herr_t;
0240 
0241 /**
0242  * C99-style Boolean type. Successful return values are zero (false) or positive
0243  * (true). The typical true value is 1 but don't bet on it.
0244  *
0245  * \deprecated Now that we require C99, hbool_t is typedef'd to C99's bool
0246  *             and hbool_t is considered deprecated. Due to its long-standing,
0247  *             widespread use, we have no plans to remove the hbool_t typedef
0248  *             from the public API, though we will probably switch to using
0249  *             bool in the public API starting in the next major release of HDF5.
0250  * \attention Boolean functions cannot fail.
0251  */
0252 #include <stdbool.h>
0253 typedef bool hbool_t;
0254 /**
0255  * Three-valued Boolean type. Functions that return #htri_t however return zero
0256  * (false), positive (true), or negative (failure).
0257  *
0258  * The proper way to test for truth from a #htri_t function is:
0259  * \code
0260  * if ((retval = H5Tcommitted(type)) > 0) {
0261  *     printf("data type is committed\n");
0262  * } else if (!retval) {
0263  *     printf("data type is not committed\n");
0264  * } else {
0265  *     printf("error determining whether data type is committed\n");
0266  * }
0267  * \endcode
0268  */
0269 typedef int htri_t;
0270 
0271 /* The signed version of size_t
0272  *
0273  * ssize_t is POSIX and not defined in any C standard. It's used in some
0274  * public HDF5 API calls so this work-around will define it if it's not
0275  * present.
0276  *
0277  * Use of ssize_t should be discouraged in new code.
0278  */
0279 #if H5_SIZEOF_SSIZE_T == 0
0280 /* Undefine this size, we will re-define it in one of the sections below */
0281 #undef H5_SIZEOF_SSIZE_T
0282 #if H5_SIZEOF_SIZE_T == H5_SIZEOF_INT
0283 typedef int ssize_t;
0284 #define H5_SIZEOF_SSIZE_T H5_SIZEOF_INT
0285 #elif H5_SIZEOF_SIZE_T == H5_SIZEOF_LONG
0286 typedef long ssize_t;
0287 #define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG
0288 #elif H5_SIZEOF_SIZE_T == H5_SIZEOF_LONG_LONG
0289 typedef long long ssize_t;
0290 #define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG
0291 #else /* Can't find matching type for ssize_t */
0292 #error "nothing appropriate for ssize_t"
0293 #endif
0294 #endif
0295 
0296 /**
0297  * The size of file objects.
0298  *
0299  * \internal Defined as a (minimum) 64-bit integer type.
0300  */
0301 typedef uint64_t hsize_t;
0302 
0303 #ifdef H5_HAVE_PARALLEL
0304 #define HSIZE_AS_MPI_TYPE MPI_UINT64_T
0305 #endif
0306 
0307 /**
0308  * The size of file objects. Used when negative values are needed to indicate errors.
0309  *
0310  * \internal Defined as a (minimum) 64-bit integer type. Use of hssize_t
0311  * should be discouraged in new code.
0312  */
0313 typedef int64_t hssize_t;
0314 /** d print conversion specifier for signed integer type \since 1.10.8 */
0315 #define PRIdHSIZE PRId64
0316 /** i print conversion specifier for signed integer type \since 1.10.8 */
0317 #define PRIiHSIZE PRIi64
0318 /** o print conversion specifier for signed integer type \since 1.10.8 */
0319 #define PRIoHSIZE PRIo64
0320 /** u print conversion specifier for signed integer type \since 1.10.8 */
0321 #define PRIuHSIZE PRIu64
0322 /** x print conversion specifier for signed integer type \since 1.10.8 */
0323 #define PRIxHSIZE PRIx64
0324 /** X print conversion specifier for signed integer type \since 1.10.8 */
0325 #define PRIXHSIZE          PRIX64
0326 #define H5_SIZEOF_HSIZE_T  8
0327 #define H5_SIZEOF_HSSIZE_T 8
0328 /** Represents the largest possible value of uint64_t \since 1.10.0 */
0329 #define HSIZE_UNDEF UINT64_MAX
0330 
0331 /**
0332  * The address of an object in the file.
0333  *
0334  * \internal Defined as a (minimum) 64-bit unsigned integer type.
0335  */
0336 typedef uint64_t haddr_t;
0337 /** d print conversion specifier for unsigned integer type \since 1.8.23 */
0338 #define PRIdHADDR PRId64
0339 /** o print conversion specifier for unsigned integer type \since 1.8.23 */
0340 #define PRIoHADDR PRIo64
0341 /** u print conversion specifier for unsigned integer type \since 1.8.23 */
0342 #define PRIuHADDR PRIu64
0343 /** x print conversion specifier for unsigned integer type \since 1.8.23 */
0344 #define PRIxHADDR PRIx64
0345 /** X print conversion specifier for unsigned integer type \since 1.8.23 */
0346 #define PRIXHADDR           PRIX64
0347 #define H5_SIZEOF_HADDR_T   8
0348 #define HADDR_UNDEF         UINT64_MAX
0349 #define H5_PRINTF_HADDR_FMT "%" PRIuHADDR
0350 #define HADDR_MAX           (HADDR_UNDEF - 1)
0351 
0352 #ifdef H5_HAVE_PARALLEL
0353 #define HADDR_AS_MPI_TYPE MPI_UINT64_T
0354 #endif
0355 
0356 //! <!-- [H5_iter_order_t_snip] -->
0357 /**
0358  * Common iteration orders
0359  */
0360 typedef enum {
0361     H5_ITER_UNKNOWN = -1, /**< Unknown order */
0362     H5_ITER_INC,          /**< Increasing order */
0363     H5_ITER_DEC,          /**< Decreasing order */
0364     H5_ITER_NATIVE,       /**< No particular order, whatever is fastest */
0365     H5_ITER_N             /**< Number of iteration orders */
0366 } H5_iter_order_t;
0367 //! <!-- [H5_iter_order_t_snip] -->
0368 
0369 /* Iteration callback values */
0370 /* (Actually, any positive value will cause the iterator to stop and pass back
0371  *      that positive value to the function that called the iterator)
0372  */
0373 #define H5_ITER_ERROR (-1) /**< Error, stop iteration */
0374 #define H5_ITER_CONT  (0)  /**< Continue iteration */
0375 #define H5_ITER_STOP  (1)  /**< Stop iteration, short-circuit success */
0376 
0377 //! <!-- [H5_index_t_snip] -->
0378 /**
0379  * The types of indices on links in groups/attributes on objects.
0380  * Primarily used for "<do> <foo> by index" routines and for iterating over
0381  * links in groups/attributes on objects.
0382  */
0383 typedef enum H5_index_t {
0384     H5_INDEX_UNKNOWN = -1, /**< Unknown index type                   */
0385     H5_INDEX_NAME,         /**< Index on names                       */
0386     H5_INDEX_CRT_ORDER,    /**< Index on creation order              */
0387     H5_INDEX_N             /**< Number of indices defined            */
0388 } H5_index_t;
0389 //! <!-- [H5_index_t_snip] -->
0390 
0391 /**
0392  * Storage info struct used by H5O_info_t and H5F_info_t
0393  */
0394 //! <!-- [H5_ih_info_t_snip] -->
0395 typedef struct H5_ih_info_t {
0396     hsize_t index_size; /**< btree and/or list */
0397     hsize_t heap_size;
0398 } H5_ih_info_t;
0399 //! <!-- [H5_ih_info_t_snip] -->
0400 
0401 /**
0402  * The maximum size allowed for tokens
0403  * \details Tokens are unique and permanent identifiers that are
0404  *          used to reference HDF5 objects in a container. This allows
0405  *          for 128-bit tokens
0406  *
0407  * \since 1.12.0
0408  */
0409 #define H5O_MAX_TOKEN_SIZE (16)
0410 
0411 //! <!-- [H5O_token_t_snip] -->
0412 /**
0413  * Type for object tokens
0414  *
0415  * \internal (Hoisted here, since it's used by both the
0416  *            H5Lpublic.h and H5Opublic.h headers)
0417  */
0418 typedef struct H5O_token_t {
0419     uint8_t __data[H5O_MAX_TOKEN_SIZE];
0420 } H5O_token_t;
0421 //! <!-- [H5O_token_t_snip] -->
0422 
0423 /**
0424  * Library shutdown callback, used by H5atclose().
0425  */
0426 typedef void (*H5_atclose_func_t)(void *ctx);
0427 
0428 /* API adapter header (defines H5_DLL, etc.) */
0429 #include "H5api_adpt.h"
0430 
0431 #ifdef __cplusplus
0432 extern "C" {
0433 #endif
0434 
0435 /* Functions in H5.c */
0436 /**
0437  * \ingroup H5
0438  * \brief Initializes the HDF5 library
0439  * \return \herr_t
0440  *
0441  * \details H5open() initializes the HDF5 library.
0442  *
0443  * \details When the HDF5 library is used in a C application, the library is
0444  *          automatically initialized when the first HDF5 function call is
0445  *          issued. If one finds that an HDF5 library function is failing
0446  *          inexplicably, H5open() can be called first. It is safe to call
0447  *          H5open() before an application issues any other function calls to
0448  *          the HDF5 library, as there are no damaging side effects in calling
0449  *          it more than once.
0450  *
0451  * \since 1.0.0
0452  *
0453  */
0454 H5_DLL herr_t H5open(void);
0455 /**
0456  * \ingroup H5
0457  * \brief Registers a callback for the library to invoke when it's closing.
0458  * \param[in] func The function pointer to invoke
0459  * \param[in] ctx Context to pass to \p func when invoked
0460  * \return \herr_t
0461  *
0462  * \details H5atclose() registers a callback that the HDF5 library will invoke
0463  *          when closing.  The full capabilities of the HDF5 library are
0464  *          available to callbacks invoked through this mechanism, and library
0465  *          shutdown will only begin in earnest when all callbacks have been
0466  *          invoked and have returned.
0467  *
0468  *          Registered callbacks are invoked in LIFO order, similar to the
0469  *          Standard C 'atexit' routine.  For example, if 'func1' is registered,
0470  *          then 'func2', when the library is closing 'func2', will
0471  *          be invoked first, then 'func1'.
0472  *
0473  *          The \p ctx pointer will be passed to \p func when it's invoked.
0474  *          NULL is allowed for \p ctx.
0475  *
0476  *          If the HDF5 library is initialized and closed more than once, the
0477  *          \p func callback must be registered within each open/close cycle.
0478  *
0479  * \since 1.14.0
0480  */
0481 H5_DLL herr_t H5atclose(H5_atclose_func_t func, void *ctx);
0482 /**
0483  * \ingroup H5
0484  * \brief Flushes all data to disk, closes all open objects, and releases memory
0485  * \return \herr_t
0486  *
0487  * \details H5close() flushes all data to disk, closes all open HDF5 objects,
0488  *          and cleans up all memory used by the HDF5 library. This function is
0489  *          generally called when the application calls exit(), but may be
0490  *          called earlier in the event of an emergency shutdown or out of a
0491  *          desire to free all resources used by the HDF5 library.
0492  *
0493  * \since 1.0.0
0494  *
0495  */
0496 H5_DLL herr_t H5close(void);
0497 /**
0498  * \ingroup H5
0499  * \brief Instructs library not to install atexit() cleanup routine
0500  * \return \herr_t
0501  *
0502  * \details H5dont_atexit() indicates to the library that an atexit() cleanup
0503  *          routine should not be installed. The major purpose for using this
0504  *          function is in situations where the library is dynamically linked
0505  *          into an application and is un-linked from the application before
0506  *          exit() gets called. In those situations, a routine installed with
0507  *          atexit() would jump to a routine that was no longer in memory,
0508  *          causing errors.
0509  *
0510  * \attention In order to be effective, this routine \Emph{must} be called
0511  *            before any other HDF5 function calls, and must be called each
0512  *            time the library is loaded/linked into the application (the first
0513  *            time and after it's been unloaded).
0514  *
0515  * \since 1.0.0
0516  *
0517  */
0518 H5_DLL herr_t H5dont_atexit(void);
0519 /**
0520  * \ingroup H5
0521  * \brief Garbage collects on all free-lists of all types
0522  * \return \herr_t
0523  *
0524  * \details H5garbage_collect() walks through all garbage collection routines
0525  *          of the library, freeing any unused memory.
0526  *
0527  *          It is not required that H5garbage_collect() be called at any
0528  *          particular time; it is only necessary for certain situations where
0529  *          the application has performed actions that cause the library to
0530  *          allocate many objects. The application should call
0531  *          H5garbage_collect() if it eventually releases those objects and
0532  *          wants to reduce the memory used by the library from the peak usage
0533  *          required.
0534  *
0535  * \note The library automatically garbage collects all the free lists when the
0536  *       application ends.
0537  *
0538  * \since 1.4.0
0539  *
0540  */
0541 H5_DLL herr_t H5garbage_collect(void);
0542 /**
0543  * \ingroup H5
0544  * \brief Sets free-list size limits
0545  *
0546  * \param[in] reg_global_lim The cumulative limit, in bytes, on memory used for
0547  *                           all regular free lists (Default: 1MB)
0548  * \param[in] reg_list_lim The limit, in bytes, on memory used for each regular
0549  *                         free list (Default: 64KB)
0550  * \param[in] arr_global_lim The cumulative limit, in bytes, on memory used for
0551  *                           all array free lists (Default: 4MB)
0552  * \param[in] arr_list_lim The limit, in bytes, on memory used for each array
0553  *                         free list (Default: 256KB)
0554  * \param[in] blk_global_lim The cumulative limit, in bytes, on memory used for
0555  *                           all block free lists and, separately, for all
0556  *                           factory free lists (Default: 16MB)
0557  * \param[in] blk_list_lim The limit, in bytes, on memory used for each block
0558  *                         or factory free list (Default: 1MB)
0559  * \return \herr_t
0560  *
0561  * \details H5set_free_list_limits() sets size limits on all types of free
0562  *          lists. The HDF5 library uses free lists internally to manage
0563  *          memory. The types of free lists used are as follows:
0564  *          \li Regular free lists manage memory for single internal data
0565  *              structures.
0566  *          \li Array free lists manage memory for arrays of internal
0567  *              data structures.
0568  *          \li Block free lists manage memory for arbitrarily-sized blocks
0569  *              of bytes.
0570  *          \li Factory free lists manage memory for fixed-size blocks of
0571  *              bytes.
0572  *
0573  *          The parameters specify global and per-list limits; for example, \p
0574  *          reg_global_limit and \p reg_list_limit limit the accumulated size
0575  *          of all regular free lists and the size of each individual regular
0576  *          free list, respectively. Therefore, if an application sets a 1Mb
0577  *          limit on each of the global lists, up to 4Mb of total storage might
0578  *          be allocated, 1Mb for each of the regular, array, block, and
0579  *          factory type lists.
0580  *
0581  *          The settings specified for block free lists are duplicated for
0582  *          factory free lists. Therefore, increasing the global limit on block
0583  *          free lists by x bytes will increase the potential free list memory
0584  *          usage by 2x bytes.
0585  *
0586  *          Using a value of -1 for a limit means that no limit is set for the
0587  *          specified type of free list.
0588  *
0589  * \version 1.8.3 Function changed in this release to set factory free list
0590  *                memory limits.
0591  *
0592  * \since 1.4.0
0593  */
0594 H5_DLL herr_t H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim,
0595                                      int arr_list_lim, int blk_global_lim, int blk_list_lim);
0596 /**
0597  * \ingroup H5
0598  * \brief Gets the current size of the free lists used to manage memory
0599  *
0600  * \param[out] reg_size The current size of all "regular" free list memory used
0601  * \param[out] arr_size The current size of all "array" free list memory used
0602  * \param[out] blk_size The current size of all "block" free list memory used
0603  * \param[out] fac_size The current size of all "factory" free list memory used
0604  * \return \herr_t
0605  *
0606  * \details H5get_free_list_sizes() obtains the current size of the different
0607  *          kinds of free lists that the library uses to manage memory. The
0608  *          free list sizes can be set with H5set_free_list_limits() and
0609  *          garbage collected with H5garbage_collect(). These lists are global
0610  *          for the entire library.
0611  *
0612  * \since 1.10.7
0613  */
0614 H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size);
0615 /**
0616  * \ingroup H5
0617  * \brief Returns the HDF library release number
0618  *
0619  * \param[out] majnum The major version number of the library
0620  * \param[out] minnum The minor version number of the library
0621  * \param[out] relnum The release version number of the library
0622  * \return \herr_t
0623  *
0624  * \details H5get_libversion() retrieves the major, minor, and release numbers
0625  *          of the version of the HDF5 library which is linked to the
0626  *          application.
0627  *
0628  * \since 1.0.0
0629  *
0630  */
0631 H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum);
0632 /**
0633  * \ingroup H5
0634  * \brief Verifies that HDF5 library versions are consistent
0635  *
0636  * \param[in] majnum HDF5 library major version number
0637  * \param[in] minnum HDF5 library minor version number
0638  * \param[in] relnum HDF5 library release number
0639  * \return \herr_t
0640  *
0641  * \details H5check_version() verifies that the version of the HDF5 library
0642  *          with which an application was compiled, as indicated by the passed
0643  *          parameters, matches the version of the HDF5 library against which
0644  *          the application is currently linked.
0645  *
0646  *          \p majnum is the major version number of the HDF library with which
0647  *          the application was compiled, \p minnum is the minor version
0648  *          number, and \p relnum is the release number. Consider the following
0649  *          example:
0650  *
0651  *          An official HDF5 release is labelled as follows:
0652  *          HDF5 Release \TText{\<majnum\>.\<minnum\>.\<relnum\>}\n
0653  *          For example, in HDF5 Release 1.8.5:
0654  *          \li 1 is the major version number, \p majnum.
0655  *          \li 8 is the minor version number, \p minnum.
0656  *          \li 5 is the release number, \p relnum.
0657  *
0658  *          As stated above, H5check_version() first verifies that the version
0659  *          of the HDF5 library with which an application was compiled matches
0660  *          the version of the HDF5 library against which the application is
0661  *          currently linked. If this check fails, H5check_version() causes the
0662  *          application to abort (by means of a standard C abort() call) and
0663  *          prints information that is usually useful for debugging. This
0664  *          precaution is taken to avoid the risks of data corruption or
0665  *          segmentation faults.
0666  *
0667  *          The most common cause of this failure is that an application was
0668  *          compiled with one version of HDF5 and is dynamically linked with a
0669  *          different version different version.
0670  *
0671  *          If the above test passes, H5check_version() proceeds to verify the
0672  *          consistency of additional library version information. This is
0673  *          designed to catch source code inconsistencies that do not normally
0674  *          cause failures; if this check reveals an inconsistency, an
0675  *          informational warning is printed but the application is allowed to
0676  *          run.
0677  *
0678  * \since 1.0.0
0679  *
0680  */
0681 H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum);
0682 /**
0683  * \ingroup H5
0684  * \brief Checks whether the HDF5 library is closing.
0685  * \param[out] is_terminating Flag indicating whether library is shutting down
0686  * \return \herr_t
0687  *
0688  * \details H5is_library_terminating() queries whether the HDF5 library is in
0689  *          the process of shutting down.  The \p is_terminating flag will only
0690  *          be set to true after shutdown starts, it will be false before the
0691  *          library has been initialized, while the library is initialized, and
0692  *          after it has been closed.  The value of \p is_terminating is
0693  *          undefined if this routine fails.
0694  *
0695  * \since 1.14.0
0696  */
0697 H5_DLL herr_t H5is_library_terminating(hbool_t *is_terminating);
0698 /**
0699  * \ingroup H5
0700  * \brief Determines whether the HDF5 library was built with the thread-safety
0701  *        feature enabled
0702  *
0703  * \param[out] is_ts Boolean value indicating whether the library was built
0704  *                   with thread-safety enabled
0705  * \return \herr_t
0706  *
0707  * \details The HDF5 library, although not internally multi-threaded, can be
0708  *          built with a thread-safety feature enabled that protects internal
0709  *          data structures with a mutex. In certain circumstances, it may be
0710  *          useful to determine, at run-time, whether the linked HDF5 library
0711  *          was built with the thread-safety feature enabled.
0712  *
0713  * \since 1.10.0
0714  *
0715  */
0716 H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
0717 /**
0718  * \ingroup H5
0719  * \brief Frees memory allocated by the HDF5 library
0720  *
0721  * \param[in] mem Buffer to be freed. Can be NULL
0722  * \return \herr_t
0723  *
0724  * \details H5free_memory() frees the memory that has been allocated by the caller
0725  *          with H5allocate_memory() or by the HDF5 library on behalf of the
0726  *          caller.
0727  *
0728  *          H5Tget_member_name() provides an example of memory allocation on
0729  *          behalf of the caller: The function returns a buffer containing the
0730  *          name of a compound datatype member. It is the caller's
0731  *          responsibility to eventually free that buffer with H5free_memory().
0732  *
0733  * \attention It is especially important to use this function to free memory
0734  *            allocated by the library on Windows. The C standard library is
0735  *            implemented in dynamic link libraries (DLLs) known as the C
0736  *            run-time (CRT). Each version of Visual Studio comes with two CRT
0737  *            DLLs (debug and release) and allocating and freeing across DLL
0738  *            boundaries can cause resource leaks and subtle bugs due to heap
0739  *            corruption.\n
0740  *            Only use this function to free memory allocated by the HDF5
0741  *            Library. It will generally not be safe to use this function to
0742  *            free memory allocated by any other means.\n
0743  *            Even when using this function, it is still best to ensure that
0744  *            all components of a C application are built with the same version
0745  *            of Visual Studio and build (debug or release) and thus linked
0746  *            against the same CRT.
0747  *
0748  * \see H5allocate_memory(), H5resize_memory()
0749  *
0750  * \since 1.8.13
0751  *
0752  */
0753 H5_DLL herr_t H5free_memory(void *mem);
0754 /**
0755  * \ingroup H5
0756  * \brief Allocates memory that will be freed later internally.
0757  *
0758  * \param[in] size The size in bytes of the buffer to be allocated
0759  * \param[in] clear Flag whether the new buffer is to be initialized with 0
0760  *
0761  * \return On success, returns pointer to newly allocated buffer or returns
0762  *         NULL if size is 0 (zero).\n
0763  *         Returns NULL on failure.
0764  *
0765  * \details H5allocate_memory() allocates a memory buffer of size bytes that
0766  *          will later be freed internally by the HDF5 library.
0767  *
0768  *          The boolean \p clear parameter specifies whether the buffer should
0769  *          be initialized. If clear is \c true, all bits in the buffer are to be
0770  *          set to 0 (zero); if clear is \c false, the buffer will not be
0771  *          initialized.
0772  *
0773  *          This function is intended to have the semantics of malloc() and
0774  *          calloc(). However, unlike malloc() and calloc(), which allow for a
0775  *          "special" pointer to be returned instead of NULL, this function
0776  *          always returns NULL on failure or when size is set to 0 (zero).
0777  *
0778  * \note At this time, the only intended use for this function is to allocate
0779  *       memory that will be returned to the library as a data buffer from a
0780  *       third-party filter.
0781  *
0782  * \attention To avoid heap corruption, allocated memory should be freed using
0783  *            the same library that initially allocated it. In most cases, the
0784  *            HDF5 API uses resources that are allocated and freed either
0785  *            entirely by the user or entirely by the library, so this is not a
0786  *            problem. In rare cases, however, HDF5 API calls will free the memory
0787  *            that the user allocated. This function allows the user to safely
0788  *            allocate this memory.\n
0789  *            It is particularly important to use this function to allocate
0790  *            memory in Microsoft Windows environments. In Windows, the C
0791  *            standard library is implemented in dynamic link libraries (DLLs)
0792  *            known as the C run-time (CRT). Each version of Visual Studio
0793  *            comes with multiple versions of the CRT DLLs (debug, release, et
0794  *            cetera) and allocating and freeing memory across DLL boundaries
0795  *            can cause resource leaks and subtle bugs due to heap corruption.\n
0796  *            Even when using this function, it is best where possible to
0797  *            ensure that all components of a C application are built with the
0798  *            same version of Visual Studio and configuration (Debug or
0799  *            Release), and thus linked against the same CRT.\n
0800  *            Use this function only to allocate memory inside third-party HDF5
0801  *            filters. It will generally not be safe to use this function to
0802  *            allocate memory for any other purpose.
0803  *
0804  * \see H5free_memory(), H5resize_memory()
0805  *
0806  * \since 1.8.15
0807  *
0808  */
0809 H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
0810 /**
0811  * \ingroup H5
0812  * \brief Resizes and, if required, re-allocates memory that will later be
0813  *        freed internally by the HDF5 library
0814  *
0815  * \param[in] mem Pointer to a buffer to be resized. May be NULL
0816  * \param[in] size New size of the buffer, in bytes
0817 
0818  *
0819  * \return On success, returns pointer to resized or reallocated buffer
0820  *         or returns NULL if size is 0 (zero).\n
0821  *         Returns NULL on failure.
0822  *
0823  * \details H5resize_memory() takes a pointer to an existing buffer and resizes
0824  *          the buffer to match the value in \p size. If necessary, the buffer
0825  *          is reallocated. If \p size is 0, the buffer is released.
0826  *
0827  *          The input buffer must either be NULL or have been allocated by
0828  *          H5allocate_memory() since the input buffer may be freed by the
0829  *          library.
0830  *
0831  *          For certain behaviors, the pointer \p mem may be passed in as NULL.
0832  *
0833  *          This function is intended to have the semantics of realloc():
0834  *
0835  *          <table>
0836  *            <tr><td>\TText{H5resize_memory(buffer, size)}</td>
0837  *                <td>Resizes buffer. Returns pointer to resized buffer.</td></tr>
0838  *            <tr><td>\TText{H5resize_memory(NULL, size)}</td>
0839  *                <td>Allocates memory using HDF5 Library allocator.
0840  *                    Returns pointer to new buffer</td></tr>
0841  *            <tr><td>\TText{H5resize_memory(buffer, 0)}</td>
0842  *                <td>Frees memory using HDF5 Library allocator.
0843  *                    Returns NULL.</td></tr>
0844  *            <tr><td>\TText{H5resize_memory(NULL, 0)}</td>
0845  *                <td>Returns NULL (undefined in C standard).</td></tr>
0846  *          </table>
0847  *
0848  *          Unlike realloc(), which allows for a "special pointer to be
0849  *          returned instead of NULL, this function always returns NULL on
0850  *          failure or when size is 0 (zero).
0851  *
0852  * \note At this time, the only intended use for this function is to resize or
0853  *       reallocate memory that will be returned to the library (and eventually
0854  *       to the user) as a data buffer from a third-party HDF5 filter.
0855  *
0856  * \attention To avoid heap corruption, allocated memory should be freed using
0857  *            the same library that initially allocated it. In most cases, the
0858  *            HDF5 API uses resources that are allocated and freed either
0859  *            entirely by the user or entirely by the library, so this is not a
0860  *            problem. In rare cases, however, HDF5 API calls will free memory
0861  *            that the user allocated. This function allows the user to safely
0862  *            allocate this memory.\n
0863  *            It is particularly important to use this function to resize
0864  *            memory on Microsoft Windows systems. In Windows, the C standard
0865  *            library is implemented in dynamic link libraries (DLLs) known as
0866  *            the C run-time (CRT). Each version of Visual Studio comes with
0867  *            multiple versions of the CRT DLLs (debug, release, et cetera) and
0868  *            allocating and freeing memory across DLL boundaries can cause
0869  *            resource leaks and subtle bugs due to heap corruption.\n
0870  *            Even when using this function, it is still best to ensure that
0871  *            all components of a C application are built with the same version
0872  *            of Visual Studio and the same configuration (Debug or Release),
0873  *            and thus linked against the same CRT.\n
0874  *            Only use this function to resize memory inside third-party HDF5
0875  *            filters. It will generally not be safe to use this function to
0876  *            resize memory for any other purpose.
0877  *
0878  * \see H5allocate_memory(), H5free_memory()
0879  *
0880  * \since 1.8.15
0881  *
0882  */
0883 H5_DLL void *H5resize_memory(void *mem, size_t size);
0884 
0885 #ifdef __cplusplus
0886 }
0887 #endif
0888 #endif /* H5public_H */