#include "tensorstore/index_space/dimension_identifier.h"
using tensorstore::DynamicDimSpec =
   
 std::variant<DimensionIndex, std::string, DimRangeSpec>;

Specifies a dimension by index or label or a range of dimensions.

For example:

  • 1 specifies the single dimension with index 1. A DimensionIndex value can specify both existing dimensions as well as dimensions to be added.

  • "x" specifies the single dimension with label “x”. A string label cannot be used to specify dimensions to be added.

  • DimRangeSpec{1, 4, 2} specifies the sequence of dimensions {1, 3}. A DimRangeSpec can specify both existing dimensions as well as dimensions to be added. As described in the documentation of DimRangeSpec, certain forms of DimRangeSpec are only valid for specifying existing dimensions or if the new rank is known, as they would be ambiguous for specifying new dimensions.

absl::Status
tensorstore::NormalizeDynamicDimSpec(const DynamicDimSpecspec,
                                     
span<const std::string> labels,
                                     
DimensionIndexBufferresult);

Appends to *result the dimensions corresponding to spec.

absl::Status tensorstore::NormalizeDynamicDimSpecs(
    
span<const DynamicDimSpec> specs,
    
span<const std::string> labels,
    
DimensionIndexBufferresult);

Equivalent to calling NormalizeDynamicDimSpec(spec, labels, result) for each spec in specs.