xcoordinate_chain

Defined in xframe/xcoordinate_chain.hpp

template<class C>
class xcoordinate_chain

reindexed view of an xcoordinate.

The xcoordinate_chain is used for creating a reindexed view on an existing xcoordinate. This is done by holding new axes and keeping a reference to the underlying xcoordinate.

See

xcoordinate

See

xcoordinate_expanded

Template Parameters
  • C: the type of the underlying xcoordinate.

Public Functions

xcoordinate_chain(const coordinate_type &sub_coord, const map_type &new_coord)

Constructs an xcoordinate_chain, given the reference to an xcoordinate and the reference to the additional coordinates.

Parameters
  • sub_coord: the reference to the underlying xcoordinate.

  • new_coord: the dimension name <-> axis mapping of the new coordinates.

xcoordinate_chain(const coordinate_type &sub_coord, map_type &&new_coord)

Constructs an xcoordinate_chain, given the reference to an xcoordinate and the reference to the additional coordinates.

Parameters
  • sub_coord: the reference to the underlying xcoordinate.

  • new_coord: the dimension name <-> axis mapping of the new coordinates.

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 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 C>
xcoordinate_chain<C> xf::reindex(const C &coordinate, const typename C::map_type &new_coord)

Creates a reindexed view on an xcoordinate, given the reference on the xcoordinate and the new coordinates.

Parameters
  • sub_coord: the reference to the underlying xcoordinate.

  • new_coord: the dimension name <-> axis mapping of the new coordinates.

template<class C>
xcoordinate_chain<C> xf::reindex(const C &coordinate, typename C::map_type &&new_coord)

Creates a reindexed view on an xcoordinate, given the reference on the xcoordinate and the new coordinates.

Parameters
  • sub_coord: the reference to the underlying xcoordinate.

  • new_coord: the dimension name <-> axis mapping of the new coordinates.