Rosetta  2020.37
 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::SmallKeyMap< K, T > Class Template Reference

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

#include <SmallKeyMap.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
 
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
 

Public Member Functions

 SmallKeyMap ()
 Default constructor. More...
 
 SmallKeyMap (SmallKeyMap const &a)
 Copy constructor. More...
 
template<typename InputIterator >
 SmallKeyMap (InputIterator const beg, InputIterator const end)
 Iterator range constructor. More...
 
 ~SmallKeyMap ()
 Destructor. More...
 
SmallKeyMapoperator= (SmallKeyMap const &a)
 Copy assignment. More...
 
SmallKeyMapoperator= (Mapped const &mapped)
 Uniform mapped value assignment to current elements. More...
 
SmallKeyMapassign (Key const &key, Mapped const &mapped)
 Assign a mapped value to an element with a key. More...
 
SmallKeyMapassign (Value const &value)
 Assign a value to an element. More...
 
template<typename InputIterator >
void assign (InputIterator const beg, InputIterator const end)
 Iterator assignment. More...
 
SmallKeyMapadd (Key const &key)
 Add an element with a key if not present: Activate key if inactive. More...
 
SmallKeyMapinsert (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 vectors to remove unused capacity. More...
 
void swap (SmallKeyMap &a)
 swap( SmallKeyMap ) 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...
 
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...
 
MappedReference operator() (Key const &key)
 SmallKeyMap( key ) More...
 
MappedConstReference operator[] (Key const &key) const
 SmallKeyMap[ key ] const. More...
 
MappedReference operator[] (Key const &key)
 SmallKeyMap[ key ]. More...
 
MappedConstReference operator[] (Index const &i) const
 SmallKeyMap[ index ] const. More...
 
MappedReference operator[] (Index const &i)
 SmallKeyMap[ index ]. More...
 
ConstReference operator() (Index const &i) const
 SmallKeyMap( index ) const. More...
 
Reference operator() (Index const &i)
 SmallKeyMap( 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< 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...
 

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

void swap (SmallKeyMap &a, SmallKeyMap &b)
 swap( SmallKeyMap, SmallKeyMap ) More...
 
bool operator== (SmallKeyMap const &a, SmallKeyMap const &b)
 SmallKeyMap == SmallKeyMap. More...
 
bool operator!= (SmallKeyMap const &a, SmallKeyMap const &b)
 SmallKeyMap != SmallKeyMap. More...
 

Detailed Description

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

Keyed-access map with key subset map.

Member Typedef Documentation

template<typename K, typename T>
typedef Vector::Allocator utility::keys::SmallKeyMap< K, T >::Allocator
template<typename K, typename T>
typedef Vector::const_pointer utility::keys::SmallKeyMap< K, T >::const_pointer
template<typename K, typename T>
typedef Vector::ConstIterator utility::keys::SmallKeyMap< K, T >::ConstIterator
template<typename K, typename T>
typedef Vector::ConstPointer utility::keys::SmallKeyMap< K, T >::ConstPointer
template<typename K, typename T>
typedef Vector::Difference utility::keys::SmallKeyMap< K, T >::Difference
template<typename K, typename T>
typedef Vector::Index utility::keys::SmallKeyMap< K, T >::Index
template<typename K, typename T>
typedef Vector::index_type utility::keys::SmallKeyMap< K, T >::index_type
template<typename K, typename T>
typedef vector1< typename Vector::Index > utility::keys::SmallKeyMap< K, T >::IndexMap
private
template<typename K, typename T>
typedef IndexMap::Index utility::keys::SmallKeyMap< K, T >::IndexMapIndex
private
template<typename K, typename T>
typedef IndexMap::Size utility::keys::SmallKeyMap< K, T >::IndexMapSize
private
template<typename K, typename T>
typedef Vector::iterator utility::keys::SmallKeyMap< K, T >::iterator
template<typename K, typename T>
typedef Vector::Iterator utility::keys::SmallKeyMap< K, T >::Iterator
template<typename K, typename T>
typedef K utility::keys::SmallKeyMap< K, T >::Key
template<typename K, typename T>
typedef K utility::keys::SmallKeyMap< K, T >::key_type
template<typename K, typename T>
typedef T utility::keys::SmallKeyMap< K, T >::Mapped
template<typename K, typename T>
typedef T const* utility::keys::SmallKeyMap< K, T >::mapped_const_pointer
template<typename K, typename T>
typedef T const& utility::keys::SmallKeyMap< K, T >::mapped_const_reference
template<typename K, typename T>
typedef T* utility::keys::SmallKeyMap< K, T >::mapped_pointer
template<typename K, typename T>
typedef T& utility::keys::SmallKeyMap< K, T >::mapped_reference
template<typename K, typename T>
typedef T utility::keys::SmallKeyMap< K, T >::mapped_type
template<typename K, typename T>
typedef T const* utility::keys::SmallKeyMap< K, T >::MappedConstPointer
template<typename K, typename T>
typedef T const& utility::keys::SmallKeyMap< K, T >::MappedConstReference
template<typename K, typename T>
typedef T* utility::keys::SmallKeyMap< K, T >::MappedPointer
template<typename K, typename T>
typedef T& utility::keys::SmallKeyMap< K, T >::MappedReference
template<typename K, typename T>
typedef Vector::pointer utility::keys::SmallKeyMap< K, T >::pointer
template<typename K, typename T>
typedef Vector::Pointer utility::keys::SmallKeyMap< K, T >::Pointer
template<typename K, typename T>
typedef Vector::reference utility::keys::SmallKeyMap< K, T >::reference
template<typename K, typename T>
typedef Vector::Reference utility::keys::SmallKeyMap< K, T >::Reference
template<typename K, typename T>
typedef Vector::Size utility::keys::SmallKeyMap< K, T >::Size
template<typename K, typename T>
typedef Vector::size_type utility::keys::SmallKeyMap< K, T >::size_type
template<typename K, typename T>
typedef Vector::Value utility::keys::SmallKeyMap< K, T >::Value
template<typename K, typename T>
typedef Vector::value_type utility::keys::SmallKeyMap< K, T >::value_type
template<typename K, typename T>
typedef vector1< std::pair< K, T > > utility::keys::SmallKeyMap< K, T >::Vector
private

Constructor & Destructor Documentation

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

Default constructor.

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

Copy constructor.

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

Destructor.

Member Function Documentation

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

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

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

template<typename K, typename T>
Index const& utility::keys::SmallKeyMap< K, T >::add_key ( Key const &  key)
inlineprivate
template<typename K, typename T>
SmallKeyMap& utility::keys::SmallKeyMap< K, T >::assign ( Key const &  key,
Mapped const &  mapped 
)
inline

Assign a mapped 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::SmallKeyMap< K, T >::add_key(), and utility::keys::SmallKeyMap< K, T >::v_.

template<typename K, typename T>
SmallKeyMap& utility::keys::SmallKeyMap< K, T >::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::SmallKeyMap< K, T >::add_key(), utility::keys::SmallKeyMap< K, T >::v_, and value.

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

Begin iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

Begin iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

End iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

template<typename K, typename T>
ConstIterator utility::keys::SmallKeyMap< K, T >::find ( Key const &  key) const
inline
template<typename K, typename T>
Iterator utility::keys::SmallKeyMap< K, T >::find ( Key const &  key)
inline
template<typename K, typename T>
bool utility::keys::SmallKeyMap< K, T >::has ( Key const &  key) const
inline

Is an element with a key present?

References utility::keys::SmallKeyMap< K, T >::active().

template<typename K, typename T>
bool utility::keys::SmallKeyMap< K, T >::inactive ( Key const &  key) const
inline
template<typename K, typename T>
Index const& utility::keys::SmallKeyMap< K, T >::index ( Key const &  key)
inline
template<typename K, typename T>
SmallKeyMap& utility::keys::SmallKeyMap< K, T >::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::SmallKeyMap< K, T >::add_key(), utility::keys::SmallKeyMap< K, T >::v_, and value.

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

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

Insert elements from iterator range [beg,end)

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

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

SmallKeyMap( key )

Note
Activates the key if inactive
Expands the vector if necessary

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

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

SmallKeyMap( index ) const.

References utility::keys::SmallKeyMap< K, T >::v_.

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

SmallKeyMap( index )

References utility::keys::SmallKeyMap< K, T >::v_.

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

Uniform mapped value assignment to current elements.

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

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

Begin reverse iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

Begin reverse iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

End reverse iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

End reverse iterator.

References utility::keys::SmallKeyMap< K, T >::v_.

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

Reserve space for a given number of elements.

References utility::keys::SmallKeyMap< K, T >::v_.

template<typename K, typename T>
void utility::keys::SmallKeyMap< K, T >::shrink ( )
inline
template<typename K, typename T>
Size utility::keys::SmallKeyMap< K, T >::size ( ) const
inline
template<typename K, typename T>
void utility::keys::SmallKeyMap< K, T >::swap ( SmallKeyMap< K, T > &  a)
inline

Friends And Related Function Documentation

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

swap( SmallKeyMap, SmallKeyMap )

Member Data Documentation

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

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