30#include <c10/util/SmallVector.h>
31#include <c10/util/ArrayRef.h>
53 template <
typename...
S>
56 validate_item_name(name);
57 _item_names.push_back(name);
59 (validate_item_name(
names), ...);
60 (_item_names.push_back(
names), ...);
63 template <
typename...
S>
66 validate_item_name(name);
67 _item_names.push_back(name);
69 (validate_item_name(
names), ...);
70 (_item_names.push_back(
names), ...);
74 typename = std::enable_if_t<!std::is_convertible_v<Container, std::string>>>
77 _item_names.append(
c.begin(),
c.end());
78 for (
const auto & name : _item_names)
79 validate_item_name(name);
82 using iterator = c10::SmallVector<std::string>::iterator;
97 explicit operator std::vector<std::string>()
const;
99 const c10::SmallVector<std::string> &
vec()
const {
return _item_names; }
131 void validate_item_name(
const std::string &)
const;
133 c10::SmallVector<std::string> _item_names;
137bool operator==(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
140bool operator!=(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
146bool operator<(
const LabeledAxisAccessor & a,
const LabeledAxisAccessor & b);
152std::ostream &
operator<<(std::ostream & os,
const LabeledAxisAccessor & accessor);
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:56
The accessor containing all the information needed to access an item in a LabeledAxis.
Definition LabeledAxisAccessor.h:47
LabeledAxisAccessor(const std::string &name, S &&... names)
Definition LabeledAxisAccessor.h:64
size_t size() const
Definition LabeledAxisAccessor.cxx:44
const_iterator begin() const
Definition LabeledAxisAccessor.h:93
c10::SmallVector< std::string >::const_iterator const_iterator
Definition LabeledAxisAccessor.h:83
LabeledAxisAccessor append(const LabeledAxisAccessor &axis) const
Append another accessor.
Definition LabeledAxisAccessor.cxx:58
LabeledAxisAccessor prepend(const LabeledAxisAccessor &axis) const
Prepend another accessor.
Definition LabeledAxisAccessor.cxx:64
LabeledAxisAccessor(const char *name, S &&... names)
Definition LabeledAxisAccessor.h:54
bool empty() const
Definition LabeledAxisAccessor.cxx:38
bool start_with(const LabeledAxisAccessor &axis) const
Check if this accessor begins with another accessor.
Definition LabeledAxisAccessor.cxx:95
LabeledAxisAccessor with_suffix(const std::string &suffix) const
Append a suffix to the final item name.
Definition LabeledAxisAccessor.cxx:50
LabeledAxisAccessor remount(const LabeledAxisAccessor &axis, size_t n=1) const
A combination of slice and prepend.
Definition LabeledAxisAccessor.cxx:89
LabeledAxisAccessor old() const
Returns the "old" counterpart.
Definition LabeledAxisAccessor.cxx:101
c10::SmallVector< std::string >::iterator iterator
Definition LabeledAxisAccessor.h:82
LabeledAxisAccessor slice(size_t n) const
Remove the leading n items from the labels.
Definition LabeledAxisAccessor.cxx:72
iterator end()
Definition LabeledAxisAccessor.h:92
const_iterator end() const
Definition LabeledAxisAccessor.h:94
LabeledAxisAccessor()=default
iterator begin()
Definition LabeledAxisAccessor.h:91
const c10::SmallVector< std::string > & vec() const
Definition LabeledAxisAccessor.h:99
~LabeledAxisAccessor()
Definition LabeledAxisAccessor.h:51
LabeledAxisAccessor(const Container &c)
Definition LabeledAxisAccessor.h:75
c10::ArrayRef< LabeledAxisAccessor > TensorLabelsRef
Definition LabeledAxisAccessor.h:158
c10::SmallVector< LabeledAxisAccessor > TensorLabels
Definition LabeledAxisAccessor.h:157
Definition CrossRef.cxx:30
bool operator==(const LabeledAxis &a, const LabeledAxis &b)
Definition LabeledAxis.cxx:393
bool operator!=(const LabeledAxis &a, const LabeledAxis &b)
Definition LabeledAxis.cxx:399
std::ostream & operator<<(std::ostream &os, const EnumSelection &es)
Definition EnumSelection.cxx:31
bool operator<(const LabeledAxisAccessor &a, const LabeledAxisAccessor &b)
The (strict) smaller than operator is created so as to use LabeledAxisAccessor in sorted data structu...
Definition LabeledAxisAccessor.cxx:137