Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/H5DSpublic.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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  *
0035  * \section sec_dim_scales_stand HDF5 Standard for Dimension Scales
0036  * Dimension scales are stored as datasets, with additional metadata indicating that they are to
0037  * be treated as dimension scales. Each dimension scale has an optional name. There is no requirement
0038  * as to where dimension scales should be stored in the file. Dimension Scale names are not required
0039  * to be unique within a file. (The name of a dimension scale does not have to be the same as the HDF5
0040  * path name for the dataset representing the scale.)
0041  *
0042  * Datasets are linked to dimension scales.  Each dimension of a Dataset may optionally have one or
0043  * more associated Dimension Scales, as well as a label for the dimension.  A Dimension Scale can be
0044  * shared by two or more dimensions, including dimensions in the same or different dataset.
0045  * Relationships between dataset dimensions and their corresponding dimension scales are not be directly
0046  * maintained or enforced by the HDF5 library.  For instance, a dimension scale would not be automatically
0047  * deleted when all datasets that refer to it are deleted.
0048  *
0049  * Functions for creating and using Dimension Scales are implemented as high level functions, see \ref H5DS.
0050  *
0051  * A frequently requested feature is for Dimension Scales to be represented as functions, rather than a
0052  * stored array of precomputed values. To meet this requirement, it is recommended that the dataset
0053  * model be expanded in the future to allow datasets to be represented by a generating function.
0054  *
0055  * \section sec_dim_scales_concept Conceptual model
0056  * Our study of dimension scale use cases has revealed an enormous variety of ways that dimension
0057  * scales can be used.  We recognize the importance of having a model that will be easy to understand
0058  * and use for the vast majority of applications.  It is our sense that those applications will need
0059  * either no scale, a single 1-D array of floats or integers, or a simple function that provides a
0060  * scale and offset.
0061  *
0062  * At the same time, we want to place as few restrictions as possible on other uses of dimension
0063  * scales.  For instance, we don’t want to require dimension scales to be 1-D arrays, or to allow
0064  * only one scale per dimension.
0065  *
0066  * So our goal is to provide a model that serves the needs of two communities.  We want to keep
0067  * the dimension scale model conceptually simple for the majority of applications, but also to
0068  * place as few restrictions as possible how dimension scales are interpreted and used.  With
0069  * this approach, it becomes the responsibility of applications to make sure that dimension scales
0070  * satisfy the constraints of the model that they are assuming, such as constraints on the size
0071  * of dimension scales and valid range of indices.
0072  *
0073  * \subsection subsec_dim_scales_concept_defs Definitions
0074  * Dimension Scales are implemented as an extension of these objects.  In the HDF5 Abstract Data
0075  * Model, a Dataset has a Dataspace, which defines a multi dimensional array of elements. Conceptually,
0076  * a Dataspace has N dimension objects, which define the current and maximum size of the array in
0077  * that dimension.
0078  *
0079  * It is important to emphasize that the Dataspace of a Dataset has no intrinsic meaning except
0080  * to define the layout in computer storage. Dimension Scales may be used to store application
0081  * specific labels to the positions in the stored data array, i.e., to add application specific
0082  * meaning to the dimensions of the dataspace.
0083  *
0084  * A Dimension Scale is an object associated with one dimension of a Dataspace. The meaning of
0085  * the association is left to applications. The values of the Dimension Scale are set by the
0086  * application to reflect semantics of the data, for example, to associate coordinates of a
0087  * reference system with positions on the dimension.
0088  *
0089  * In general, these associations define a mapping between values of a dimension index and
0090  * values of the Dimension Scale dataset. A simple case is where the Dimension Scale s is
0091  * a (one dimensional) sequence of labels for the dimension ix of Dataset d. In this case,
0092  * Dimension Scale is an array indexed by the same index as in the dimension of the Dataspace.
0093  * For example, for the Dimension Scale s, associated with dimension ix, the ith position of
0094  * ix is associated with the value s[i], so s[i] is taken as a label for ix[i].
0095  *
0096  * \subsection subsec_dim_scales_concept_rel Entity Relationship Diagrams
0097  * Figure 1 shows UML to illustrate the relationship between a Dimension and a Dimension
0098  * Scale object. Conceptually, each Dimension of a Dataspace may have zero or more Dimension
0099  * Scales associated with it. In turn, a Dimension Scale object may be associated with zero
0100  * or more Dimensions (in zero or more Dataspaces).
0101  *
0102  * Figure 2 illustrates the abstract model for a Dimension Scale object. A Dimension Scale
0103  * is represented as a sub-class of a Dataset: a Dimension Scale has all the properties of
0104  * a Dataset, with some specializations. A Dimension Scale dataset has an attribute “CLASS”
0105  * with the value “DIMENSION_SCALE”. (This is analogous to the Table, Image, and Palette
0106  * objects.) The Dimension Scale dataset has other attributes, including an optional
0107  * NAME and references to any associated Dataset, as discussed below.
0108  *
0109  * When the Dimension Scale is associated with a dimension of a Dataset, the association
0110  * is represented by attributes of the two datasets. In the Dataset, the DIMENSION_LIST
0111  * is an array of object references to scales (Dimension Scale Datasets) (Figure 1), and
0112  * in the Dimension Scale Dataset the REFERENCE_LIST is an array of object references
0113  * to Datasets (Figure 2).
0114  * <table>
0115  * <tr>
0116  * <td>
0117  * \image html H5DS_fig1.png "Figure 1. The relationship between a Dimension and a Dimension Scale."
0118  * </td>
0119  * </tr>
0120  * </table>
0121  *
0122  * <table>
0123  * <tr>
0124  * <td>
0125  * \image html H5DS_fig2.png "Figure 2. The definition of a Dimension Scale and its attributes."
0126  * </td>
0127  * </tr>
0128  * </table>
0129  *
0130  * \subsection subsec_dim_scales_concept_types What types of scales should be implemented?
0131  * There seems to be good agreement that the model should accommodate scales that consist of a
0132  * stored 1-D list of values, certain simple functions, and “no scale.”  This specification also
0133  * includes scales that are higher dimensional arrays, as well.
0134  *
0135  * The four types of scales are:
0136  * \li <strong>No scale.</strong>  Frequently no scale is needed, so it should not be required.
0137  *     In some of these cases, an axis label may still be needed, and should be available.
0138  *     In this case, the Datase * t defines a Dimension Scale label for a dimension, with no
0139  *     Dimension Scale dataset.
0140  * \li <strong>1-D array.</strong>  Both fixed length and extendable arrays should be available.
0141  *     The size of the Dimension Scale is not required by HDF5 to conform to the size of the
0142  *     corresponding dimension(s), so that the number of scale values could be less than,
0143  *     equal to, or greater than the corresponding dimension size.
0144  * \li <strong>Simple function.</strong>  At a minimum, a linear scale of the form A + Bx
0145  *     should be available. This will be discussed in a future proposal.
0146  * \li <strong>Higher dimensional arrays.</strong> This specification allows Dimension Scales
0147  *     to have any number of dimensions.
0148  *
0149  * A number of use cases have been proposed in which more than one scale is needed for a given dimension.
0150  * This specification places no restrictions on the number of scales that can be associated with a dimension,
0151  * nor on the number or identities of Dimensions that may share the same Dimension Scale.
0152  *
0153  * There are use cases for storing many types of data in a scale, including,
0154  * but not limited to integers, floats, and strings. Therefore, this specification places no restrictions
0155  * on the datatypes of scale values: a Dimension Scale can have any HDF5 Datatype.  The
0156  * interpretation of dimension scale values is left to applications.
0157  *
0158  * \subsection subsec_dim_scales_concept_limits Limitations of this Specification
0159  * One-to-many mapping. When there are fewer values in a dimension scale than in the corresponding
0160  * dimension, it is useful to have a mapping between the two.  For example, mappings are used by
0161  * HDF-EOS to map geolocation information to dimension, in order that, for example, every second
0162  * point may have geolocation.  On the other hand, the way that mappings are defined can be very
0163  * idiosyncratic, and it would seem to be challenging to provide a mapping model that satisfied a
0164  * large number of cases.  These mappings are not included in the model specified here.
0165  *
0166  * Visibility and Integrity. Since Dimension Scales are a specialization of a Dataset, it is
0167  * “visible” and accessible as a regular Dataset through the HDF5 API. This means that an application
0168  * program could alter the values of or delete a Dimension Scale object or required attributes without
0169  * regard to any of the semantics defined in this document.
0170  *
0171  * One advantage it that the implementation requires no changes to the base library, which reduces
0172  * the complexity of the code and the risk of side-effects. The implementation builds on existing
0173  * functions, which should improve the quality and reliability of the code. Also, this approach leaves
0174  * most of the semantics of dimension scales to applications and communities, who can use the
0175  * specification in any way they need.
0176  *
0177  * An important disadvantage is that the core HDF5 library will not manage the semantics of
0178  * Dimension Scales. In particular, applications or other software must implement:
0179  * \li <strong>Naming</strong> – the HDF5 library will impose no rules on the names of Dimension Scales
0180  * \li <strong>Consistency of references</strong> – e.g., if a Dataset (Dimension Scale) is deleted (e.g.,
0181  *     with #H5Ldelete, any Dimension Scales (Datasets) that it refers to (refer to it)
0182  *     will not be updated by the HDF5 library.
0183  * \li <strong>Consistency of extents</strong> – the HDF5 library will not assure that a Dimension and
0184  *     associated Dimension Scale have the same extent (number of elements), nor that shared
0185  *     objects are consistent with each other. As in the case of delete, if a Dimension or
0186  *     Dimension Scale is extended (e.g., H5S…), any associated objects will not be
0187  *     automatically extended.
0188  *
0189  * These are briefly summarized here.
0190  * \li <strong>Naming and Name Spaces.</strong> There are many potential schemes for naming dimensions, each
0191  *     suited for different uses. This specification does not impose any specific approach,
0192  *     so it may be used by different applications. However, the lack of restrictions has
0193  *     disadvantages as well.<br />For some purposes, it will be important to iterate through
0194  *     all the Dimension Scale objects in a file. The iterate operation is difficult to
0195  *     implement with the design specified here. This will be left to other software. For example,
0196  *     the HDF-EOS library has its own mechanism for managing a set of dimensions, and the
0197  *     netCDF4 library will implement this if it needs to.
0198  * \li <strong>Automatically extending dataset dimensions.</strong> When a dimension of a dataset is
0199  *     extended, should the library automatically extend the corresponding dimension scale, or
0200  *     should this be left to the application?  Since a dimension scale can be shared among many
0201  *     datasets, this raises a number of issues that are difficult to address in a general way.
0202  *     For instance, which dimension scale should be extended when only one dataset is extended,
0203  *     and what values are to be added?  We have seen no compelling reason to implement an automatic
0204  *     extension of dimension scales when dataset dimensions are extended, so we suggest letting
0205  *     applications be responsible for this operation.
0206  * \li <strong>Automatically deleting dimension scales.</strong> Should a dimension scale be deleted
0207  *     when all datasets that use it have been deleted? This is another case where different applications
0208  *     might have different requirements, so a general policy would be difficult to devise. Furthermore,
0209  *     enforcing a deletion policy, even a simple one, adds complexity to the library, and could also
0210  *     affect performance. Deletion policies seem best left to applications.
0211  *
0212  * Section \ref sec_dim_scales_api presents an API and programming model that implements some of these
0213  * features. However, applications
0214  * may ignore or bypass these APIs, to write or read the attributes directly.
0215  *
0216  * \section sec_dim_scales_spec The HDF5 Dimension Scale Specification
0217  *
0218  * \subsection subsec_dim_scales_spec_summary Brief Summary
0219  * A Dimension Scale is stored as an HDF5 Dataset.
0220  * \li A Dimension Scale is an object that is associated with a dimension of a Dataset.
0221  * \li A Dimension Scale can have at most one name.
0222  * \li A Dimension Scale may be associated with zero, one, or many different dimensions in any number of
0223  * Datasets.
0224  * \li Unless otherwise specified, a Dimension Scale inherits the properties of an HDF5 Dataset.
0225  * \li There are no restrictions on the size, shape, or datatype of a Dimension Scale.
0226  *
0227  * A Dimension Scale can be associated with a dimension of an HDF5 dataset
0228  * \li A dimension of a Dataset may have zero, one, or more Dimension Scales associated with it.
0229  * \li Each scale is identified by an index value.
0230  *
0231  * A dimension may have a label without a scale, and may have a scale with no label.
0232  * \li The label need not be the same as the name of any associated Dimension Scales.
0233  *
0234  * The implementation has two parts:
0235  * \li A storage profile
0236  * \li An API and programming model
0237  *
0238  * \subsection subsec_dim_scales_spec_store Storage Profile
0239  * This section specifies the storage profile for Dimension Scale objects and the association between
0240  * Dimensions and Dimension Scales.
0241  *
0242  * This profile is compatible with an earlier netcdf prototype and the HDF4 to HDF5 Mapping. This
0243  * profile is also compatible with the netCDF4 proposal. This profile may be used to augment the
0244  * HDF-EOS5 profile.
0245  *
0246  * See Appendix 2 for a discussion of how to store converted HDF4 objects. See Appendix 3 for a
0247  * discussion of netCDF4 issues. See Appendix 4 for a discussion of HDF-EOS5.
0248  *
0249  * \subsubsection subsubsec_dim_scales_spec_store_dset Dimension Scale Dataset
0250  * A Dimension Scale dataset is stored as an HDF5 dataset. Table 1 summarizes the stored data, i.e.,
0251  * the values of the scale. There are no restrictions on the dataspace or datatype, or storage properties of
0252  * the dataset.
0253  *
0254  * The scale may have any HDF5 datatype, and does not have to be the same as the datatype of
0255  * the Dataset(s) that use the scale. E.g., an integer dataset might have dimension scales
0256  * that are string or float values.
0257  *
0258  * The dataspace of the scale can be any rank and shape. A scale is not limited to one dimension,
0259  * and is not restricted by the size of any dimension(s) associated with it. When a dimension is
0260  * associated with a one dimensional scale, the scale may be a different size from the dimension.
0261  * In this case, it is up to the application to interpret or resolve the difference. When a
0262  * dimension is associated with a scale with a rank higher than 1, the interpretation of the
0263  * association is up to the application.
0264  *
0265  * The Dimension Scale dataset can use any storage properties (including fill values, filters,
0266  * and storage layout), not limited by the properties of any datasets that refer to it. When
0267  * the Dimension Scale is extendible, it must be chunked.
0268  *
0269  * Table 2 defines the required and optional attributes of the Dimension Scale Dataset. The
0270  * attribute REFERENCE_LIST is a list of (dataset, index) pairs. Each pair represents an
0271  * association defined by ‘attach_scale’. These pairs are stored as an array of compound data.
0272  * Table 3 defines this datatype.
0273  *
0274  * The Dimension Scale Dataset has an attribute called SUB_CLASS. This string is intended to
0275  * be used to document particular specializations of this profile, e.g., a Dimension Scale
0276  * created by netCDF4.
0277  *
0278  * <table><caption>Table 1. The properties of the Dimension Scale dataset</caption>
0279  * <tr>
0280  * <th>Field</th>
0281  * <th>Datatype</th>
0282  * <th>Dataspace</th>
0283  * <th>Storage Properties</th>
0284  * <th>Notes</th>
0285  * </tr>
0286  * <tr>
0287  * <td>&lt;data&gt;</td>
0288  * <td>Any</td>
0289  * <td>Any</td>
0290  * <td>Any</td>
0291  * <td>These are the values of the Dimension Scale.</td>
0292  * </tr>
0293  * </table>
0294  *
0295  * <table><caption>Table 2. Standard Attributes for a stored Dimension Scale dataset.</caption>
0296  * <tr>
0297  * <th>Attribute Name</th>
0298  * <th>Datatype and Dimensions</th>
0299  * <th>Value</th>
0300  * <th>Required / Optional</th>
0301  * <th>Notes</th>
0302  * </tr>
0303  * <tr>
0304  * <td>CLASS</td>
0305  * <td>#H5T_STRING length = 16</td>
0306  * <td>“DIMENSION_SCALE”</td>
0307  * <td>Required</td>
0308  * <td>This attribute distinguishes the dataset as a Dimension scale object.<br />This is set by
0309  *  #H5DSset_scale</td>
0310  * </tr>
0311  * <tr>
0312  * <td>NAME</td>
0313  * <td>#H5T_STRING length = &lt;user defined&gt;</td>
0314  * <td>&lt;user defined&gt; <br />The name does not have to be the same as the HDF5 path name for the dataset.
0315  * The name does not have to be related to any labels. Several Dimension Scales may have the same name.</td>
0316  * <td>Optional, (Maximum of 1)</td>
0317  * <td>The user defined label of the Dimension Scale.<br />This is set by #H5DSset_label</td>
0318  * </tr>
0319  * <tr>
0320  * <td>REFERENCE_LIST</td>
0321  * <td>Array of Dataset Reference Type (Compound Datatype), variable length.</td>
0322  * <td>[ {dataset1, ind1 },   …] [,…]  ….]</td>
0323  * <td>Optional, required when scale is attached</td>
0324  * <td>See Table 3. This is set by #H5DSattach_scale.</td>
0325  * </tr>
0326  * <tr>
0327  * <td>SUB_CLASS</td>
0328  * <td>#H5T_STRING length = &lt;profile defined&gt;</td>
0329  * <td>“HDF4_DIMENSION”,<br />“NC4_DIMENSION”,</td>
0330  * <td>Optional, defined by other profiles</td>
0331  * <td>This is used to indicate a specific profile was used.</td>
0332  * </tr>
0333  * <tr>
0334  * <td>&lt;Other attributes&gt;</td>
0335  * <td></td>
0336  * <td></td>
0337  * <td>Optional</td>
0338  * <td>For example, UNITS.</td>
0339  * </tr>
0340  * </table>
0341  *
0342  * <table><caption>Table 3. Dataset Reference Type.
0343  * This is a pair, &lt;dataset_ref, index&gt;. This is created when the Dimension Scale is attached to a
0344  * Dataset.</caption>
0345  * <tr>
0346  * <th>Field</th>
0347  * <th>Datatype</th>
0348  * <th>Value</th>
0349  * <th>Notes</th>
0350  * </tr>
0351  * <tr>
0352  * <td>DATASET</td>
0353  * <td>Object Reference.</td>
0354  * <td>Pointer to a Dataset that refers to the scale</td>
0355  * <td>Set by #H5DSattach_scale.<br />Removed by #H5DSdetach_scale.</td>
0356  * </tr>
0357  * <tr>
0358  * <td>INDEX</td>
0359  * <td>#H5T_NATIVE_INT</td>
0360  * <td>Index of the dimension the dataset pointed to by DATASET</td>
0361  * <td>Set by #H5DSattach_scale.<br />Removed by #H5DSdetach_scale.</td>
0362  * </tr>
0363  * </table>
0364  *
0365  * \subsubsection subsubsec_dim_scales_spec_store_attr Attributes of a Dataset with a Dimension Scale
0366  * A Dataset may have zero or more Dimension Scales associated with its dataspace. When present,
0367  * these associations are represented by two attributes of the Dataset. Table 4 defines these attributes.
0368  *
0369  * The DIMENSION_LIST is a two dimensional array with one row for each dimension of the Dataset, and
0370  * a variable number of entries in each row, one for each associated scale. This is stored as a one
0371  * dimensional array, with the HDF5 Datatype variable length array of object references.
0372  *
0373  * When a dimension has more than one scale, the order of the scales in the DIMENSION_LIST attribute
0374  * is not defined. A given Dimension Scale should appear in the list only once.
0375  * (I.E., the DIMENSION_LIST is a “set”.)
0376  *
0377  * When a scale is shared by more than one dimension (of one or more Dataset), the order of
0378  * the records in REFERENCE_LIST is not defined. The Dataset and Dimension should appear in the list only
0379  * once.
0380  *
0381  * <table><caption>Table 4. Standard Attributes of a Dataset with associated Dimension Scale.</caption>
0382  * <tr>
0383  * <th>Attribute Name</th>
0384  * <th>Datatype and Dimensions</th>
0385  * <th>Value</th>
0386  * <th>Required / Optional</th>
0387  * <th>Notes</th>
0388  * </tr>
0389  * <tr>
0390  * <td>DIMENSION_LIST</td>
0391  * <td>The HDF5 datatype is ARRAY of Variable Length #H5T_STD_REF_OBJ with rank of the dataspace.</td>
0392  * <td>[[{object__ref1, object__ref2, … object__refn}, …] […]  ..]</td>
0393  * <td>Optional, required if scales are attached</td>
0394  * <td>Set by #H5DSattach_scale.<br />Entries removed by #H5DSdetach_scale.</td>
0395  * </tr>
0396  * <tr>
0397  * <td>DIMENSION_LABELLIST</td>
0398  * <td>The HDF5 datatype is ARRAY of #H5T_STRING with rank of the dataspace.</td>
0399  * <td>[ &lt;Label1&gt;, &lt;Label2&gt;, …, &lt;Label3&gt;] </td>
0400  * <td>Optional, required for scales with a label</td>
0401  * <td>Set by #H5DSset_label.</td>
0402  * </tr>
0403  * </table>
0404  *
0405  * \subsection subsec_dim_scales_spec_lab Dimension Scale Names and Labels
0406  * Dimension scales are often referred to by name, so Dimension Scales may have names.
0407  * Since some applications do not wish to apply names to dimension scales, Dimension Scale
0408  * names be optional. In addition, some applications will have a name but no associated data
0409  * values for a dimension (i.e., just a label). To support this, each dimension may have a
0410  * label, which may be but need not be the same as the name of an associated Dimension Scale.
0411  *
0412  * <strong>Dimension Scale Name.</strong> Associated with the Dimension Scale object. A Dimension Scale may
0413  * have no name, or one name.
0414  *
0415  * <strong>Dimension Label.</strong> A optional label associated with a dimension of a Dataset.
0416  *
0417  * <strong>How is a name represented?</strong>  Three options seem reasonable:
0418  * \li Last link in the pathname. The h4toh5 mapping uses this approach [6], but there could be more
0419  *     than one path to a dataset, leading to ambiguities.  This could be overcome by enforcing conventions.
0420  * \li Attribute. This exposes this information at the top level, making it accessible to any viewer that
0421  *     can see attributes.  It also makes it easy for applications to change the name, which could be
0422  *     dangerous, or valuable.
0423  * \li Header message.  This approach makes the name a little less available at the top level,
0424  *     but firmly pushes the concept into the base format and library.  Since it also requires
0425  *     applications to change the name through a function call, it leaves open the possibility
0426  *     that the form of the name could be altered later without requiring application codes
0427  *     to change.  On the other hand, if we treat names this way, it means that the “name”
0428  *     attribute is being treated differently from the “class” attribute, which could be confusing.
0429  *
0430  * Dimension Scale names are stored in attributes of the Dimension Scale or the Dataset that refers
0431  * to a Dimension Scale.
0432  *
0433  * <strong>Should dimension scale names be unique among dimension scales within a file?</strong>
0434  * We have seen a number of cases in which applications need more than one dimension scale with
0435  * the same name.  We have also seen applications where the opposite is true: dimension scale
0436  * names are assumed to be unique within a file.  This specification leaves it to applications
0437  * to enforce a policy of uniqueness when they need it.
0438  *
0439  * <strong>Can a dimension have a label, without having an associated scale?</strong> Some
0440  * applications may wish to name dimensions without having an associated scale.  Therefore,
0441  * a dataset may have a label for a dimension without having an associated Dimension Scale dataset.
0442  *
0443  * <strong>Can a dimension have a scale, without having an associated label?</strong> Some
0444  * applications may wish to assign a dimension scale with no label.  Therefore, a dataset
0445  * may have one or more Dimension Scales for a dimension without having an associated label.
0446  *
0447  * <strong>Anonymous Dimensions.</strong> It is possible to have a Dimension Scale dataset
0448  * with no name, and associate it with a dimension of a dataset with no label.  This case
0449  * associates an array of data values to the dimension, but no identifier.
0450  *
0451  * <strong>A dimension with a label and a name.</strong> A dimension of a dataset can be
0452  * associated with a Dimension Scale that has a name, and assigned a label. In this case,
0453  * the association has two “names”, the label and the dimension scale name. It is up to
0454  * applications to interpret these names.
0455  *
0456  * Table 5 summarizes the six possible combinations of label and name.
0457  *
0458  * <table><caption>Table 5. Labels and scales of a dimension.</caption>
0459  * <tr>
0460  * <th></th>
0461  * <th>No scale</th>
0462  * <th>Scale with no name</th>
0463  * <th>Scale with name</th>
0464  * </tr>
0465  * <tr>
0466  * <td>No label</td>
0467  * <td>Dimension has no label or scale (default)</td>
0468  * <td>Dimension has an anonymous scale</td>
0469  * <td>Dimension has scale, the scale is called “name”</td>
0470  * </tr>
0471  * <tr>
0472  * <td>Label</td>
0473  * <td>Dimension has label</td>
0474  * <td>Dimension has scale with a label.</td>
0475  * <td>Dimension has scale with both a label and name.  A shared dimension has one name,
0476  * but may have several labels</td>
0477  * </tr>
0478  * </table>
0479  *
0480  * \subsection subsec_dim_scales_spec_shared Shared Dimension Scales
0481  * Given the design described above, datasets can share dimension scales. The following
0482  * additional capabilities would seem to be useful.
0483  * \li When a dimension scale is deleted, remove the reference to the dimension scale in
0484  *     all datasets that refer to it.
0485  * \li Determine how many datasets are attached to a given dimension scale
0486  * \li Determine what datasets are attached to a given dimension scale
0487  *
0488  * These capabilities can be provided in several ways:
0489  * \li Back pointers.  If every dimension scale contained a list of back pointers to all
0490  *     datasets that referenced it, then it would be relatively easy to open all of these
0491  *     datasets and remove the references, as well as to answer questions #2 and #3.
0492  *     This would require the library to update the back pointer list every time a link
0493  *     was made.
0494  * \li Alternatively, such lists could be maintained in a separate table. Such a table
0495  *     could contain all information about a number of dimension scales, which might provide
0496  *     a convenient way for applications to gain information about a set of dimension scales.
0497  *     For instance, this table might correspond to the coordinate variable definitions in a netCDF file.
0498  * \li If no such list were available, an HDF5 function could be available to search all datasets
0499  *     to determine which ones referenced a given dimension scale.  This would be straightforward,
0500  *     but in some cases could be very time consuming.
0501  *
0502  * This specification defines attributes that maintain back pointers, which enable
0503  * these kinds of cross referencing. Other software, such as NetCDF4, may well need a global table to
0504  * track a set of dimensions. Such a table can be done in addition to the attributes defined here.
0505  *
0506  * \subsection subsec_dim_scales_spec_ex Example
0507  * This section presents an example to illustrate the data structures defined above.
0508  *
0509  * Figure 3 shows a Dataset with a four dimensional Dataspace. The file also contains six Dimension
0510  * Scale datasets. The Dimension Scale datasets are HDF5 objects, with path names such as “/DS1”.
0511  *
0512  * Figure 4 illustrates the use of dimension scales in this example. Each Dimension Scale Dataset
0513  * has an optional NAME.  For example, “/DS3” has been assigned the name “Scale3”.
0514  *
0515  * The dimensions of dataset D have been assigned zero or more scales and labels. Dimension 0
0516  * has two scales, Dimension 1 has one scale, and so on. Dimension 2 has no scale associated with it.
0517  *
0518  * Some of the dimensions have labels as well. Note that dimension 2 has a label but no scale, and
0519  * dimension 3 has scales but no label.
0520  *
0521  * Some of the Dimension Scales are shared. Dimension Scale DS1 is referenced by dimension 0 of D
0522  * and by another unspecified dataset. Dimension Scale DS3 is referenced by dimension 1 and 3 of Dataset D.
0523  *
0524  * These relationships are represented in the file by attributes of the Dataset D and the Dimension
0525  * Scale Datasets. Figure 5 shows the values that are stored for the DIMENSION_LIST attribute of
0526  * Dataset D. This
0527  * <table>
0528  * <tr>
0529  * <td>
0530  * \image html UML_Attribute.jpg "The UML model for an HDF5 attribute"
0531  * </td>
0532  * </tr>
0533  * </table>
0534  * attribute is a one-dimensional array with the HDF5 datatype variable length
0535  * #H5T_STD_REF_OBJ. Each row of the array is zero or more object references for Dimension Scale datasets.
0536  *
0537  * Table 6 shows the DIMENSION_LABELLIST for Dataset D. This is a one dimensional array with some empty
0538  * values.
0539  *
0540  * Each of the Dimension Scale Datasets has a name and other attributes. The references are
0541  * represented in the REFERENCE_LIST attributes. Table 7 – Table 10 show the values for these
0542  * tables. Note that Dimension Scale DS4 and DS6 have no references to them in this diagram.
0543  *
0544  * The tables are stored as attributes of the Dimension Scale Dataset and the Datasets that
0545  * refer to scales. Essentially, the association between a dimension of a Dataset and a Dimension
0546  * Scale is represented by “pointers” (i.e., HDF5 Object References) in both of the associated
0547  * objects. Since there can be multiple associations, there can be multiple pointers stored at
0548  * each object, representing the endpoints of the associations. These will be stored in tables,
0549  * i.e., as an attribute with an array of values.
0550  *
0551  * When dimension scales are attached or detached, the tables in the Dataset and the Dimension
0552  * Scale must be updated. The arrays in the attributes can grow, and items can be deleted.
0553  *
0554  * The associations are identified by the object reference and dimension which is stored in a
0555  * back pointer and returned from an API. The detach function needs to be careful how it deletes
0556  * an item from the table, because the entries at both ends of the association must be updated
0557  * at the same time.
0558  *
0559  * <table>
0560  * <tr>
0561  * <td>
0562  * \image html H5DS_fig3.png "Figure 3. Example dataset and scales."
0563  * </td>
0564  * </tr>
0565  * </table>
0566  *
0567  * <table>
0568  * <tr>
0569  * <td>
0570  * \image html H5DS_fig4.png "Figure 4. Example labels, names, and attached scales."
0571  * </td>
0572  * </tr>
0573  * </table>
0574  *
0575  * <table>
0576  * <tr>
0577  * <td>
0578  * \image html H5DS_fig5.png "Figure 5. The table of dimension references, stored as an attribute of the
0579  * Dataset."
0580  * </td>
0581  * </tr>
0582  * </table>
0583  *
0584  * <table><caption>Table 6. The table of dimension labels.</caption>
0585  * <tr>
0586  * <th>Dataset Dimension</th>
0587  * <th>Label</th>
0588  * </tr>
0589  * <tr>
0590  * <td>0</td>
0591  * <td>“LX”</td>
0592  * </tr>
0593  * <tr>
0594  * <td>1</td>
0595  * <td>“LZ”</td>
0596  * </tr>
0597  * <tr>
0598  * <td>2</td>
0599  * <td>“LQ”</td>
0600  * </tr>
0601  * <tr>
0602  * <td>3</td>
0603  * <td>“”</td>
0604  * </tr>
0605  * </table>
0606  *
0607  * <table><caption>Table 7. The reference list for DS1.</caption>
0608  * <tr>
0609  * <th>Reference</th>
0610  * <th>Dataset Reference Record</th>
0611  * </tr>
0612  * <tr>
0613  * <td>0</td>
0614  * <td>{Object reference to Dataset D, 0}</td>
0615  * </tr>
0616  * <tr>
0617  * <td>1</td>
0618  * <td>{Object reference to other Dataset, ?}</td>
0619  * </tr>
0620  * </table>
0621  *
0622  * <table><caption>Table 8. Reference list for DS2</caption>
0623  * <tr>
0624  * <th>Reference</th>
0625  * <th>Dataset Reference Record</th>
0626  * </tr>
0627  * <tr>
0628  * <td>0</td>
0629  * <td>{Object reference to Dataset D, 0}</td>
0630  * </tr>
0631  * </table>
0632  *
0633  * <table><caption>Table 9. Reference list for DS3</caption>
0634  * <tr>
0635  * <th>Reference</th>
0636  * <th>Dataset Reference Record</th>
0637  * </tr>
0638  * <tr>
0639  * <td>0</td>
0640  * <td>{Object reference to Dataset D, 1}</td>
0641  * </tr>
0642  * <tr>
0643  * <td>1</td>
0644  * <td>{Object reference to Dataset D, 3}</td>
0645  * </tr>
0646  * </table>
0647  *
0648  * <table><caption>Table 10. Reference List for DS5</caption>
0649  * <tr>
0650  * <th>Reference</th>
0651  * <th>Dataset Reference Record</th>
0652  * </tr>
0653  * <tr>
0654  * <td>0</td>
0655  * <td>{Object reference to Dataset D, 3}</td>
0656  * </tr>
0657  * </table>
0658  *
0659  * \section sec_dim_scales_api Programming Model and API
0660  *
0661  * \subsection subsec_dim_scales_api_model Programming Model
0662  * Dimension Scales are HDF5 Datasets, so they may be created and accesses through any
0663  * HDF5 API for datasets [10]. The HDF5 Dimension Scale API implements the specification
0664  * defined in this document. The operations include:
0665  * \li Convert dataset to scale (D) – convert dataset D to a dimension scale. D may be
0666  *     specified by an id or by a path name.
0667  * \li Attach scale (D, S, i) – attach dimension scale S to the ith dimension of D. D
0668  *     and S may be specified by an id or path name
0669  * \li Detach scale (D, i, scale) – detach scale from the ith dimension of D.
0670  * \li Iterate through scales of (D, i) – get each scale attached.
0671  * \li Get the number of scales of (D, i)
0672  * \li Get the ith scale of D
0673  * \li Set/Get name (S) – set/get the name about dimension scale S.
0674  *
0675  * The API also defines operations for dimension labels:
0676  * \li Set/Get label (D, i) – set/get the label for ith dimension of D.
0677  *
0678  * \subsubsection subsubsec_dim_scales_api_model_create Create new Dimension Scale with Initial Values
0679  *    1. Create dataset with for the Dimension Scale with H5Dcreate and other standard HDF5 calls.
0680  *    2. Initialize the values of the Dimension Scale with H5Dwrite and other calls.
0681  *    3. Convert the dataset to a Dimension Scale with H5DSmake_scale.
0682  *    4. Close the Dimension Scale when finished with H5Dclose.
0683  *
0684  * \subsubsection subsubsec_dim_scales_api_model_attach Attach Dimension Scale to Dataset
0685  *    1. Create or open the Dataset, D, with H5Dopen, etc.
0686  *    2. Create or open the Dimension Scale dataset, S, with H5Dopen or as above.
0687  *    3. Attach the Dimension Scale S to dimension j of Dataset D with H5DSattach_scale
0688  *    4. When finished, close the Dimension Scale and Dataset with H5Dclose.
0689  *
0690  * \subsubsection subsubsec_dim_scales_api_model_read Read Dimension Scale values
0691  *    1. Open the Dataset D, with H5Dopen
0692  *    2. Get the number of dimensions of D with H5Dget_space.
0693  *    3. Iterate through the scales of dimension i, locate the target scale, S (e.g., by its name).
0694  *    4. Get the datatype, dataspace, etc. of S with H5Dget_space, H5Dget_type, H5Sget_ndims, etc.
0695  *    5. Read the values of S into memory with H5Dread, e.g. into dscalebuff.
0696  *    6. When finished, close the S and other objects with H5Dclose etc.
0697  *    7. When finished, close the Dataset D with H5Dclose.
0698  *
0699  * \subsubsection subsubsec_dim_scales_api_model_write Write or Update Dimension Scale values
0700  *    1. Open the Dimension Scale Dataset S with H5open
0701  *    2. Get the datatype, dataspace, etc. of S with H5Dget_space, H5Dget_type, H5Sget_ndims, etc.
0702  *    3. If needed, read the values of S into memory with H5Dread. Note, may read selected values using a
0703  * selection.
0704  *    4. Write updated values to S with H5Dwrite. Note, may write selected values using a selection.
0705  *    5. When finished, close S and other objects with H5Dclose etc.
0706  *
0707  * \subsubsection subsubsec_dim_scales_api_model_label Create a label for a dimension
0708  *    1. Open the Dataset D with H5open
0709  *    2. Add write a label for dimension i of D, with H5DSset_label.
0710  *    3. When finished, close the Dimension Scale Dataset and other objects with H5Dclose etc.
0711  *
0712  * \subsubsection subsubsec_dim_scales_api_model_extend Extending a Dimension with a Dimension Scale attached
0713  * When an extendible Dataset has Dimension Scales, it is necessary to coordinate when the dimensions change
0714  * size.
0715  *    1. Open the Dataset to be extended, with H5Dopen.
0716  *    2. Extend the dimension(s) with H5Dextend
0717  *    3. Iterate through the scales of each extended dimension. For each scale
0718  *        a. Extend the scale to the new size of the dimension with H5Dextend
0719  *        b. Write new values to the extended scale with H5Dwrite, etc.
0720  *        c. Close the Dimension Scale Dataset with H5Dclose if necessary.
0721  *    4. When finished, close the Dataset with H5Dclose
0722  *
0723  * \subsubsection subsubsec_dim_scales_api_model_detach Detach Dimension Scale from Dataset
0724  * The detach operation removes an association between a dimension and a scale.  It does not delete the
0725  * Dimension Scale Dataset.
0726  *    1. Open the Dataset, D, with H5Dopen.
0727  *    2. Iterate through the scales of dimension i, locate the target scale, S (e.g., by its name).
0728  *    3. Detach the Dimension Scale S to dimension j of Dataset D with H5DSdetach_scale
0729  *    4. When finished, close the Dimension Scale and Dataset with H5Dclose.
0730  *
0731  * \subsubsection subsubsec_dim_scales_api_model_del Delete a Dimension Scale Dataset
0732  * When it is necessary to delete a Dimension Scale Dataset, it is necessary to detach it from all dataset.
0733  * This section outlines the necessary steps.
0734  *    1. Open the Dimension Scale to be deleted.
0735  *    2. Read the REFERENCE_LIST attribute into memory with H5Aread etc.
0736  *    3. For each entry in the list:
0737  *        a. Dereference the dataset reference
0738  *        b. Detach the scale with H5DSdetach_scale
0739  *        c. Close the dataset reference
0740  *    4. Delete the Dimension Scale Dataset
0741  *
0742  * \subsubsection subsubsec_dim_scales_api_model_clean Clean up Dimension Scales when deleting a Dataset
0743  * When it is necessary to delete a dataset that has scales attached, it is necessary to delete all the
0744  * scales before deleting the dataset.  Here is a sketch of the steps.
0745  *    1. Open the Dataset to be deleted, with H5Dopen.
0746  *    2. Iterate through the scales of each dimension of D
0747  *    3. For each scale, detach the Dimension Scale S from dimension j of Dataset D with H5DSdetach_scale
0748  *    4. Delete the Dataset, with H5Gunlink.
0749  *
0750  * \subsection subsec_dim_scales_api_func Programming API: H5DS
0751  *  @see H5DS Reference Manual
0752  *
0753  * @todo Under Construction
0754  */
0755 
0756 /**\defgroup H5DS HDF5 Dimension Scales APIs (H5DS)
0757  *
0758  * <em>Creating and manipulating HDF5 datasets that are associated with
0759  * the dimension of another HDF5 dataset (H5DS)</em>
0760  *
0761  * \note \Bold{Programming hints:}
0762  * \note To use any of these functions or subroutines,
0763  *       you must first include the relevant include file (C) or
0764  *       module (Fortran) in your application.
0765  * \note The following line includes the HDF5 Dimension Scale package,
0766  *       H5DS, in C applications:
0767  *       \code #include "hdf5_hl.h" \endcode
0768  * \note This line includes the H5DS module in Fortran applications:
0769  *       \code use h5ds \endcode
0770  *
0771  * - \ref H5DSwith_new_ref
0772  *   \n Determines if new references are used with dimension scales.
0773  * - \ref H5DSattach_scale
0774  *   \n Attach dimension scale dsid to dimension idx of dataset did.
0775  * - \ref H5DSdetach_scale
0776  *   \n Detach dimension scale dsid from the dimension idx of Dataset did.
0777  * - \ref H5DSget_label
0778  *   \n Read the label for dimension idx of did into buffer label.
0779  * - \ref H5DSget_num_scales
0780  *   \n Determines how many Dimension Scales are attached
0781  *      to dimension idx of did.
0782  * - \ref H5DSget_scale_name
0783  *   \n Retrieves name of scale did into buffer name.
0784  * - \ref H5DSis_attached
0785  *   \n Report if dimension scale dsid is currently attached
0786  *      to dimension idx of dataset did.
0787  * - \ref H5DSis_scale
0788  *   \n Determines whether dset is a Dimension Scale.
0789  * - \ref H5DSiterate_scales
0790  *   \n Iterates the operation visitor through the scales
0791  *      attached to dimension dim.
0792  * - \ref H5DSset_label
0793  *   \n Set label for the dimension idx of did to the value label.
0794  * - \ref H5DSset_scale
0795  *   \n Convert dataset dsid to a dimension scale,
0796  *      with optional name, dimname.
0797  *
0798  */
0799 
0800 /* THIS IS A NEW ROUTINE NOT ON OLD PORTAL */
0801 /**
0802  *  --------------------------------------------------------------------------
0803  *  \ingroup H5DS
0804  *
0805  *  \brief Determines if new references are used with dimension scales.
0806  *
0807  *  \param[in] obj_id        Object identifier
0808  *  \param[out] with_new_ref New references are used or not
0809  *
0810  *  \return \herr_t
0811  *
0812  *  \details H5DSwith_new_ref() takes any object identifier and checks
0813  *           if new references are used for dimension scales. Currently,
0814  *           new references are used when non-native VOL connector is
0815  *           used or when H5_DIMENSION_SCALES_WITH_NEW_REF is set up
0816  *           via configure option.
0817  *
0818  */
0819 H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref);
0820 
0821 /**
0822  * --------------------------------------------------------------------------
0823  * \ingroup H5DS
0824  *
0825  * \brief Attach dimension scale \p dsid to dimension \p idx of
0826  *        dataset did.
0827  *
0828  * \param[in] did   The dataset
0829  * \param[in] dsid  The scale to be attached
0830  * \param[in] idx   The dimension of \p did that \p dsid is associated with
0831  *
0832  * \return \herr_t
0833  *
0834  * \details Define Dimension Scale \p dsid to be associated with
0835  *          dimension \p idx of dataset \p did.
0836  *
0837  *          Entries are created in the #DIMENSION_LIST and
0838  *          #REFERENCE_LIST attributes, as defined in \ref subsec_dim_scales_spec_store section of
0839  *          the \ref H5DS_UG.
0840  *
0841  *          Fails if:
0842  *          - Bad arguments
0843  *          - If \p dsid is not a Dimension Scale
0844  *          - If \p did is a Dimension Scale
0845  *            (A Dimension Scale cannot have scales.)
0846  *
0847  * \note The Dimension Scale \p dsid can be attached to the
0848  *       same dimension more than once, which has no effect.
0849  */
0850 H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx);
0851 
0852 /**
0853  * --------------------------------------------------------------------------
0854  * \ingroup H5DS
0855  *
0856  * \brief Detach dimension scale \p dsid from the dimension \p idx of dataset \p did.
0857  *
0858  * \param[in] did   The dataset
0859  * \param[in] dsid  The scale to be detached
0860  * \param[in] idx   The dimension of \p did to detach
0861  *
0862  * \return \herr_t
0863  *
0864  * \details If possible, deletes association of Dimension Scale \p dsid with
0865  *          dimension \p idx of dataset \p did. This deletes the entries in the
0866  *          #DIMENSION_LIST and #REFERENCE_LIST attributes,
0867  *          as defined in \ref subsec_dim_scales_spec_store section of
0868  *          the \ref H5DS_UG.
0869  *
0870  *          Fails if:
0871  *          - Bad arguments
0872  *          - The dataset \p did or \p dsid do not exist
0873  *          - The \p dsid is not a Dimension Scale
0874  *          - \p dsid is not attached to \p did
0875  *
0876  * \note A scale may be associated with more than dimension of the
0877  *       same dataset. If so, the detach operation only deletes one
0878  *       of the associations, for \p did.
0879  *
0880  */
0881 H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx);
0882 
0883 /**
0884  * --------------------------------------------------------------------------
0885  * \ingroup H5DS
0886  *
0887  * \brief Convert dataset \p dsid to a dimension scale,
0888  *        with optional name, \p dimname.
0889  *
0890  * \param[in] dsid      The dataset to be made a Dimemsion Scale
0891  * \param[in] dimname   The dimension name (optional), NULL if the
0892  *                      dimension has no name.
0893  *
0894  * \return \herr_t
0895  *
0896  * \details The dataset \p dsid is converted to a Dimension Scale dataset,
0897  *          as defined above. Creates the CLASS attribute, set to the value
0898  *          "DIMENSION_SCALE" and an empty #REFERENCE_LIST attribute,
0899  *          as described in \ref subsec_dim_scales_spec_store section of
0900  *          the \ref H5DS_UG.
0901  *
0902  *          If \p dimname is specified, then an attribute called NAME
0903  *          is created, with the value \p dimname.
0904  *
0905  *          Fails if:
0906  *          - Bad arguments
0907  *          - If \p dsid is already a scale
0908  *          - If \p dsid is a dataset which already has dimension scales
0909  *
0910  *          If the dataset was created with the Table, Image, or Palette interface [9],
0911  *          it is not recommended to convert to a Dimension Scale.
0912  *          (These Datasets will have a CLASS Table, Image, or Palette.)
0913  *
0914  * \todo what is [9] after Palette interface?
0915  */
0916 H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname);
0917 
0918 /**
0919  * --------------------------------------------------------------------------
0920  * \ingroup H5DS
0921  *
0922  * \brief Determines how many Dimension Scales are attached
0923  *        to dimension \p idx of \p did.
0924  *
0925  * \param[in] did   The dataset to query
0926  * \param[in] idx   The dimension of \p did to query
0927  *
0928  * \return Returns the number of Dimension Scales associated
0929  *         with \p did, if successful, otherwise returns a
0930  *         negative value.
0931  *
0932  * \details H5DSget_num_scales() determines how many Dimension
0933  *          Scales are attached to dimension \p idx of
0934  *          dataset \p did.
0935  *
0936  */
0937 H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int idx);
0938 
0939 /**
0940  * --------------------------------------------------------------------------
0941  * \ingroup H5DS
0942  *
0943  * \brief Set label for the dimension \p idx of \p did
0944  *        to the value \p label.
0945  *
0946  * \param[in] did   The dataset
0947  * \param[in] idx   The dimension
0948  * \param[in] label The label
0949  *
0950  * \return  \herr_t
0951  *
0952  * \details Sets the #DIMENSION_LABELS for dimension \p idx of
0953  *          dataset \p did. If the dimension had a label,
0954  *          the new value replaces the old.
0955  *
0956  *          Fails if:
0957  *          - Bad arguments
0958  *
0959  */
0960 H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label);
0961 
0962 /**
0963  * --------------------------------------------------------------------------
0964  * \ingroup H5DS
0965  *
0966  * \brief Read the label for dimension \p idx of \p did into buffer \p label.
0967  *
0968  * \param[in] did       The dataset
0969  * \param[in] idx       The dimension
0970  * \param[out] label    The label
0971  * \param[in] size      The length of the label buffer
0972  *
0973  * \return  Upon success, size of label or zero if no label found.
0974  *          Negative if fail.
0975  *
0976  * \details Returns the value of the #DIMENSION_LABELS for
0977  *          dimension \p idx of dataset \p did, if set.
0978  *          Up to \p size characters of the name are copied into
0979  *          the buffer \p label.  If the label is longer than
0980  *          \p size, it will be truncated to fit.  The parameter
0981  *          \p size is set to the size of the returned \p label.
0982  *
0983  *          If \p did has no label, the return value of
0984  *          \p label is NULL.
0985  *
0986  *          Fails if:
0987  *          - Bad arguments
0988  *
0989  */
0990 H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size);
0991 
0992 /**
0993  * --------------------------------------------------------------------------
0994  * \ingroup H5DS
0995  *
0996  * \brief Retrieves name of scale \p did into buffer \p name.
0997  *
0998  * \param[in] did       Dimension scale identifier
0999  * \param[out] name     Buffer to contain the returned name
1000  * \param[in] size      Size in bytes, of the \p name buffer
1001  *
1002  * \return  Upon success, the length of the scale name or zero if no name found.
1003  *          Negative if fail.
1004  *
1005  * \details H5DSget_scale_name() retrieves the name attribute
1006  *          for scale \p did.
1007  *
1008  *          Up to \p size characters of the scale name are returned
1009  *          in \p name; additional characters, if any, are not returned
1010  *          to the user application.
1011  *
1012  *          If the length of the name, which determines the required value of
1013  *          \p size, is unknown, a preliminary H5DSget_scale_name() call can
1014  *          be made by setting \p name to NULL. The return value of this call
1015  *          will be the size of the scale name; that value plus one (1) can then
1016  *          be assigned to \p size for a second H5DSget_scale_name() call,
1017  *          which will retrieve the actual name.  (The value passed in with the
1018  *          parameter \p size must be one greater than size in bytes of the actual
1019  *          name in order to accommodate the null terminator;
1020  *          if \p size is set to the exact size of the name, the last byte
1021  *          passed back will contain the null terminator and the last character
1022  *          will be missing from the name passed back to the calling application.)
1023  */
1024 H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size);
1025 
1026 /**
1027  * --------------------------------------------------------------------------
1028  * \ingroup H5DS
1029  *
1030  * \brief Determines whether \p did is a Dimension Scale.
1031  *
1032  * \param[in] did   The dataset to query
1033  *
1034  * \return  \htri_t
1035  *
1036  * \details H5DSis_scale() determines if \p did is a Dimension Scale,
1037  *          i.e., has class="DIMENSION_SCALE").
1038  *
1039  */
1040 H5_HLDLL htri_t H5DSis_scale(hid_t did);
1041 
1042 /**
1043  * --------------------------------------------------------------------------
1044  * \ingroup H5DS
1045  *
1046  * \brief Iterates the operation visitor through the scales
1047  *        attached to dimension \p dim.
1048  *
1049  * \param[in]       did             The dataset
1050  * \param[in]       dim             The dimension of dataset \p did
1051  * \param[in,out]   idx             Input the index to start iterating,
1052  *                                  output the next index to visit.
1053  *                                  If NULL, start at the first position.
1054  * \param[in]       visitor         The visitor function
1055  * \param[in]       visitor_data    Arbitrary data to pass to the
1056  *                                  visitor function
1057  *
1058  * \return  Returns the return value of the last operator if it was
1059  *          non-zero, or zero if all scales were processed.
1060  *
1061  * \details H5DSiterate_scales() iterates over the scales attached to
1062  *          dimension \p dim of dataset \p did. For each scale in the
1063  *          list, the \p visitor_data and some additional information,
1064  *          specified below, are passed to the \p visitor function.
1065  *          The iteration begins with the \p idx object in the
1066  *          group and the next element to be processed by the operator
1067  *          is returned in \p idx. If \p idx is NULL, then the
1068  *          iterator starts at the first group member; since no
1069  *          stopping point is returned in this case,
1070  *          the iterator cannot be restarted if one of the calls
1071  *          to its operator returns non-zero.
1072  *
1073  *          The prototype for \ref H5DS_iterate_t is:
1074  *          \snippet this H5DS_iterate_t_snip
1075  *
1076  *          The operation receives the Dimension Scale dataset
1077  *          identifier, \p scale, and the pointer to the operator
1078  *          data passed in to H5DSiterate_scales(), \p visitor_data.
1079  *
1080  *          The return values from an operator are:
1081  *
1082  *          - Zero causes the iterator to continue, returning zero
1083  *            when all group members have been processed.
1084  *          - Positive causes the iterator to immediately return that
1085  *            positive value, indicating short-circuit success.
1086  *            The iterator can be restarted at the next group member.
1087  *          - Negative causes the iterator to immediately return
1088  *            that value, indicating failure. The iterator can be
1089  *            restarted at the next group member.
1090  *
1091  *          H5DSiterate_scales() assumes that the scales of the
1092  *          dimension identified by \p dim remain unchanged through
1093  *          the iteration. If the membership changes during the iteration,
1094  *          the function's behavior is undefined.
1095  */
1096 H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor,
1097                                    void *visitor_data);
1098 
1099 /**
1100  * --------------------------------------------------------------------------
1101  * \ingroup H5DS
1102  *
1103  * \brief Report if dimension scale \p dsid is currently attached to
1104  *        dimension \p idx of dataset \p did.
1105  *
1106  * \param[in] did   The dataset
1107  * \param[in] dsid  The scale to be attached
1108  * \param[in] idx   The dimension of \p did that \p dsid is associated with
1109  *
1110  * \return  \htri_t
1111  *
1112  * \details Report if dimension scale \p dsid is currently attached to
1113  *          dimension \p idx of dataset \p did.
1114  *
1115  *          Fails if:
1116  *          - Bad arguments
1117  *          - If \p dsid is not a Dimension Scale
1118  *          - The \p dsid is not a Dimension Scale
1119  *          - If \p did is a Dimension Scale (A Dimension Scale cannot have scales.)
1120  *
1121  */
1122 H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx);
1123 
1124 #ifdef __cplusplus
1125 }
1126 #endif
1127 
1128 #endif