xaxis_view¶
Defined in xframe/xaxis_view.hpp
-
template<class
L
, classT
, classMT
= hash_map_tag>
classxaxis_view
¶ View of an axis.
The xaxis_view class is used for modeling a view on an existing axis, i.e. a subset of this axis. This is done by filtering the labels of the axis. No copy is involved. This class is used as a building block for view on coordinates. This class is intended to be used with
xaxis_variant
, so the label template parameter is a type list rather than a simple type.- See
- Template Parameters
L
: the type list of labels.T
: the integer type used to represent positions.MT
: the tag used for choosing the map type which holds the label- position pairs. Possible values aremap_tag
andhash_map_tag
. Default value ishash_map_tag
.
Public Functions
-
template<class
S
>xaxis_view
(const axis_type &axis, S &&slice)¶ Builds a sliced view of the specified axis.
- Parameters
axis
: the axis on which the view is built.slice
: the slice used for filtering labels.
-
operator axis_type
() const¶ Converts this view into a real axis.
The view itself is not modified, a new axis is created from the filtered labels. This conversion operator allows to pass a view to methods that accept regular axes, however it might not be convenient for explicit conversion. Prefer as_xaxis in this case.
- See
-
auto
labels
() const¶ Returns the list of labels in the view.
Since the view does not hold any data, this list is created upon demand. The filtered labels are copied into it.
-
auto
label
(size_type i) const¶ Return the
i-th
label of the view.
-
bool
empty
() const¶ Checks if the view has no labels.
-
auto
size
() const¶ Returns the number of labels in the axis.
-
bool
contains
(const key_type &key) const¶ Returns true if the view contains the speficied label.
- Parameters
key
: the label to search for.
-
auto
operator[]
(const key_type &key) const¶ Returns the position of the specified label in the underlying axis.
If this last one is not found, an exception is thrown.
- Parameters
key
: the label to search for.
-
auto
index
(size_type label_index) const¶ Get the label mapped to the specified position in the view, and returns it position in the underlying axis.
- Parameters
label_index
: the index of the label in the view.
-
auto
find
(const key_type &key) const¶ Returns a constant iterator to the element with label equivalent to
key
.If no such element is found, past-the-end iterator is returned.
- Parameters
key
: the label to search for.
-
auto
begin
() const¶ Returns a constant iterator to the first element of the view.
This element is a pair label - position.
-
auto
end
() const¶ Returns a constant iterator to the element following the last element of the view.
-
auto
cbegin
() const¶ Returns a constant iterator to the first element of the view.
This element is a pair label - position.
-
auto
cend
() const¶ Returns a constant iterator to the element following the last element of the view.
-
auto
rbegin
() const¶ Returns a constant iterator to the first element of the reverse view.
This element is a pair labal - position.
-
auto
rend
() const¶ Returns a constant iterator to the element following the last element of the reversed view.
-
auto
crbegin
() const¶ Returns a constant iterator to the first element of the reverse view.
This element is a pair labal - position.
-
auto
crend
() const¶ Returns a constant iterator to the element following the last element of the reversed view.
-
auto
as_xaxis
() const¶ Converts this view into a real axis.
The view itself is not modified, a new axis is created from the filtered labels.
-
template<class
F
>
autofilter
(const F &f) const¶ Builds an return a new axis by applying the given filter to the view.
- Parameters
f
: the filter used to select the labels to keep in the new axis.
-
template<class
F
>
autofilter
(const F &f, size_type size) const¶ Builds an return a new axis by applying the given filter to the view.
When the size of the new list of labels is known, this method allows some optimizations compared to the previous one.
- Parameters
f
: the filter used to select the labels to keep in the new axis.size
: the size of the new label list.
-
template<class
L
, classT
, classMT
>
boolxf
::
operator==
(const xaxis_view<L, T, MT> &lhs, const xaxis_view<L, T, MT> &rhs) Returns true is
lhs
andd
rhs are equivalent axes, i.e.they contain the same label - position pairs.
- Parameters
lhs
: an axis.rhs
: an axis.
-
template<class
L
, classT
, classMT
>
boolxf
::
operator!=
(const xaxis_view<L, T, MT> &lhs, const xaxis_view<L, T, MT> &rhs) Returns true is
lhs
andrhs
are not equivalent axes, i.e.they contain different label - position pairs.
- Parameters
lhs
: an axis.rhs
: an axis.
-
template<class
L
, classT
, classMT
>
boolxf
::
operator==
(const xaxis_view<L, T, MT> &lhs, const xaxis_variant<L, T, MT> &rhs) Returns true is
lhs
andrhs
are equivalent axes, i.e.they contain the same label - position pairs.
- Parameters
lhs
: an axis.rhs
: an axis.
-
template<class
L
, classT
, classMT
>
boolxf
::
operator!=
(const xaxis_view<L, T, MT> &lhs, const xaxis_variant<L, T, MT> &rhs) Returns true is
lhs
andrhs
are not equivalent axes, i.e.they contain different label - position pairs.
- Parameters
lhs
: an axis.rhs
: an axis.