xcoordinate_base

Defined in xframe/xcoordinate_base.hpp

template<class K, class A>
class xcoordinate_base

Base class for coordinates.

The xcoordinate_base class defines the common interface for coordinates, which define the mapping of dimension names to axes.

Template Parameters
  • D: The derived type, i.e. the inheriting class for which xcoordinate_base provides the interface.

Public Functions

bool empty() const

Returns true if the coordinates is empty, i.e.

it contains no mapping of axes with dimension names.

auto size() const

Returns the number of axes in the coordinates.

bool contains(const key_type &key) const

Returns true if the coordinates contains the specified dimension name.

Parameters
  • key: the dimension name to search for.

bool contains(const key_type &key, const label_type &label) const

Returns true if the coordinates contains the specified dimension name and if the axis mapped with this name contains the specified label.

Parameters
  • key: the dimension name to search for.

  • label: the label to search for in the mapped axis.

auto operator[](const key_type &key) const

Returns the axis mapped to the specified dimension name.

If this last one is not found, throws an exception.

Parameters
  • key: the name of the dimension to search for.

auto data() const

Returns the container of the dimension names to axes mapping.

auto find(const key_type &key) const

Returns a constant iterator to the axis mapped to the specified dimension name.

If no such element is found, past-the-end iterator is returned.

Parameters
  • key: the dimension name to search for.

auto begin() const

Returns a constant iterator to the first element of the coordinates.

Such an element is a pair dimension name - axis.

auto end() const

Returns a constant iterator to the element following the last element of the coordinates.

auto cbegin() const

Returns a constant iterator to the first element of the coordinates.

Such an element is a pair dimension name - axis.

auto cend() const

Returns a constant iterator to the element following the last element of the coordinates.

auto key_begin() const

Returns a constant iterator to the first dimension name of the coordinates.

auto key_end() const

Returns a constant iterator to the element following the last dimension name of the coordinates.

template<class KB, class LB>
auto operator[](const std::pair<KB, LB> &key) const

Returns the position of the specified labels of the axis mapped to the specified dimension name.

Throws an exception if either the dimension name or the label is not part of this coordinate.

Parameters
  • key: the pair dimension name - label to search for.

template<class K, class A1, class A2>
bool xf::operator==(const xcoordinate_base<K, A1> &lhs, const xcoordinate_base<K, A2> &rhs)

Returns true if lhs and rhs are equivalent coordinates, i.e.

they hold the same axes mapped to the same dimension names.

Parameters
  • lhs: a coordinate object.

  • rhs: a coordinate object.

template<class K, class A1, class A2>
bool xf::operator!=(const xcoordinate_base<K, A1> &lhs, const xcoordinate_base<K, A2> &rhs)

Returns true if lhs and rhs are not equivalent coordinates, i.e.

they hold different axes or the dimension names to axes mappings are different.

Parameters
  • lhs: a coordinate object.

  • rhs: a coordinate object.