Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-20 08:49:44

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 #ifndef H5DSpublic_H
0014 #define H5DSpublic_H
0015 
0016 #define DIMENSION_SCALE_CLASS "DIMENSION_SCALE"
0017 #define DIMENSION_LIST        "DIMENSION_LIST"
0018 #define REFERENCE_LIST        "REFERENCE_LIST"
0019 #define DIMENSION_LABELS      "DIMENSION_LABELS"
0020 
0021 /**
0022  * \brief Prototype for H5DSiterate_scales() operator
0023  *
0024  */
0025 //! <!-- [H5DS_iterate_t_snip] -->
0026 typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data);
0027 //! <!-- [H5DS_iterate_t_snip] -->
0028 
0029 #ifdef __cplusplus
0030 extern "C" {
0031 #endif
0032 
0033 /** \page H5DS_UG HDF5 High Level Dimension Scales
0034  * @todo Under Construction
0035  */
0036 
0037 /**\defgroup H5DS HDF5 Dimension Scales APIs (H5DS)
0038  *
0039  * <em>Creating and manipulating HDF5 datasets that are associated with
0040  * the dimension of another HDF5 dataset (H5DS)</em>
0041  *
0042  * \note \Bold{Programming hints:}
0043  * \note To use any of these functions or subroutines,
0044  *       you must first include the relevant include file (C) or
0045  *       module (Fortran) in your application.
0046  * \note The following line includes the HDF5 Dimension Scale package,
0047  *       H5DS, in C applications:
0048  *       \code #include "hdf5_hl.h" \endcode
0049  * \note This line includes the H5DS module in Fortran applications:
0050  *       \code use h5ds \endcode
0051  *
0052  * - \ref H5DSwith_new_ref
0053  *   \n Determines if new references are used with dimension scales.
0054  * - \ref H5DSattach_scale
0055  *   \n Attach dimension scale dsid to dimension idx of dataset did.
0056  * - \ref H5DSdetach_scale
0057  *   \n Detach dimension scale dsid from the dimension idx of Dataset did.
0058  * - \ref H5DSget_label
0059  *   \n Read the label for dimension idx of did into buffer label.
0060  * - \ref H5DSget_num_scales
0061  *   \n Determines how many Dimension Scales are attached
0062  *      to dimension idx of did.
0063  * - \ref H5DSget_scale_name
0064  *   \n Retrieves name of scale did into buffer name.
0065  * - \ref H5DSis_attached
0066  *   \n Report if dimension scale dsid is currently attached
0067  *      to dimension idx of dataset did.
0068  * - \ref H5DSis_scale
0069  *   \n Determines whether dset is a Dimension Scale.
0070  * - \ref H5DSiterate_scales
0071  *   \n Iterates the operation visitor through the scales
0072  *      attached to dimension dim.
0073  * - \ref H5DSset_label
0074  *   \n Set label for the dimension idx of did to the value label.
0075  * - \ref H5DSset_scale
0076  *   \n Convert dataset dsid to a dimension scale,
0077  *      with optional name, dimname.
0078  *
0079  */
0080 
0081 /* THIS IS A NEW ROUTINE NOT ON OLD PORTAL */
0082 /**
0083  *  --------------------------------------------------------------------------
0084  *  \ingroup H5DS
0085  *
0086  *  \brief Determines if new references are used with dimension scales.
0087  *
0088  *  \param[in] obj_id        Object identifier
0089  *  \param[out] with_new_ref New references are used or not
0090  *
0091  *  \return \herr_t
0092  *
0093  *  \details H5DSwith_new_ref() takes any object identifier and checks
0094  *           if new references are used for dimension scales. Currently,
0095  *           new references are used when non-native VOL connector is
0096  *           used or when H5_DIMENSION_SCALES_WITH_NEW_REF is set up
0097  *           via configure option.
0098  *
0099  */
0100 H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref);
0101 
0102 /**
0103  * --------------------------------------------------------------------------
0104  * \ingroup H5DS
0105  *
0106  * \brief Attach dimension scale \p dsid to dimension \p idx of
0107  *        dataset did.
0108  *
0109  * \param[in] did   The dataset
0110  * \param[in] dsid  The scale to be attached
0111  * \param[in] idx   The dimension of \p did that \p dsid is associated with
0112  *
0113  * \return \herr_t
0114  *
0115  * \details Define Dimension Scale \p dsid to be associated with
0116  *          dimension \p idx of dataset \p did.
0117  *
0118  *          Entries are created in the #DIMENSION_LIST and
0119  *          #REFERENCE_LIST attributes, as defined in section 4.2 of
0120  *          <a href="https://docs.hdfgroup.org/documentation/HDF5/HL/H5DS_Spec.pdf">
0121  *          HDF5 Dimension Scale Specification</a>.
0122  *
0123  *          Fails if:
0124  *          - Bad arguments
0125  *          - If \p dsid is not a Dimension Scale
0126  *          - If \p did is a Dimension Scale
0127  *            (A Dimension Scale cannot have scales.)
0128  *
0129  * \note The Dimension Scale \p dsid can be attached to the
0130  *       same dimension more than once, which has no effect.
0131  */
0132 H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx);
0133 
0134 /**
0135  * --------------------------------------------------------------------------
0136  * \ingroup H5DS
0137  *
0138  * \brief Detach dimension scale \p dsid from the dimension \p idx of dataset \p did.
0139  *
0140  * \param[in] did   The dataset
0141  * \param[in] dsid  The scale to be detached
0142  * \param[in] idx   The dimension of \p did to detach
0143  *
0144  * \return \herr_t
0145  *
0146  * \details If possible, deletes association of Dimension Scale \p dsid with
0147  *          dimension \p idx of dataset \p did. This deletes the entries in the
0148  *          #DIMENSION_LIST and #REFERENCE_LIST attributes,
0149  *          as defined in section 4.2 of
0150  *          <a href="https://support.hdfgroup.org/releases/hdf5/documentation/hdf5_topics/H5DS_Spec.pdf">
0151  *          HDF5 Dimension Scale Specification</a>.
0152  *
0153  *          Fails if:
0154  *          - Bad arguments
0155  *          - The dataset \p did or \p dsid do not exist
0156  *          - The \p dsid is not a Dimension Scale
0157  *          - \p dsid is not attached to \p did
0158  *
0159  * \note A scale may be associated with more than dimension of the
0160  *       same dataset. If so, the detach operation only deletes one
0161  *       of the associations, for \p did.
0162  *
0163  */
0164 H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx);
0165 
0166 /**
0167  * --------------------------------------------------------------------------
0168  * \ingroup H5DS
0169  *
0170  * \brief Convert dataset \p dsid to a dimension scale,
0171  *        with optional name, \p dimname.
0172  *
0173  * \param[in] dsid      The dataset to be made a Dimemsion Scale
0174  * \param[in] dimname   The dimension name (optional), NULL if the
0175  *                      dimension has no name.
0176  *
0177  * \return \herr_t
0178  *
0179  * \details The dataset \p dsid is converted to a Dimension Scale dataset,
0180  *          as defined above. Creates the CLASS attribute, set to the value
0181  *          "DIMENSION_SCALE" and an empty #REFERENCE_LIST attribute,
0182  *          as described in
0183  *          <a href="https://support.hdfgroup.org/releases/hdf5/documentation/hdf5_topics/H5DS_Spec.pdf">
0184  *          HDF5 Dimension Scale Specification</a>.
0185  *          (PDF, see section 4.2).
0186  *
0187  *          If \p dimname is specified, then an attribute called NAME
0188  *          is created, with the value \p dimname.
0189  *
0190  *          Fails if:
0191  *          - Bad arguments
0192  *          - If \p dsid is already a scale
0193  *          - If \p dsid is a dataset which already has dimension scales
0194  *
0195  *          If the dataset was created with the Table, Image, or Palette interface [9],
0196  *          it is not recommended to convert to a Dimension Scale.
0197  *          (These Datasets will have a CLASS Table, Image, or Palette.)
0198  *
0199  * \todo what is [9] after Palette interface?
0200  */
0201 H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname);
0202 
0203 /**
0204  * --------------------------------------------------------------------------
0205  * \ingroup H5DS
0206  *
0207  * \brief Determines how many Dimension Scales are attached
0208  *        to dimension \p idx of \p did.
0209  *
0210  * \param[in] did   The dataset to query
0211  * \param[in] idx   The dimension of \p did to query
0212  *
0213  * \return Returns the number of Dimension Scales associated
0214  *         with \p did, if successful, otherwise returns a
0215  *         negative value.
0216  *
0217  * \details H5DSget_num_scales() determines how many Dimension
0218  *          Scales are attached to dimension \p idx of
0219  *          dataset \p did.
0220  *
0221  */
0222 H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int idx);
0223 
0224 /**
0225  * --------------------------------------------------------------------------
0226  * \ingroup H5DS
0227  *
0228  * \brief Set label for the dimension \p idx of \p did
0229  *        to the value \p label.
0230  *
0231  * \param[in] did   The dataset
0232  * \param[in] idx   The dimension
0233  * \param[in] label The label
0234  *
0235  * \return  \herr_t
0236  *
0237  * \details Sets the #DIMENSION_LABELS for dimension \p idx of
0238  *          dataset \p did. If the dimension had a label,
0239  *          the new value replaces the old.
0240  *
0241  *          Fails if:
0242  *          - Bad arguments
0243  *
0244  */
0245 H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label);
0246 
0247 /**
0248  * --------------------------------------------------------------------------
0249  * \ingroup H5DS
0250  *
0251  * \brief Read the label for dimension \p idx of \p did into buffer \p label.
0252  *
0253  * \param[in] did       The dataset
0254  * \param[in] idx       The dimension
0255  * \param[out] label    The label
0256  * \param[in] size      The length of the label buffer
0257  *
0258  * \return  Upon success, size of label or zero if no label found.
0259  *          Negative if fail.
0260  *
0261  * \details Returns the value of the #DIMENSION_LABELS for
0262  *          dimension \p idx of dataset \p did, if set.
0263  *          Up to \p size characters of the name are copied into
0264  *          the buffer \p label.  If the label is longer than
0265  *          \p size, it will be truncated to fit.  The parameter
0266  *          \p size is set to the size of the returned \p label.
0267  *
0268  *          If \p did has no label, the return value of
0269  *          \p label is NULL.
0270  *
0271  *          Fails if:
0272  *          - Bad arguments
0273  *
0274  */
0275 H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size);
0276 
0277 /**
0278  * --------------------------------------------------------------------------
0279  * \ingroup H5DS
0280  *
0281  * \brief Retrieves name of scale \p did into buffer \p name.
0282  *
0283  * \param[in] did       Dimension scale identifier
0284  * \param[out] name     Buffer to contain the returned name
0285  * \param[in] size      Size in bytes, of the \p name buffer
0286  *
0287  * \return  Upon success, the length of the scale name or zero if no name found.
0288  *          Negative if fail.
0289  *
0290  * \details H5DSget_scale_name() retrieves the name attribute
0291  *          for scale \p did.
0292  *
0293  *          Up to \p size characters of the scale name are returned
0294  *          in \p name; additional characters, if any, are not returned
0295  *          to the user application.
0296  *
0297  *          If the length of the name, which determines the required value of
0298  *          \p size, is unknown, a preliminary H5DSget_scale_name() call can
0299  *          be made by setting \p name to NULL. The return value of this call
0300  *          will be the size of the scale name; that value plus one (1) can then
0301  *          be assigned to \p size for a second H5DSget_scale_name() call,
0302  *          which will retrieve the actual name.  (The value passed in with the
0303  *          parameter \p size must be one greater than size in bytes of the actual
0304  *          name in order to accommodate the null terminator;
0305  *          if \p size is set to the exact size of the name, the last byte
0306  *          passed back will contain the null terminator and the last character
0307  *          will be missing from the name passed back to the calling application.)
0308  */
0309 H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size);
0310 
0311 /**
0312  * --------------------------------------------------------------------------
0313  * \ingroup H5DS
0314  *
0315  * \brief Determines whether \p did is a Dimension Scale.
0316  *
0317  * \param[in] did   The dataset to query
0318  *
0319  * \return  \htri_t
0320  *
0321  * \details H5DSis_scale() determines if \p did is a Dimension Scale,
0322  *          i.e., has class="DIMENSION_SCALE").
0323  *
0324  */
0325 H5_HLDLL htri_t H5DSis_scale(hid_t did);
0326 
0327 /**
0328  * --------------------------------------------------------------------------
0329  * \ingroup H5DS
0330  *
0331  * \brief Iterates the operation visitor through the scales
0332  *        attached to dimension \p dim.
0333  *
0334  * \param[in]       did             The dataset
0335  * \param[in]       dim             The dimension of dataset \p did
0336  * \param[in,out]   idx             Input the index to start iterating,
0337  *                                  output the next index to visit.
0338  *                                  If NULL, start at the first position.
0339  * \param[in]       visitor         The visitor function
0340  * \param[in]       visitor_data    Arbitrary data to pass to the
0341  *                                  visitor function
0342  *
0343  * \return  Returns the return value of the last operator if it was
0344  *          non-zero, or zero if all scales were processed.
0345  *
0346  * \details H5DSiterate_scales() iterates over the scales attached to
0347  *          dimension \p dim of dataset \p did. For each scale in the
0348  *          list, the \p visitor_data and some additional information,
0349  *          specified below, are passed to the \p visitor function.
0350  *          The iteration begins with the \p idx object in the
0351  *          group and the next element to be processed by the operator
0352  *          is returned in \p idx. If \p idx is NULL, then the
0353  *          iterator starts at the first group member; since no
0354  *          stopping point is returned in this case,
0355  *          the iterator cannot be restarted if one of the calls
0356  *          to its operator returns non-zero.
0357  *
0358  *          The prototype for \ref H5DS_iterate_t is:
0359  *          \snippet this H5DS_iterate_t_snip
0360  *
0361  *          The operation receives the Dimension Scale dataset
0362  *          identifier, \p scale, and the pointer to the operator
0363  *          data passed in to H5DSiterate_scales(), \p visitor_data.
0364  *
0365  *          The return values from an operator are:
0366  *
0367  *          - Zero causes the iterator to continue, returning zero
0368  *            when all group members have been processed.
0369  *          - Positive causes the iterator to immediately return that
0370  *            positive value, indicating short-circuit success.
0371  *            The iterator can be restarted at the next group member.
0372  *          - Negative causes the iterator to immediately return
0373  *            that value, indicating failure. The iterator can be
0374  *            restarted at the next group member.
0375  *
0376  *          H5DSiterate_scales() assumes that the scales of the
0377  *          dimension identified by \p dim remain unchanged through
0378  *          the iteration. If the membership changes during the iteration,
0379  *          the function's behavior is undefined.
0380  */
0381 H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor,
0382                                    void *visitor_data);
0383 
0384 /**
0385  * --------------------------------------------------------------------------
0386  * \ingroup H5DS
0387  *
0388  * \brief Report if dimension scale \p dsid is currently attached to
0389  *        dimension \p idx of dataset \p did.
0390  *
0391  * \param[in] did   The dataset
0392  * \param[in] dsid  The scale to be attached
0393  * \param[in] idx   The dimension of \p did that \p dsid is associated with
0394  *
0395  * \return  \htri_t
0396  *
0397  * \details Report if dimension scale \p dsid is currently attached to
0398  *          dimension \p idx of dataset \p did.
0399  *
0400  *          Fails if:
0401  *          - Bad arguments
0402  *          - If \p dsid is not a Dimension Scale
0403  *          - The \p dsid is not a Dimension Scale
0404  *          - If \p did is a Dimension Scale (A Dimension Scale cannot have scales.)
0405  *
0406  */
0407 H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx);
0408 
0409 #ifdef __cplusplus
0410 }
0411 #endif
0412 
0413 #endif