Class SetDimension

Inheritance Relationships

Base Type

Class Documentation

class SetDimension : public nix::base::ImplContainer<base::ISetDimension>

Dimension descriptor for a dimension that represents just a list or set of values.

The SetDimension is used in cases where data is given as a set or list. This can be just a collection of values but also a list of recorded signals or a stack of images. Optionally an array of labels, one for each index of this dimension, can be specified.

Public Functions

SetDimension()

Constructor that creates an uninitialized SetDimension.

Calling any method on an uninitialized dimension will throw a nix::UninitializedEntity exception. The following code illustrates how to check if a dimension is initialized:

SetDimension e = ...;
if (e) {
    // e is initialised
} else {
    // e is uninitialized
}

SetDimension(const std::shared_ptr<base::ISetDimension> &p_impl)

Constructor that creates a new dimension from a shared pointer to an implementation instance.

This constructor should only be used in the back-end.

SetDimension(std::shared_ptr<base::ISetDimension> &&ptr)

Constructor with move semantics that creates a new dimension from a shared pointer to an implementation instance.

This constructor should only be used in the back-end.

SetDimension(const SetDimension &other)

Copy constructor.

Copying of all NIX front facing objects like SetDimension is a rather cheap operation. Semantically this is equivalent to the creation of another reference to the original object.

Parameters

other – The dimension to copy.

inline ndsize_t index() const

The actual dimension that is described by the dimension descriptor.

The index of the dimension entity representing the dimension of the actual data that is defined by this descriptor.

Returns

The dimension index of the dimension.

inline DimensionType dimensionType() const

The type of the dimension.

This field indicates whether the dimension is a SampledDimension, SetDimension or RangeDimension.

Returns

The dimension type.

inline boost::optional<std::string> label() const

Getter for the label of the dimension.

The label of a SetDimension corresponds to the axis label in a plot of the respective dimension.

Returns

The label of the dimension.

void label(const std::string &label)

Sets the label of the dimension.

Parameters

label – The label of the dimension.

inline void label(const none_t t)

Removes the label from a dimension.

Parameters

t – None

inline std::vector<std::string> labels() const

Get the labels of the range dimension.

The labels serve as names for each index of the data at the respective dimension.

Returns

The labels of the dimension as a vector of strings.

inline void labels(const std::vector<std::string> &labels)

Set the labels for the dimension.

Parameters

labels – A vector containing all new labels.

inline void labels(const boost::none_t t)

Remove the labels from the dimension.

Parameters

t – None

boost::optional<ndsize_t> indexOf(const double position, const PositionMatch match) const

converts a position given as a double to an index in this dimension, if it contains labels, then the position will be validated within these limits.

Parameters
  • position – The position.

  • match – Memeber of the PositionMatch enumeration to control conversion.

Returns

An optional containing the index, if valid.

boost::optional<std::pair<ndsize_t, ndsize_t>> indexOf(const double start, const double end, const RangeMatch match) const

returns the start and end indices corresponding to the provided start and end positions.

Parameters
  • start – double, the start position

  • end – double, the end position

  • match – RangeMatch, controls whether the range includes the end position or not.

Returns

optional containing a pair of ndsize_t.

boost::optional<std::pair<ndsize_t, ndsize_t>> indexOf(const double start, const double end, std::vector<std::string> &set_labels, const RangeMatch match) const

returns the start and end indices corresponding to the provided start and end positions.

Parameters
  • start – double, the start position

  • end – double, the end position

  • labels – vector<string> of labels

  • match – RangeMatch, controls whether the range includes the end position or not.

Returns

optional containing a pair of ndsize_t.

std::vector<boost::optional<std::pair<ndsize_t, ndsize_t>>> indexOf(const std::vector<double> &start_positions, const std::vector<double> &end_positions, const RangeMatch match) const

converts vectors of start and end positions to a vector of optionals containg start and end indices.

Parameters
  • start_positions – vector of start positions

  • end_positions – vector of end positions

  • match – Member of the RangeMatch enum to control whether ranges are inclusive or exclusiv the end positions

Returns

vector of optionals containing a pair of start and end indices

SetDimension &operator=(const SetDimension &other)

Assignment operator.

Parameters

other – The dimension to assign.

SetDimension &operator=(const Dimension &other)

Assignment operator that converts a Dimension to a SetDimension.

Parameters

other – The dimension to assign.

inline SetDimension &operator=(const none_t &t)

Assignment operator for none.