base
Classes | Public Member Functions | Public Attributes | List of all members
base::NamedVector< T > Struct Template Reference

#include <NamedVector.hpp>

Classes

struct  InvalidName
 

Public Member Functions

bool hasNames () const
 
const T & getElementByName (std::string name) const
 
const T & operator[] (std::string name) const
 
T & operator[] (std::string name)
 
const T & operator[] (size_t index) const
 
T & operator[] (size_t index)
 
void resize (size_t size)
 
size_t size () const
 
bool empty () const
 
void clear ()
 
size_t mapNameToIndex (std::string const &name) const
 

Public Attributes

std::vector< std::string > names
 
std::vector< T > elements
 

Member Function Documentation

◆ clear()

template<class T>
void base::NamedVector< T >::clear ( )
inline

Clears the contents of elements and names vector

◆ empty()

template<class T>
bool base::NamedVector< T >::empty ( ) const
inline

Returns true if this does not contain any elements

◆ getElementByName()

template<class T>
const T& base::NamedVector< T >::getElementByName ( std::string  name) const
inline

Returns the state information for the given element

◆ hasNames()

template<class T>
bool base::NamedVector< T >::hasNames ( ) const
inline

Returns true if the joint vector is properly filled

◆ mapNameToIndex()

template<class T>
size_t base::NamedVector< T >::mapNameToIndex ( std::string const &  name) const
inline

Returns the index that corresponds to the given name

Exceptions
InvalidNameif the given name does not exist on this array

◆ operator[]() [1/4]

template<class T>
const T& base::NamedVector< T >::operator[] ( std::string  name) const
inline

convenience method, does the same as the getElementByName

◆ operator[]() [2/4]

template<class T>
T& base::NamedVector< T >::operator[] ( std::string  name)
inline

convenience method, does the same as the getElementByName

◆ operator[]() [3/4]

template<class T>
const T& base::NamedVector< T >::operator[] ( size_t  index) const
inline

returns the element with the given index

◆ operator[]() [4/4]

template<class T>
T& base::NamedVector< T >::operator[] ( size_t  index)
inline

returns the element with the given index

◆ resize()

template<class T>
void base::NamedVector< T >::resize ( size_t  size)
inline

Resize the elements vector to this size

◆ size()

template<class T>
size_t base::NamedVector< T >::size ( ) const
inline

Returns the number of elements reported in this structure

Member Data Documentation

◆ elements

template<class T>
std::vector<T> base::NamedVector< T >::elements

The element vector

◆ names

template<class T>
std::vector<std::string> base::NamedVector< T >::names

The names of the elements described in this structure, in the same order than the 'elements' field below


The documentation for this struct was generated from the following file: