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

Keyed-access map with key subset map for each client class. More...

#include <ClassKeyMap.hh>

Public Types

typedefkey_type
 
typedef T mapped_type
 
typedef Tmapped_reference
 
typedef T const & mapped_const_reference
 
typedef Tmapped_pointer
 
typedef T const * mapped_const_pointer
 
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
 
typedef C client_type
 
typedefKey
 
typedef T Mapped
 
typedef TMappedReference
 
typedef T const & MappedConstReference
 
typedef TMappedPointer
 
typedef T const * MappedConstPointer
 
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
 
typedef C Client
 

Public Member Functions

 ClassKeyMap ()=default
 Default constructor. More...
 
 ClassKeyMap (ClassKeyMap const &a)
 Copy constructor. More...
 
template<typename InputIterator >
 ClassKeyMap (InputIterator const beg, InputIterator const end)
 Iterator range constructor. More...
 
 ~ClassKeyMap ()
 Destructor. More...
 
ClassKeyMapoperator= (ClassKeyMap const &a)
 Copy assignment. More...
 
ClassKeyMapoperator= (Mapped const &mapped)
 Uniform value assignment to current elements. More...
 
ClassKeyMapassign (Key const &key, Mapped const &mapped)
 Assign a value to an element with a key. More...
 
ClassKeyMapassign (Value const &value)
 Assign a value to an element. More...
 
template<typename InputIterator >
void assign (InputIterator const beg, InputIterator const end)
 Iterator assignment. More...
 
ClassKeyMapadd (Key const &key)
 Add an element with a key if not present: Activate key if inactive. More...
 
ClassKeyMapinsert (Value const &value)
 Insert an element. More...
 
template<typename InputIterator >
void insert (InputIterator const beg, InputIterator const end)
 Insert elements from iterator range [beg,end) More...
 
void reserve (Size const num)
 Reserve space for a given number of elements. More...
 
void shrink ()
 Shrink the vector to remove unused capacity. More...
 
void swap (ClassKeyMap &a)
 swap( ClassKeyMap ) 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...
 
bool has (Key const &key) const
 Is an element with a key present? 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...
 
MappedReference operator() (Key const &key)
 ClassKeyMap( key ) More...
 
MappedConstReference operator[] (Key const &key) const
 ClassKeyMap[ key ] const. More...
 
MappedReference operator[] (Key const &key)
 ClassKeyMap[ key ]. More...
 
MappedConstReference operator[] (Index const &i) const
 ClassKeyMap[ index ] const. More...
 
MappedReference operator[] (Index const &i)
 ClassKeyMap[ index ]. More...
 
ConstReference operator() (Index const &i) const
 ClassKeyMap( index ) const. More...
 
Reference operator() (Index const &i)
 ClassKeyMap( 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...
 

Static Public Member Functions

static Index const & index (Key const &key)
 Index of a key. More...
 
static bool active (Key const &key)
 Is a key active? More...
 
static bool inactive (Key const &key)
 Is a key inactive? More...
 
static void activate (Key const &key)
 Activate a key if inactive. More...
 

Private Types

typedef vector1< std::pair< K,
T > > 
Vector
 
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...
 

Static Private Member Functions

static IndexMapm ()
 Index map from keys into v_: Zero => inactive key. More...
 
static Indexu ()
 Upper active index of active keys. More...
 
static Indexactivated_index (Key const &key)
 Activate a key if inactive and return its index. More...
 
static void map_shrink ()
 Shrink the index map to remove unused capacity. More...
 

Private Attributes

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

Friends

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

Detailed Description

template<typename K, typename T, typename C>
class utility::keys::ClassKeyMap< K, T, C >

Keyed-access map with key subset map for each client class.

Member Typedef Documentation

template<typename K, typename T, typename C>
typedef Vector::Allocator utility::keys::ClassKeyMap< K, T, C >::Allocator
template<typename K, typename T, typename C>
typedef Vector::allocator_type utility::keys::ClassKeyMap< K, T, C >::allocator_type
template<typename K, typename T, typename C>
typedef C utility::keys::ClassKeyMap< K, T, C >::Client
template<typename K, typename T, typename C>
typedef C utility::keys::ClassKeyMap< K, T, C >::client_type
template<typename K, typename T, typename C>
typedef Vector::const_iterator utility::keys::ClassKeyMap< K, T, C >::const_iterator
template<typename K, typename T, typename C>
typedef Vector::const_pointer utility::keys::ClassKeyMap< K, T, C >::const_pointer
template<typename K, typename T, typename C>
typedef Vector::const_reference utility::keys::ClassKeyMap< K, T, C >::const_reference
template<typename K, typename T, typename C>
typedef Vector::const_reverse_iterator utility::keys::ClassKeyMap< K, T, C >::const_reverse_iterator
template<typename K, typename T, typename C>
typedef Vector::ConstIterator utility::keys::ClassKeyMap< K, T, C >::ConstIterator
template<typename K, typename T, typename C>
typedef Vector::ConstPointer utility::keys::ClassKeyMap< K, T, C >::ConstPointer
template<typename K, typename T, typename C>
typedef Vector::ConstReference utility::keys::ClassKeyMap< K, T, C >::ConstReference
template<typename K, typename T, typename C>
typedef Vector::ConstReverseIterator utility::keys::ClassKeyMap< K, T, C >::ConstReverseIterator
template<typename K, typename T, typename C>
typedef Vector::Difference utility::keys::ClassKeyMap< K, T, C >::Difference
template<typename K, typename T, typename C>
typedef Vector::difference_type utility::keys::ClassKeyMap< K, T, C >::difference_type
template<typename K, typename T, typename C>
typedef Vector::Index utility::keys::ClassKeyMap< K, T, C >::Index
template<typename K, typename T, typename C>
typedef Vector::index_type utility::keys::ClassKeyMap< K, T, C >::index_type
template<typename K, typename T, typename C>
typedef vector1< typename Vector::Index > utility::keys::ClassKeyMap< K, T, C >::IndexMap
private
template<typename K, typename T, typename C>
typedef IndexMap::Index utility::keys::ClassKeyMap< K, T, C >::IndexMapIndex
private
template<typename K, typename T, typename C>
typedef IndexMap::Size utility::keys::ClassKeyMap< K, T, C >::IndexMapSize
private
template<typename K, typename T, typename C>
typedef Vector::iterator utility::keys::ClassKeyMap< K, T, C >::iterator
template<typename K, typename T, typename C>
typedef Vector::Iterator utility::keys::ClassKeyMap< K, T, C >::Iterator
template<typename K, typename T, typename C>
typedef K utility::keys::ClassKeyMap< K, T, C >::Key
template<typename K, typename T, typename C>
typedef K utility::keys::ClassKeyMap< K, T, C >::key_type
template<typename K, typename T, typename C>
typedef T utility::keys::ClassKeyMap< K, T, C >::Mapped
template<typename K, typename T, typename C>
typedef T const* utility::keys::ClassKeyMap< K, T, C >::mapped_const_pointer
template<typename K, typename T, typename C>
typedef T const& utility::keys::ClassKeyMap< K, T, C >::mapped_const_reference
template<typename K, typename T, typename C>
typedef T* utility::keys::ClassKeyMap< K, T, C >::mapped_pointer
template<typename K, typename T, typename C>
typedef T& utility::keys::ClassKeyMap< K, T, C >::mapped_reference
template<typename K, typename T, typename C>
typedef T utility::keys::ClassKeyMap< K, T, C >::mapped_type
template<typename K, typename T, typename C>
typedef T const* utility::keys::ClassKeyMap< K, T, C >::MappedConstPointer
template<typename K, typename T, typename C>
typedef T const& utility::keys::ClassKeyMap< K, T, C >::MappedConstReference
template<typename K, typename T, typename C>
typedef T* utility::keys::ClassKeyMap< K, T, C >::MappedPointer
template<typename K, typename T, typename C>
typedef T& utility::keys::ClassKeyMap< K, T, C >::MappedReference
template<typename K, typename T, typename C>
typedef Vector::pointer utility::keys::ClassKeyMap< K, T, C >::pointer
template<typename K, typename T, typename C>
typedef Vector::Pointer utility::keys::ClassKeyMap< K, T, C >::Pointer
template<typename K, typename T, typename C>
typedef Vector::reference utility::keys::ClassKeyMap< K, T, C >::reference
template<typename K, typename T, typename C>
typedef Vector::Reference utility::keys::ClassKeyMap< K, T, C >::Reference
template<typename K, typename T, typename C>
typedef Vector::reverse_iterator utility::keys::ClassKeyMap< K, T, C >::reverse_iterator
template<typename K, typename T, typename C>
typedef Vector::ReverseIterator utility::keys::ClassKeyMap< K, T, C >::ReverseIterator
template<typename K, typename T, typename C>
typedef Vector::Size utility::keys::ClassKeyMap< K, T, C >::Size
template<typename K, typename T, typename C>
typedef Vector::size_type utility::keys::ClassKeyMap< K, T, C >::size_type
template<typename K, typename T, typename C>
typedef Vector::Value utility::keys::ClassKeyMap< K, T, C >::Value
template<typename K, typename T, typename C>
typedef Vector::value_type utility::keys::ClassKeyMap< K, T, C >::value_type
template<typename K, typename T, typename C>
typedef vector1< std::pair< K, T > > utility::keys::ClassKeyMap< K, T, C >::Vector
private

Constructor & Destructor Documentation

template<typename K, typename T, typename C>
utility::keys::ClassKeyMap< K, T, C >::ClassKeyMap ( )
inlinedefault

Default constructor.

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

Copy constructor.

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

Destructor.

Member Function Documentation

template<typename K, typename T, typename C>
static void utility::keys::ClassKeyMap< K, T, C >::activate ( Key const &  key)
inlinestatic
template<typename K, typename T, typename C>
static Index& utility::keys::ClassKeyMap< K, T, C >::activated_index ( Key const &  key)
inlinestaticprivate
template<typename K, typename T, typename C>
static bool utility::keys::ClassKeyMap< K, T, C >::active ( Key const &  key)
inlinestatic
template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::add ( Key const &  key)
inline

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

References utility::keys::ClassKeyMap< K, T, C >::add_key().

template<typename K, typename T, typename C>
Index const& utility::keys::ClassKeyMap< K, T, C >::add_key ( Key const &  key)
inlineprivate
template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::assign ( Key const &  key,
Mapped const &  mapped 
)
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

References utility::keys::ClassKeyMap< K, T, C >::add_key(), and utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::assign ( Value const &  value)
inline

Assign a value to an element.

Note
Adds the key to the map if not present
Expands the vector if necessary

References utility::keys::ClassKeyMap< K, T, C >::add_key(), utility::keys::ClassKeyMap< K, T, C >::v_, and value.

template<typename K, typename T, typename C>
template<typename InputIterator >
void utility::keys::ClassKeyMap< K, T, C >::assign ( InputIterator const  beg,
InputIterator const  end 
)
inline
template<typename K, typename T, typename C>
ConstIterator utility::keys::ClassKeyMap< K, T, C >::begin ( ) const
inline

Begin iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
Iterator utility::keys::ClassKeyMap< K, T, C >::begin ( )
inline

Begin iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
Size utility::keys::ClassKeyMap< K, T, C >::capacity ( ) const
inline
template<typename K, typename T, typename C>
void utility::keys::ClassKeyMap< K, T, C >::clear ( )
inline
template<typename K, typename T, typename C>
bool utility::keys::ClassKeyMap< K, T, C >::empty ( ) const
inline
template<typename K, typename T, typename C>
ConstIterator utility::keys::ClassKeyMap< K, T, C >::end ( ) const
inline
template<typename K, typename T, typename C>
Iterator utility::keys::ClassKeyMap< K, T, C >::end ( )
inline

End iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
ConstIterator utility::keys::ClassKeyMap< K, T, C >::find ( Key const &  key) const
inline
template<typename K, typename T, typename C>
Iterator utility::keys::ClassKeyMap< K, T, C >::find ( Key const &  key)
inline
template<typename K, typename T, typename C>
bool utility::keys::ClassKeyMap< K, T, C >::has ( Key const &  key) const
inline
template<typename K, typename T, typename C>
static bool utility::keys::ClassKeyMap< K, T, C >::inactive ( Key const &  key)
inlinestatic
template<typename K, typename T, typename C>
static Index const& utility::keys::ClassKeyMap< K, T, C >::index ( Key const &  key)
inlinestatic
template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::insert ( Value const &  value)
inline

Insert an element.

Note
Adds the key to the map if not present
Expands the vector if necessary

References utility::keys::ClassKeyMap< K, T, C >::add_key(), utility::keys::ClassKeyMap< K, T, C >::v_, and value.

Referenced by utility::keys::ClassKeyMap< K, T, C >::insert().

template<typename K, typename T, typename C>
template<typename InputIterator >
void utility::keys::ClassKeyMap< K, T, C >::insert ( InputIterator const  beg,
InputIterator const  end 
)
inline

Insert elements from iterator range [beg,end)

References utility::keys::ClassKeyMap< K, T, C >::end(), and utility::keys::ClassKeyMap< K, T, C >::insert().

template<typename K, typename T, typename C>
static IndexMap& utility::keys::ClassKeyMap< K, T, C >::m ( )
inlinestaticprivate
template<typename K, typename T, typename C>
static void utility::keys::ClassKeyMap< K, T, C >::map_shrink ( )
inlinestaticprivate

Shrink the index map to remove unused capacity.

References utility::keys::ClassKeyMap< K, T, C >::m(), and utility::vectorL< SSize, T, A >::shrink().

template<typename K, typename T, typename C>
Size utility::keys::ClassKeyMap< K, T, C >::max_size ( ) const
inline
template<typename K, typename T, typename C>
MappedReference utility::keys::ClassKeyMap< K, T, C >::operator() ( Key const &  key)
inline

ClassKeyMap( key )

Note
Activates the key if inactive
Expands the vector if necessary

References utility::keys::ClassKeyMap< K, T, C >::add_key(), and utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
ConstReference utility::keys::ClassKeyMap< K, T, C >::operator() ( Index const &  i) const
inline

ClassKeyMap( index ) const.

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
Reference utility::keys::ClassKeyMap< K, T, C >::operator() ( Index const &  i)
inline

ClassKeyMap( index )

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::operator= ( ClassKeyMap< K, T, C > const &  a)
inline

Copy assignment.

References utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
ClassKeyMap& utility::keys::ClassKeyMap< K, T, C >::operator= ( Mapped const &  mapped)
inline

Uniform value assignment to current elements.

References test.T009_Exceptions::e, and utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
MappedConstReference utility::keys::ClassKeyMap< K, T, C >::operator[] ( Key const &  key) const
inline
template<typename K, typename T, typename C>
MappedReference utility::keys::ClassKeyMap< K, T, C >::operator[] ( Key const &  key)
inline
template<typename K, typename T, typename C>
MappedConstReference utility::keys::ClassKeyMap< K, T, C >::operator[] ( Index const &  i) const
inline
template<typename K, typename T, typename C>
MappedReference utility::keys::ClassKeyMap< K, T, C >::operator[] ( Index const &  i)
inline
template<typename K, typename T, typename C>
ConstReverseIterator utility::keys::ClassKeyMap< K, T, C >::rbegin ( ) const
inline

Begin reverse iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

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

Begin reverse iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

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

End reverse iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

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

End reverse iterator.

References utility::keys::ClassKeyMap< K, T, C >::v_.

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

Reserve space for a given number of elements.

References utility::keys::ClassKeyMap< K, T, C >::v_.

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

Shrink the vector to remove unused capacity.

References utility::vectorL< SSize, T, A >::shrink(), and utility::keys::ClassKeyMap< K, T, C >::v_.

template<typename K, typename T, typename C>
Size utility::keys::ClassKeyMap< K, T, C >::size ( ) const
inline
template<typename K, typename T, typename C>
void utility::keys::ClassKeyMap< K, T, C >::swap ( ClassKeyMap< K, T, C > &  a)
inline
template<typename K, typename T, typename C>
static Index& utility::keys::ClassKeyMap< K, T, C >::u ( )
inlinestaticprivate

Upper active index of active keys.

Referenced by utility::keys::ClassKeyMap< K, T, C >::activate().

Friends And Related Function Documentation

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

swap( ClassKeyMap, ClassKeyMap )

Member Data Documentation

template<typename K, typename T, typename C>
Vector utility::keys::ClassKeyMap< K, T, C >::v_
private

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