NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgTaggables< T > Class Template Reference

Public Member Functions

 tgTaggables (std::vector< T > &elements)
 
std::vector< T * > find (std::string tags)
 
int size () const
 
std::vector< T * > findAll ()
 
std::vector< T * > findUntagged ()
 
bool contains (const T &needle) const
 
T & operator[] (int key)
 
const T & operator[] (int key) const
 
T & operator-= (const T &other)
 
T & operator-= (const std::vector< T * > other)
 
T & operator+= (const T &other)
 
T & operator+= (const std::vector< T * > other)
 

Static Public Member Functions

static bool contains (std::vector< T * > haystack, const T *needle)
 

Protected Member Functions

int addElement (T element)
 
void addElements (std::vector< T * > elements)
 
void setElement (int key, T element)
 
std::vector< T > & getElements ()
 
const std::vector< T > & getElements () const
 
void removeElement (const T &element)
 
void removeElement (const T *element)
 
void removeElements (const std::vector< T > &elements)
 
void removeElements (const std::vector< T * > &elements)
 
T & getElement (int key)
 
const T & getElement (int key) const
 
bool keyExists (int key) const
 
bool elementExists (const T &element) const
 
void assertKeyExists (int key, std::string message="Element at index does not exist") const
 
void assertUnique (T &element, std::string message="Taggable elements must be unique.")
 
void assertUniqueElements (std::string message="Taggable elements must be unique.") const
 
tgTaggable_taggable (T *obj)
 

Detailed Description

template<class T>
class tgTaggables< T >

Definition at line 37 of file tgTaggables.h.

Constructor & Destructor Documentation

template<class T>
tgTaggables< T >::tgTaggables ( std::vector< T > &  elements)
inline

Create a set of elements given a vector of T.

Parameters
[in]nodesa vector of T; the elements must be unique
Author
Lee Brownston
Date
Wed 26 Feb 2014

Definition at line 52 of file tgTaggables.h.

Member Function Documentation

template<class T>
std::vector<T*> tgTaggables< T >::find ( std::string  tags)
inline

Return a vector of pointers to Ts that have all of the specified tags.

Definition at line 64 of file tgTaggables.h.

template<class T>
bool tgTaggables< T >::keyExists ( int  key) const
inlineprotected

Is the index within range.

Parameters
[in]keyan int
Return values
trueif key is within range
falseif key is not within range

Definition at line 229 of file tgTaggables.h.

template<class T>
T& tgTaggables< T >::operator-= ( const T &  other)
inline

Remove the elements contained in 'other' from this object

Definition at line 136 of file tgTaggables.h.

template<class T>
T& tgTaggables< T >::operator[] ( int  key)
inline

Return a non-const reference to the element that is indexed by the int key. It must be in m_elements.

Parameters
[in]keythe key of the element to retrieve a const reference to the element that is indexed by idx

Definition at line 123 of file tgTaggables.h.


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