NEML2 1.4.0
Loading...
Searching...
No Matches
LabeledAxisAccessor Class Reference

The accessor containing all the information needed to access an item in a LabeledAxis. More...

Detailed Description

The accessor containing all the information needed to access an item in a LabeledAxis.

The accessor consists of an arbitrary number of item names. The last item name can be either a variable name or a sub-axis name. All the other item names are considered to be sub-axis names.

The LabeledAxisAccessor stores the item labels and does not resolve the actual layout of the item. This way an accessor can be used access the same variable from different tensor layouts.

The item names cannot contain whitespace, ".", ",", ";", or "/".

#include <LabeledAxisAccessor.h>

Public Member Functions

 LabeledAxisAccessor ()=default
 
template<typename... S>
 LabeledAxisAccessor (const char *name, S &&... names)
 
template<typename... S>
 LabeledAxisAccessor (const std::string &name, S &&... names)
 
 LabeledAxisAccessor (const std::vector< std::string > &names)
 
 LabeledAxisAccessor (const LabeledAxisAccessor &other)
 
LabeledAxisAccessoroperator= (const LabeledAxisAccessor &other)
 Assignment operator.
 
 operator std::vector< std::string > () const
 
const std::vector< std::string > & vec () const
 
bool empty () const
 
size_t size () const
 
LabeledAxisAccessor with_suffix (const std::string &suffix) const
 Append a suffix to the item name.
 
LabeledAxisAccessor append (const LabeledAxisAccessor &axis) const
 Add a new item.
 
LabeledAxisAccessor on (const LabeledAxisAccessor &axis) const
 Re-mount the LabeledAxisAccessor on an axis by the axis accessor.
 
LabeledAxisAccessor slice (size_t n) const
 Remove the leading n items from the labels.
 
LabeledAxisAccessor slice (size_t n1, size_t n2) const
 Extract out the labels from n1 to n2.
 
bool start_with (const LabeledAxisAccessor &axis) const
 Check if this accessor begins with another accessor.
 

Constructor & Destructor Documentation

◆ LabeledAxisAccessor() [1/5]

LabeledAxisAccessor ( )
default

◆ LabeledAxisAccessor() [2/5]

template<typename... S>
LabeledAxisAccessor ( const char * name,
S &&... names )
inline

◆ LabeledAxisAccessor() [3/5]

template<typename... S>
LabeledAxisAccessor ( const std::string & name,
S &&... names )
inline

◆ LabeledAxisAccessor() [4/5]

LabeledAxisAccessor ( const std::vector< std::string > & names)

◆ LabeledAxisAccessor() [5/5]

Member Function Documentation

◆ append()

Add a new item.

◆ empty()

bool empty ( ) const

◆ on()

Re-mount the LabeledAxisAccessor on an axis by the axis accessor.

◆ operator std::vector< std::string >()

operator std::vector< std::string > ( ) const

◆ operator=()

Assignment operator.

◆ size()

size_t size ( ) const

◆ slice() [1/2]

LabeledAxisAccessor slice ( size_t n) const

Remove the leading n items from the labels.

◆ slice() [2/2]

LabeledAxisAccessor slice ( size_t n1,
size_t n2 ) const

Extract out the labels from n1 to n2.

◆ start_with()

bool start_with ( const LabeledAxisAccessor & axis) const

Check if this accessor begins with another accessor.

◆ vec()

const std::vector< std::string > & vec ( ) const
inline

◆ with_suffix()

LabeledAxisAccessor with_suffix ( const std::string & suffix) const

Append a suffix to the item name.