Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-18 09:16:05

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 5
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.5"
0095 /**
0096  * Full version string
0097  */
0098 #define H5_VERS_INFO "HDF5 library version: 1.14.5"
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_h5lib_relver.
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_h5lib_relver.
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 #define PRIdHSIZE          PRId64
0315 #define PRIiHSIZE          PRIi64
0316 #define PRIoHSIZE          PRIo64
0317 #define PRIuHSIZE          PRIu64
0318 #define PRIxHSIZE          PRIx64
0319 #define PRIXHSIZE          PRIX64
0320 #define H5_SIZEOF_HSIZE_T  8
0321 #define H5_SIZEOF_HSSIZE_T 8
0322 #define HSIZE_UNDEF        UINT64_MAX
0323 
0324 /**
0325  * The address of an object in the file.
0326  *
0327  * \internal Defined as a (minimum) 64-bit unsigned integer type.
0328  */
0329 typedef uint64_t haddr_t;
0330 #define PRIdHADDR           PRId64
0331 #define PRIoHADDR           PRIo64
0332 #define PRIuHADDR           PRIu64
0333 #define PRIxHADDR           PRIx64
0334 #define PRIXHADDR           PRIX64
0335 #define H5_SIZEOF_HADDR_T   8
0336 #define HADDR_UNDEF         UINT64_MAX
0337 #define H5_PRINTF_HADDR_FMT "%" PRIuHADDR
0338 #define HADDR_MAX           (HADDR_UNDEF - 1)
0339 
0340 #ifdef H5_HAVE_PARALLEL
0341 #define HADDR_AS_MPI_TYPE MPI_UINT64_T
0342 #endif
0343 
0344 //! <!-- [H5_iter_order_t_snip] -->
0345 /**
0346  * Common iteration orders
0347  */
0348 typedef enum {
0349     H5_ITER_UNKNOWN = -1, /**< Unknown order */
0350     H5_ITER_INC,          /**< Increasing order */
0351     H5_ITER_DEC,          /**< Decreasing order */
0352     H5_ITER_NATIVE,       /**< No particular order, whatever is fastest */
0353     H5_ITER_N             /**< Number of iteration orders */
0354 } H5_iter_order_t;
0355 //! <!-- [H5_iter_order_t_snip] -->
0356 
0357 /* Iteration callback values */
0358 /* (Actually, any positive value will cause the iterator to stop and pass back
0359  *      that positive value to the function that called the iterator)
0360  */
0361 #define H5_ITER_ERROR (-1) /**< Error, stop iteration */
0362 #define H5_ITER_CONT  (0)  /**< Continue iteration */
0363 #define H5_ITER_STOP  (1)  /**< Stop iteration, short-circuit success */
0364 
0365 //! <!-- [H5_index_t_snip] -->
0366 /**
0367  * The types of indices on links in groups/attributes on objects.
0368  * Primarily used for "<do> <foo> by index" routines and for iterating over
0369  * links in groups/attributes on objects.
0370  */
0371 typedef enum H5_index_t {
0372     H5_INDEX_UNKNOWN = -1, /**< Unknown index type                   */
0373     H5_INDEX_NAME,         /**< Index on names                       */
0374     H5_INDEX_CRT_ORDER,    /**< Index on creation order              */
0375     H5_INDEX_N             /**< Number of indices defined            */
0376 } H5_index_t;
0377 //! <!-- [H5_index_t_snip] -->
0378 
0379 /**
0380  * Storage info struct used by H5O_info_t and H5F_info_t
0381  */
0382 //! <!-- [H5_ih_info_t_snip] -->
0383 typedef struct H5_ih_info_t {
0384     hsize_t index_size; /**< btree and/or list */
0385     hsize_t heap_size;
0386 } H5_ih_info_t;
0387 //! <!-- [H5_ih_info_t_snip] -->
0388 
0389 /**
0390  * The maximum size allowed for tokens
0391  * \details Tokens are unique and permanent identifiers that are
0392  *          used to reference HDF5 objects in a container. This allows
0393  *          for 128-bit tokens
0394  */
0395 #define H5O_MAX_TOKEN_SIZE (16)
0396 
0397 //! <!-- [H5O_token_t_snip] -->
0398 /**
0399  * Type for object tokens
0400  *
0401  * \internal (Hoisted here, since it's used by both the
0402  *            H5Lpublic.h and H5Opublic.h headers)
0403  */
0404 typedef struct H5O_token_t {
0405     uint8_t __data[H5O_MAX_TOKEN_SIZE];
0406 } H5O_token_t;
0407 //! <!-- [H5O_token_t_snip] -->
0408 
0409 /**
0410  * Library shutdown callback, used by H5atclose().
0411  */
0412 typedef void (*H5_atclose_func_t)(void *ctx);
0413 
0414 /* API adapter header (defines H5_DLL, etc.) */
0415 #include "H5api_adpt.h"
0416 
0417 #ifdef __cplusplus
0418 extern "C" {
0419 #endif
0420 
0421 /* Functions in H5.c */
0422 /**
0423  * \ingroup H5
0424  * \brief Initializes the HDF5 library
0425  * \return \herr_t
0426  *
0427  * \details H5open() initializes the HDF5 library.
0428  *
0429  * \details When the HDF5 library is used in a C application, the library is
0430  *          automatically initialized when the first HDF5 function call is
0431  *          issued. If one finds that an HDF5 library function is failing
0432  *          inexplicably, H5open() can be called first. It is safe to call
0433  *          H5open() before an application issues any other function calls to
0434  *          the HDF5 library, as there are no damaging side effects in calling
0435  *          it more than once.
0436  *
0437  * \since 1.0.0
0438  *
0439  */
0440 H5_DLL herr_t H5open(void);
0441 /**
0442  * \ingroup H5
0443  * \brief Registers a callback for the library to invoke when it's closing.
0444  * \param[in] func The function pointer to invoke
0445  * \param[in] ctx Context to pass to \p func when invoked
0446  * \return \herr_t
0447  *
0448  * \details H5atclose() registers a callback that the HDF5 library will invoke
0449  *          when closing.  The full capabilities of the HDF5 library are
0450  *          available to callbacks invoked through this mechanism, and library
0451  *          shutdown will only begin in earnest when all callbacks have been
0452  *          invoked and have returned.
0453  *
0454  *          Registered callbacks are invoked in LIFO order, similar to the
0455  *          Standard C 'atexit' routine.  For example, if 'func1' is registered,
0456  *          then 'func2', when the library is closing 'func2', will
0457  *          be invoked first, then 'func1'.
0458  *
0459  *          The \p ctx pointer will be passed to \p func when it's invoked.
0460  *          NULL is allowed for \p ctx.
0461  *
0462  *          If the HDF5 library is initialized and closed more than once, the
0463  *          \p func callback must be registered within each open/close cycle.
0464  *
0465  * \since 1.14.0
0466  */
0467 H5_DLL herr_t H5atclose(H5_atclose_func_t func, void *ctx);
0468 /**
0469  * \ingroup H5
0470  * \brief Flushes all data to disk, closes all open objects, and releases memory
0471  * \return \herr_t
0472  *
0473  * \details H5close() flushes all data to disk, closes all open HDF5 objects,
0474  *          and cleans up all memory used by the HDF5 library. This function is
0475  *          generally called when the application calls exit(), but may be
0476  *          called earlier in the event of an emergency shutdown or out of a
0477  *          desire to free all resources used by the HDF5 library.
0478  *
0479  * \since 1.0.0
0480  *
0481  */
0482 H5_DLL herr_t H5close(void);
0483 /**
0484  * \ingroup H5
0485  * \brief Instructs library not to install atexit() cleanup routine
0486  * \return \herr_t
0487  *
0488  * \details H5dont_atexit() indicates to the library that an atexit() cleanup
0489  *          routine should not be installed. The major purpose for using this
0490  *          function is in situations where the library is dynamically linked
0491  *          into an application and is un-linked from the application before
0492  *          exit() gets called. In those situations, a routine installed with
0493  *          atexit() would jump to a routine that was no longer in memory,
0494  *          causing errors.
0495  *
0496  * \attention In order to be effective, this routine \Emph{must} be called
0497  *            before any other HDF5 function calls, and must be called each
0498  *            time the library is loaded/linked into the application (the first
0499  *            time and after it's been unloaded).
0500  *
0501  * \since 1.0.0
0502  *
0503  */
0504 H5_DLL herr_t H5dont_atexit(void);
0505 /**
0506  * \ingroup H5
0507  * \brief Garbage collects on all free-lists of all types
0508  * \return \herr_t
0509  *
0510  * \details H5garbage_collect() walks through all garbage collection routines
0511  *          of the library, freeing any unused memory.
0512  *
0513  *          It is not required that H5garbage_collect() be called at any
0514  *          particular time; it is only necessary for certain situations where
0515  *          the application has performed actions that cause the library to
0516  *          allocate many objects. The application should call
0517  *          H5garbage_collect() if it eventually releases those objects and
0518  *          wants to reduce the memory used by the library from the peak usage
0519  *          required.
0520  *
0521  * \note The library automatically garbage collects all the free lists when the
0522  *       application ends.
0523  *
0524  * \since 1.4.0
0525  *
0526  */
0527 H5_DLL herr_t H5garbage_collect(void);
0528 /**
0529  * \ingroup H5
0530  * \brief Sets free-list size limits
0531  *
0532  * \param[in] reg_global_lim The cumulative limit, in bytes, on memory used for
0533  *                           all regular free lists (Default: 1MB)
0534  * \param[in] reg_list_lim The limit, in bytes, on memory used for each regular
0535  *                         free list (Default: 64KB)
0536  * \param[in] arr_global_lim The cumulative limit, in bytes, on memory used for
0537  *                           all array free lists (Default: 4MB)
0538  * \param[in] arr_list_lim The limit, in bytes, on memory used for each array
0539  *                         free list (Default: 256KB)
0540  * \param[in] blk_global_lim The cumulative limit, in bytes, on memory used for
0541  *                           all block free lists and, separately, for all
0542  *                           factory free lists (Default: 16MB)
0543  * \param[in] blk_list_lim The limit, in bytes, on memory used for each block
0544  *                         or factory free list (Default: 1MB)
0545  * \return \herr_t
0546  *
0547  * \details H5set_free_list_limits() sets size limits on all types of free
0548  *          lists. The HDF5 library uses free lists internally to manage
0549  *          memory. The types of free lists used are as follows:
0550  *          \li Regular free lists manage memory for single internal data
0551  *              structures.
0552  *          \li Array free lists manage memory for arrays of internal
0553  *              data structures.
0554  *          \li Block free lists manage memory for arbitrarily-sized blocks
0555  *              of bytes.
0556  *          \li Factory free lists manage memory for fixed-size blocks of
0557  *              bytes.
0558  *
0559  *          The parameters specify global and per-list limits; for example, \p
0560  *          reg_global_limit and \p reg_list_limit limit the accumulated size
0561  *          of all regular free lists and the size of each individual regular
0562  *          free list, respectively. Therefore, if an application sets a 1Mb
0563  *          limit on each of the global lists, up to 4Mb of total storage might
0564  *          be allocated, 1Mb for each of the regular, array, block, and
0565  *          factory type lists.
0566  *
0567  *          The settings specified for block free lists are duplicated for
0568  *          factory free lists. Therefore, increasing the global limit on block
0569  *          free lists by x bytes will increase the potential free list memory
0570  *          usage by 2x bytes.
0571  *
0572  *          Using a value of -1 for a limit means that no limit is set for the
0573  *          specified type of free list.
0574  *
0575  * \version 1.8.3 Function changed in this release to set factory free list
0576  *                memory limits.
0577  *
0578  * \since 1.4.0
0579  */
0580 H5_DLL herr_t H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim,
0581                                      int arr_list_lim, int blk_global_lim, int blk_list_lim);
0582 /**
0583  * \ingroup H5
0584  * \brief Gets the current size of the free lists used to manage memory
0585  *
0586  * \param[out] reg_size The current size of all "regular" free list memory used
0587  * \param[out] arr_size The current size of all "array" free list memory used
0588  * \param[out] blk_size The current size of all "block" free list memory used
0589  * \param[out] fac_size The current size of all "factory" free list memory used
0590  * \return \herr_t
0591  *
0592  * \details H5get_free_list_sizes() obtains the current size of the different
0593  *          kinds of free lists that the library uses to manage memory. The
0594  *          free list sizes can be set with H5set_free_list_limits() and
0595  *          garbage collected with H5garbage_collect(). These lists are global
0596  *          for the entire library.
0597  *
0598  * \since 1.10.7
0599  */
0600 H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size);
0601 /**
0602  * \ingroup H5
0603  * \brief Returns the HDF library release number
0604  *
0605  * \param[out] majnum The major version number of the library
0606  * \param[out] minnum The minor version number of the library
0607  * \param[out] relnum The release version number of the library
0608  * \return \herr_t
0609  *
0610  * \details H5get_libversion() retrieves the major, minor, and release numbers
0611  *          of the version of the HDF5 library which is linked to the
0612  *          application.
0613  *
0614  * \since 1.0.0
0615  *
0616  */
0617 H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum);
0618 /**
0619  * \ingroup H5
0620  * \brief Verifies that HDF5 library versions are consistent
0621  *
0622  * \param[in] majnum HDF5 library major version number
0623  * \param[in] minnum HDF5 library minor version number
0624  * \param[in] relnum HDF5 library release number
0625  * \return \herr_t
0626  *
0627  * \details H5check_version() verifies that the version of the HDF5 library
0628  *          with which an application was compiled, as indicated by the passed
0629  *          parameters, matches the version of the HDF5 library against which
0630  *          the application is currently linked.
0631  *
0632  *          \p majnum is the major version number of the HDF library with which
0633  *          the application was compiled, \p minnum is the minor version
0634  *          number, and \p relnum is the release number. Consider the following
0635  *          example:
0636  *
0637  *          An official HDF5 release is labelled as follows:
0638  *          HDF5 Release \TText{\<majnum\>.\<minnum\>.\<relnum\>}\n
0639  *          For example, in HDF5 Release 1.8.5:
0640  *          \li 1 is the major version number, \p majnum.
0641  *          \li 8 is the minor version number, \p minnum.
0642  *          \li 5 is the release number, \p relnum.
0643  *
0644  *          As stated above, H5check_version() first verifies that the version
0645  *          of the HDF5 library with which an application was compiled matches
0646  *          the version of the HDF5 library against which the application is
0647  *          currently linked. If this check fails, H5check_version() causes the
0648  *          application to abort (by means of a standard C abort() call) and
0649  *          prints information that is usually useful for debugging. This
0650  *          precaution is taken to avoid the risks of data corruption or
0651  *          segmentation faults.
0652  *
0653  *          The most common cause of this failure is that an application was
0654  *          compiled with one version of HDF5 and is dynamically linked with a
0655  *          different version different version.
0656  *
0657  *          If the above test passes, H5check_version() proceeds to verify the
0658  *          consistency of additional library version information. This is
0659  *          designed to catch source code inconsistencies that do not normally
0660  *          cause failures; if this check reveals an inconsistency, an
0661  *          informational warning is printed but the application is allowed to
0662  *          run.
0663  *
0664  * \since 1.0.0
0665  *
0666  */
0667 H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum);
0668 /**
0669  * \ingroup H5
0670  * \brief Checks whether the HDF5 library is closing.
0671  * \param[out] is_terminating Flag indicating whether library is shutting down
0672  * \return \herr_t
0673  *
0674  * \details H5is_library_terminating() queries whether the HDF5 library is in
0675  *          the process of shutting down.  The \p is_terminating flag will only
0676  *          be set to true after shutdown starts, it will be false before the
0677  *          library has been initialized, while the library is initialized, and
0678  *          after it has been closed.  The value of \p is_terminating is
0679  *          undefined if this routine fails.
0680  *
0681  * \since 1.14.0
0682  */
0683 H5_DLL herr_t H5is_library_terminating(hbool_t *is_terminating);
0684 /**
0685  * \ingroup H5
0686  * \brief Determines whether the HDF5 library was built with the thread-safety
0687  *        feature enabled
0688  *
0689  * \param[out] is_ts Boolean value indicating whether the library was built
0690  *                   with thread-safety enabled
0691  * \return \herr_t
0692  *
0693  * \details The HDF5 library, although not internally multi-threaded, can be
0694  *          built with a thread-safety feature enabled that protects internal
0695  *          data structures with a mutex. In certain circumstances, it may be
0696  *          useful to determine, at run-time, whether the linked HDF5 library
0697  *          was built with the thread-safety feature enabled.
0698  *
0699  * \since 1.10.0
0700  *
0701  */
0702 H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts);
0703 /**
0704  * \ingroup H5
0705  * \brief Frees memory allocated by the HDF5 library
0706  *
0707  * \param[in] mem Buffer to be freed. Can be NULL
0708  * \return \herr_t
0709  *
0710  * \details H5free_memory() frees the memory that has been allocated by the caller
0711  *          with H5allocate_memory() or by the HDF5 library on behalf of the
0712  *          caller.
0713  *
0714  *          H5Tget_member_name() provides an example of memory allocation on
0715  *          behalf of the caller: The function returns a buffer containing the
0716  *          name of a compound datatype member. It is the caller's
0717  *          responsibility to eventually free that buffer with H5free_memory().
0718  *
0719  * \attention It is especially important to use this function to free memory
0720  *            allocated by the library on Windows. The C standard library is
0721  *            implemented in dynamic link libraries (DLLs) known as the C
0722  *            run-time (CRT). Each version of Visual Studio comes with two CRT
0723  *            DLLs (debug and release) and allocating and freeing across DLL
0724  *            boundaries can cause resource leaks and subtle bugs due to heap
0725  *            corruption.\n
0726  *            Only use this function to free memory allocated by the HDF5
0727  *            Library. It will generally not be safe to use this function to
0728  *            free memory allocated by any other means.\n
0729  *            Even when using this function, it is still best to ensure that
0730  *            all components of a C application are built with the same version
0731  *            of Visual Studio and build (debug or release) and thus linked
0732  *            against the same CRT.
0733  *
0734  * \see H5allocate_memory(), H5resize_memory()
0735  *
0736  * \since 1.8.13
0737  *
0738  */
0739 H5_DLL herr_t H5free_memory(void *mem);
0740 /**
0741  * \ingroup H5
0742  * \brief Allocates memory that will be freed later internally.
0743  *
0744  * \param[in] size The size in bytes of the buffer to be allocated
0745  * \param[in] clear Flag whether the new buffer is to be initialized with 0
0746  *
0747  * \return On success, returns pointer to newly allocated buffer or returns
0748  *         NULL if size is 0 (zero).\n
0749  *         Returns NULL on failure.
0750  *
0751  * \details H5allocate_memory() allocates a memory buffer of size bytes that
0752  *          will later be freed internally by the HDF5 library.
0753  *
0754  *          The boolean \p clear parameter specifies whether the buffer should
0755  *          be initialized. If clear is \c true, all bits in the buffer are to be
0756  *          set to 0 (zero); if clear is \c false, the buffer will not be
0757  *          initialized.
0758  *
0759  *          This function is intended to have the semantics of malloc() and
0760  *          calloc(). However, unlike malloc() and calloc(), which allow for a
0761  *          "special" pointer to be returned instead of NULL, this function
0762  *          always returns NULL on failure or when size is set to 0 (zero).
0763  *
0764  * \note At this time, the only intended use for this function is to allocate
0765  *       memory that will be returned to the library as a data buffer from a
0766  *       third-party filter.
0767  *
0768  * \attention To avoid heap corruption, allocated memory should be freed using
0769  *            the same library that initially allocated it. In most cases, the
0770  *            HDF5 API uses resources that are allocated and freed either
0771  *            entirely by the user or entirely by the library, so this is not a
0772  *            problem. In rare cases, however, HDF5 API calls will free the memory
0773  *            that the user allocated. This function allows the user to safely
0774  *            allocate this memory.\n
0775  *            It is particularly important to use this function to allocate
0776  *            memory in Microsoft Windows environments. In Windows, the C
0777  *            standard library is implemented in dynamic link libraries (DLLs)
0778  *            known as the C run-time (CRT). Each version of Visual Studio
0779  *            comes with multiple versions of the CRT DLLs (debug, release, et
0780  *            cetera) and allocating and freeing memory across DLL boundaries
0781  *            can cause resource leaks and subtle bugs due to heap corruption.\n
0782  *            Even when using this function, it is best where possible to
0783  *            ensure that all components of a C application are built with the
0784  *            same version of Visual Studio and configuration (Debug or
0785  *            Release), and thus linked against the same CRT.\n
0786  *            Use this function only to allocate memory inside third-party HDF5
0787  *            filters. It will generally not be safe to use this function to
0788  *            allocate memory for any other purpose.
0789  *
0790  * \see H5free_memory(), H5resize_memory()
0791  *
0792  * \since 1.8.15
0793  *
0794  */
0795 H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
0796 /**
0797  * \ingroup H5
0798  * \brief Resizes and, if required, re-allocates memory that will later be
0799  *        freed internally by the HDF5 library
0800  *
0801  * \param[in] mem Pointer to a buffer to be resized. May be NULL
0802  * \param[in] size New size of the buffer, in bytes
0803 
0804  *
0805  * \return On success, returns pointer to resized or reallocated buffer
0806  *         or returns NULL if size is 0 (zero).\n
0807  *         Returns NULL on failure.
0808  *
0809  * \details H5resize_memory() takes a pointer to an existing buffer and resizes
0810  *          the buffer to match the value in \p size. If necessary, the buffer
0811  *          is reallocated. If \p size is 0, the buffer is released.
0812  *
0813  *          The input buffer must either be NULL or have been allocated by
0814  *          H5allocate_memory() since the input buffer may be freed by the
0815  *          library.
0816  *
0817  *          For certain behaviors, the pointer \p mem may be passed in as NULL.
0818  *
0819  *          This function is intended to have the semantics of realloc():
0820  *
0821  *          <table>
0822  *            <tr><td>\TText{H5resize_memory(buffer, size)}</td>
0823  *                <td>Resizes buffer. Returns pointer to resized buffer.</td></tr>
0824  *            <tr><td>\TText{H5resize_memory(NULL, size)}</td>
0825  *                <td>Allocates memory using HDF5 Library allocator.
0826  *                    Returns pointer to new buffer</td></tr>
0827  *            <tr><td>\TText{H5resize_memory(buffer, 0)}</td>
0828  *                <td>Frees memory using HDF5 Library allocator.
0829  *                    Returns NULL.</td></tr>
0830  *            <tr><td>\TText{H5resize_memory(NULL, 0)}</td>
0831  *                <td>Returns NULL (undefined in C standard).</td></tr>
0832  *          </table>
0833  *
0834  *          Unlike realloc(), which allows for a "special pointer to be
0835  *          returned instead of NULL, this function always returns NULL on
0836  *          failure or when size is 0 (zero).
0837  *
0838  * \note At this time, the only intended use for this function is to resize or
0839  *       reallocate memory that will be returned to the library (and eventually
0840  *       to the user) as a data buffer from a third-party HDF5 filter.
0841  *
0842  * \attention To avoid heap corruption, allocated memory should be freed using
0843  *            the same library that initially allocated it. In most cases, the
0844  *            HDF5 API uses resources that are allocated and freed either
0845  *            entirely by the user or entirely by the library, so this is not a
0846  *            problem. In rare cases, however, HDF5 API calls will free memory
0847  *            that the user allocated. This function allows the user to safely
0848  *            allocate this memory.\n
0849  *            It is particularly important to use this function to resize
0850  *            memory on Microsoft Windows systems. In Windows, the C standard
0851  *            library is implemented in dynamic link libraries (DLLs) known as
0852  *            the C run-time (CRT). Each version of Visual Studio comes with
0853  *            multiple versions of the CRT DLLs (debug, release, et cetera) and
0854  *            allocating and freeing memory across DLL boundaries can cause
0855  *            resource leaks and subtle bugs due to heap corruption.\n
0856  *            Even when using this function, it is still best to ensure that
0857  *            all components of a C application are built with the same version
0858  *            of Visual Studio and the same configuration (Debug or Release),
0859  *            and thus linked against the same CRT.\n
0860  *            Only use this function to resize memory inside third-party HDF5
0861  *            filters. It will generally not be safe to use this function to
0862  *            resize memory for any other purpose.
0863  *
0864  * \see H5allocate_memory(), H5free_memory()
0865  *
0866  * \since 1.8.15
0867  *
0868  */
0869 H5_DLL void *H5resize_memory(void *mem, size_t size);
0870 
0871 #ifdef __cplusplus
0872 }
0873 #endif
0874 #endif /* H5public_H */