Rosetta  2020.22
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
utility::keys::SmallKeyVector< K, T > Class Template Reference

Keyed-access vector with key subset map. More...

#include <SmallKeyVector.hh>

Public Types

typedefkey_type
 
typedef Vector::value_type value_type
 
typedef Vector::reference reference
 
typedef Vector::const_reference const_reference
 
typedef Vector::pointer pointer
 
typedef Vector::const_pointer const_pointer
 
typedef Vector::iterator iterator
 
typedef Vector::const_iterator const_iterator
 
typedef Vector::reverse_iterator reverse_iterator
 
typedef
Vector::const_reverse_iterator 
const_reverse_iterator
 
typedef Vector::size_type size_type
 
typedef Vector::index_type index_type
 
typedef Vector::difference_type difference_type
 
typedef Vector::allocator_type allocator_type
 
typedefKey
 
typedef Vector::Value Value
 
typedef Vector::Reference Reference
 
typedef Vector::ConstReference ConstReference
 
typedef Vector::Pointer Pointer
 
typedef Vector::ConstPointer ConstPointer
 
typedef Vector::Iterator Iterator
 
typedef Vector::ConstIterator ConstIterator
 
typedef Vector::ReverseIterator ReverseIterator
 
typedef
Vector::ConstReverseIterator 
ConstReverseIterator
 
typedef Vector::Size Size
 
typedef Vector::Index Index
 
typedef Vector::Difference Difference
 
typedef Vector::Allocator Allocator
 

Public Member Functions

 SmallKeyVector ()
 Default constructor. More...
 
 SmallKeyVector (SmallKeyVector const &a)
 Copy constructor. More...
 
 SmallKeyVector (Size num)
 Size constructor. More...
 
 SmallKeyVector (Size num, Value const &value)
 Uniform value constructor. More...
 
template<typename InputIterator >
 SmallKeyVector (InputIterator const beg, InputIterator const end)
 Iterator range constructor. More...
 
 ~SmallKeyVector ()
 Destructor. More...
 
SmallKeyVectoroperator= (SmallKeyVector const &a)
 Copy assignment. More...
 
SmallKeyVectoroperator= (Value const &value)
 Uniform value assignment to current elements. More...
 
SmallKeyVectorassign (Key const &key, Value const &value)
 Assign a value to an element with a key. More...
 
void assign (Size num, Value const &value)
 Uniform value assignment. More...
 
template<typename InputIterator >
void assign (InputIterator const beg, InputIterator const end)
 Iterator assignment. More...
 
SmallKeyVectoradd (Key const &key)
 Add an element with a key if not present: Activate key if inactive. More...
 
Iterator insert (Iterator const &pos, Value const &value)
 Insert an element at an iterator position. More...
 
void insert (Iterator const &pos, Size num, Value const &value)
 Insert num copies of an element at an iterator position. More...
 
template<typename InputIterator >
void insert (Iterator const &pos, InputIterator const &beg, InputIterator const &end)
 Insert elements from iterator range [beg,end) at an iterator position. More...
 
void push_back (Value const &value)
 Appends an element. More...
 
Iterator erase (Iterator const &pos)
 Erase an element at an iterator position. More...
 
Iterator erase (Iterator const &beg, Iterator const &end)
 Erase elements in the iterator range [beg,end) More...
 
void pop_back ()
 Removes the last element. More...
 
void resize (Size num)
 Resize: Default construct new elements. More...
 
void resize (Size num, Value const &value)
 Resize: Assign given value to new elements. More...
 
void reserve (Size num)
 Reserve space for a given number of elements. More...
 
void shrink ()
 Shrink the vectors to remove unused capacity. More...
 
void swap (SmallKeyVector &a)
 swap( SmallKeyVector ) More...
 
void clear ()
 Clear the vector. More...
 
Size size () const
 Size. More...
 
bool empty () const
 Empty? More...
 
Size max_size () const
 Max size. More...
 
Size capacity () const
 Capacity. More...
 
ConstReference front () const
 Front element. More...
 
Reference front ()
 Front element. More...
 
ConstReference back () const
 Back element. More...
 
Reference back ()
 Back element. More...
 
bool has (Key const &key) const
 Is an element with a key present? More...
 
bool active (Key const &key) const
 Is a key active? More...
 
bool inactive (Key const &key) const
 Is a key inactive? More...
 
Index const & index (Key const &key)
 Index of a key. More...
 
ConstIterator find (Key const &key) const
 Iterator to element with a key. More...
 
Iterator find (Key const &key)
 Iterator to element with a key. More...
 
Reference operator() (Key const &key)
 SmallKeyVector( key ) More...
 
ConstReference operator[] (Key const &key) const
 SmallKeyVector[ key ] const. More...
 
Reference operator[] (Key const &key)
 SmallKeyVector[ key ]. More...
 
ConstReference at (Key const &key) const
 Element at index key: Bounds checked. More...
 
Reference at (Key const &key)
 Element at index key: Bounds checked. More...
 
ConstReference operator[] (Index const &i) const
 SmallKeyVector[ index ] const. More...
 
Reference operator[] (Index const &i)
 SmallKeyVector[ index ]. More...
 
ConstIterator begin () const
 Begin iterator. More...
 
Iterator begin ()
 Begin iterator. More...
 
ConstIterator end () const
 End iterator. More...
 
Iterator end ()
 End iterator. More...
 
ConstReverseIterator rbegin () const
 Begin reverse iterator. More...
 
ReverseIterator rbegin ()
 Begin reverse iterator. More...
 
ConstReverseIterator rend () const
 End reverse iterator. More...
 
ReverseIterator rend ()
 End reverse iterator. More...
 

Private Types

typedef vector1< TVector
 
typedef vector1< typename
Vector::Index
IndexMap
 
typedef IndexMap::Size IndexMapSize
 
typedef IndexMap::Index IndexMapIndex
 

Private Member Functions

Index const & add_key (Key const &key)
 Add an element with a key if not present and return its index: Activate key if inactive. More...
 

Private Attributes

Vector v_
 Vector of values indexed by a subset of the possible keys. More...
 
IndexMap m_
 Index map from keys into v_: Zero => inactive key. More...
 
Index u_
 Upper active index of active keys. More...
 

Friends

template<typename UK , typename UT >
void swap (SmallKeyVector< UK, UT > &a, SmallKeyVector< UK, UT > &b)
 swap( SmallKeyVector, SmallKeyVector ) More...
 
bool operator== (SmallKeyVector const &a, SmallKeyVector const &b)
 SmallKeyVector == SmallKeyVector. More...
 
bool operator!= (SmallKeyVector const &a, SmallKeyVector const &b)
 SmallKeyVector != SmallKeyVector. More...
 

Detailed Description

template<typename K, typename T>
class utility::keys::SmallKeyVector< K, T >

Keyed-access vector with key subset map.

Member Typedef Documentation

template<typename K, typename T>
typedef Vector::Allocator utility::keys::SmallKeyVector< K, T >::Allocator
template<typename K, typename T>
typedef Vector::ConstPointer utility::keys::SmallKeyVector< K, T >::ConstPointer
template<typename K, typename T>
typedef Vector::Difference utility::keys::SmallKeyVector< K, T >::Difference
template<typename K, typename T>
typedef Vector::Index utility::keys::SmallKeyVector< K, T >::Index
template<typename K, typename T>
typedef Vector::index_type utility::keys::SmallKeyVector< K, T >::index_type
template<typename K, typename T>
typedef vector1< typename Vector::Index > utility::keys::SmallKeyVector< K, T >::IndexMap
private
template<typename K, typename T>
typedef IndexMap::Index utility::keys::SmallKeyVector< K, T >::IndexMapIndex
private
template<typename K, typename T>
typedef IndexMap::Size utility::keys::SmallKeyVector< K, T >::IndexMapSize
private
template<typename K, typename T>
typedef Vector::iterator utility::keys::SmallKeyVector< K, T >::iterator
template<typename K, typename T>
typedef Vector::Iterator utility::keys::SmallKeyVector< K, T >::Iterator
template<typename K, typename T>
typedef K utility::keys::SmallKeyVector< K, T >::Key
template<typename K, typename T>
typedef K utility::keys::SmallKeyVector< K, T >::key_type
template<typename K, typename T>
typedef Vector::pointer utility::keys::SmallKeyVector< K, T >::pointer
template<typename K, typename T>
typedef Vector::Pointer utility::keys::SmallKeyVector< K, T >::Pointer
template<typename K, typename T>
typedef Vector::reference utility::keys::SmallKeyVector< K, T >::reference
template<typename K, typename T>
typedef Vector::Reference utility::keys::SmallKeyVector< K, T >::Reference
template<typename K, typename T>
typedef Vector::Size utility::keys::SmallKeyVector< K, T >::Size
template<typename K, typename T>
typedef Vector::size_type utility::keys::SmallKeyVector< K, T >::size_type
template<typename K, typename T>
typedef Vector::Value utility::keys::SmallKeyVector< K, T >::Value
template<typename K, typename T>
typedef Vector::value_type utility::keys::SmallKeyVector< K, T >::value_type
template<typename K, typename T>
typedef vector1< T > utility::keys::SmallKeyVector< K, T >::Vector
private

Constructor & Destructor Documentation

template<typename K, typename T>
utility::keys::SmallKeyVector< K, T >::SmallKeyVector ( )
inline

Default constructor.

template<typename K, typename T>
utility::keys::SmallKeyVector< K, T >::SmallKeyVector ( SmallKeyVector< K, T > const &  a)
inline

Copy constructor.

template<typename K, typename T>
utility::keys::SmallKeyVector< K, T >::SmallKeyVector ( Size  num)
inlineexplicit

Size constructor.

template<typename K, typename T>
utility::keys::SmallKeyVector< K, T >::SmallKeyVector ( Size  num,
Value const &  value 
)
inline

Uniform value constructor.

template<typename K, typename T>
template<typename InputIterator >
utility::keys::SmallKeyVector< K, T >::SmallKeyVector ( InputIterator const  beg,
InputIterator const  end 
)
inline

Iterator range constructor.

template<typename K, typename T>
utility::keys::SmallKeyVector< K, T >::~SmallKeyVector ( )
inline

Destructor.

Member Function Documentation

template<typename K, typename T>
bool utility::keys::SmallKeyVector< K, T >::active ( Key const &  key) const
inline
template<typename K, typename T>
SmallKeyVector& utility::keys::SmallKeyVector< K, T >::add ( Key const &  key)
inline

Add an element with a key if not present: Activate key if inactive.

template<typename K, typename T>
Index const& utility::keys::SmallKeyVector< K, T >::add_key ( Key const &  key)
inlineprivate
template<typename K, typename T>
SmallKeyVector& utility::keys::SmallKeyVector< K, T >::assign ( Key const &  key,
Value const &  value 
)
inline

Assign a value to an element with a key.

Note
Adds the key to the map if not present
Expands the vector if necessary
template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::assign ( Size  num,
Value const &  value 
)
inline

Uniform value assignment.

template<typename K, typename T>
template<typename InputIterator >
void utility::keys::SmallKeyVector< K, T >::assign ( InputIterator const  beg,
InputIterator const  end 
)
inline

Iterator assignment.

template<typename K, typename T>
ConstReference utility::keys::SmallKeyVector< K, T >::at ( Key const &  key) const
inline

Element at index key: Bounds checked.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::at ( Key const &  key)
inline

Element at index key: Bounds checked.

template<typename K, typename T>
ConstReference utility::keys::SmallKeyVector< K, T >::back ( ) const
inline

Back element.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::back ( )
inline

Back element.

template<typename K, typename T>
ConstIterator utility::keys::SmallKeyVector< K, T >::begin ( ) const
inline
template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::begin ( )
inline

Begin iterator.

template<typename K, typename T>
Size utility::keys::SmallKeyVector< K, T >::capacity ( ) const
inline

Capacity.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::clear ( )
inline

Clear the vector.

template<typename K, typename T>
bool utility::keys::SmallKeyVector< K, T >::empty ( ) const
inline

Empty?

template<typename K, typename T>
ConstIterator utility::keys::SmallKeyVector< K, T >::end ( ) const
inline
template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::end ( )
inline

End iterator.

template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::erase ( Iterator const &  pos)
inline

Erase an element at an iterator position.

template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::erase ( Iterator const &  beg,
Iterator const &  end 
)
inline

Erase elements in the iterator range [beg,end)

template<typename K, typename T>
ConstIterator utility::keys::SmallKeyVector< K, T >::find ( Key const &  key) const
inline

Iterator to element with a key.

template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::find ( Key const &  key)
inline

Iterator to element with a key.

template<typename K, typename T>
ConstReference utility::keys::SmallKeyVector< K, T >::front ( ) const
inline

Front element.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::front ( )
inline

Front element.

template<typename K, typename T>
bool utility::keys::SmallKeyVector< K, T >::has ( Key const &  key) const
inline
template<typename K, typename T>
bool utility::keys::SmallKeyVector< K, T >::inactive ( Key const &  key) const
inline

Is a key inactive?

template<typename K, typename T>
Index const& utility::keys::SmallKeyVector< K, T >::index ( Key const &  key)
inline

Index of a key.

template<typename K, typename T>
Iterator utility::keys::SmallKeyVector< K, T >::insert ( Iterator const &  pos,
Value const &  value 
)
inline

Insert an element at an iterator position.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::insert ( Iterator const &  pos,
Size  num,
Value const &  value 
)
inline

Insert num copies of an element at an iterator position.

template<typename K, typename T>
template<typename InputIterator >
void utility::keys::SmallKeyVector< K, T >::insert ( Iterator const &  pos,
InputIterator const &  beg,
InputIterator const &  end 
)
inline

Insert elements from iterator range [beg,end) at an iterator position.

template<typename K, typename T>
Size utility::keys::SmallKeyVector< K, T >::max_size ( ) const
inline

Max size.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::operator() ( Key const &  key)
inline

SmallKeyVector( key )

Note
Activates the key if inactive
Expands the vector if necessary
template<typename K, typename T>
SmallKeyVector& utility::keys::SmallKeyVector< K, T >::operator= ( SmallKeyVector< K, T > const &  a)
inline

Copy assignment.

template<typename K, typename T>
SmallKeyVector& utility::keys::SmallKeyVector< K, T >::operator= ( Value const &  value)
inline

Uniform value assignment to current elements.

template<typename K, typename T>
ConstReference utility::keys::SmallKeyVector< K, T >::operator[] ( Key const &  key) const
inline

SmallKeyVector[ key ] const.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::operator[] ( Key const &  key)
inline

SmallKeyVector[ key ].

template<typename K, typename T>
ConstReference utility::keys::SmallKeyVector< K, T >::operator[] ( Index const &  i) const
inline

SmallKeyVector[ index ] const.

template<typename K, typename T>
Reference utility::keys::SmallKeyVector< K, T >::operator[] ( Index const &  i)
inline

SmallKeyVector[ index ].

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::pop_back ( )
inline

Removes the last element.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::push_back ( Value const &  value)
inline

Appends an element.

template<typename K, typename T>
ConstReverseIterator utility::keys::SmallKeyVector< K, T >::rbegin ( ) const
inline

Begin reverse iterator.

template<typename K, typename T>
ReverseIterator utility::keys::SmallKeyVector< K, T >::rbegin ( )
inline

Begin reverse iterator.

template<typename K, typename T>
ConstReverseIterator utility::keys::SmallKeyVector< K, T >::rend ( ) const
inline

End reverse iterator.

template<typename K, typename T>
ReverseIterator utility::keys::SmallKeyVector< K, T >::rend ( )
inline

End reverse iterator.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::reserve ( Size  num)
inline

Reserve space for a given number of elements.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::resize ( Size  num)
inline

Resize: Default construct new elements.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::resize ( Size  num,
Value const &  value 
)
inline

Resize: Assign given value to new elements.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::shrink ( )
inline

Shrink the vectors to remove unused capacity.

template<typename K, typename T>
Size utility::keys::SmallKeyVector< K, T >::size ( ) const
inline

Size.

template<typename K, typename T>
void utility::keys::SmallKeyVector< K, T >::swap ( SmallKeyVector< K, T > &  a)
inline

swap( SmallKeyVector )

Friends And Related Function Documentation

template<typename K, typename T>
bool operator!= ( SmallKeyVector< K, T > const &  a,
SmallKeyVector< K, T > const &  b 
)
friend
template<typename K, typename T>
bool operator== ( SmallKeyVector< K, T > const &  a,
SmallKeyVector< K, T > const &  b 
)
friend
template<typename K, typename T>
template<typename UK , typename UT >
void swap ( SmallKeyVector< UK, UT > &  a,
SmallKeyVector< UK, UT > &  b 
)
friend

swap( SmallKeyVector, SmallKeyVector )

Member Data Documentation

template<typename K, typename T>
IndexMap utility::keys::SmallKeyVector< K, T >::m_
private
template<typename K, typename T>
Index utility::keys::SmallKeyVector< K, T >::u_
private
template<typename K, typename T>
Vector utility::keys::SmallKeyVector< K, T >::v_
private

Vector of values indexed by a subset of the possible keys.

Referenced by utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::add_key(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::assign(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::at(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::back(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::begin(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::capacity(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::clear(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::empty(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::end(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::erase(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::find(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::front(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::insert(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::max_size(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::operator()(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::operator=(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::operator[](), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::pop_back(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::push_back(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::rbegin(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::rend(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::reserve(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::resize(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::shrink(), utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::size(), and utility::keys::SmallKeyVector< PathVectorOptionKey, PathVectorOption >::swap().


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