Rosetta
Public Types | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | List of all members
utility::keys::KeyLookup< K > Class Template Reference

Key lookup map and collection. More...

#include <KeyLookup.hh>

Public Types

typedef K key_type
 
typedef Map::mapped_type mapped_type
 
typedef Map::value_type value_type
 
typedef Map::reference reference
 
typedef Map::const_reference const_reference
 
typedef Map::size_type size_type
 
typedef Keys::const_iterator const_iterator
 
typedef K Key
 
typedef Map::mapped_type Mapped
 
typedef Map::value_type Value
 
typedef Map::reference Reference
 
typedef Map::const_reference ConstReference
 
typedef Map::size_type Size
 
typedef Keys::const_iterator ConstIterator
 

Static Public Member Functions

static void add (Key const &key)
 Add a key. More...
 
static void add (Key const &key, std::string const &identifier)
 Add a key with an extra (non-unique) identifier. More...
 
template<typename KeyC >
static Key const & gen (std::string const &id)
 Key with an identifier: Generate key if not present. More...
 
template<typename KeyC >
static Key const & gen (std::string const &id, std::string const &identifier)
 Key with an identifier: Generate key if not present. More...
 
template<typename KeyC >
static Key const & gen (std::string const &id, std::string const &identifier, std::string const &code)
 Key with an identifier: Generate key if not present. More...
 
static void remove (Key const &key)
 Remove a key. More...
 
static void clear ()
 Clear the collection and lookup map. More...
 
static Size size ()
 Size. More...
 
static bool empty ()
 Empty? More...
 
static bool has (std::string const &id)
 Has a key with an identifier? More...
 
static bool has (Key const &key)
 Has a key? More...
 
static Key const & key (std::string const &id)
 Key with an identifier. More...
 
static Key::Size n_key ()
 Number of keys with distinct indexes. More...
 
static ConstIterator begin ()
 Begin const iterator. More...
 
static ConstIterator end ()
 End const iterator. More...
 

Private Types

typedef VariantKey< K > Key_
 
typedef std::set< Key_Keys
 
typedef Key_ const * KeyP
 
typedef std::map< std::string, KeyPMap
 

Private Member Functions

 KeyLookup ()=default
 Default constructor. More...
 
 KeyLookup (KeyLookup const &a)
 Copy constructor. More...
 
 ~KeyLookup ()=default
 Destructor. More...
 
KeyLookupoperator= (KeyLookup const &a)
 Copy assignment. More...
 

Static Private Member Functions

static void insert (std::string const &id, Key_ const &key)
 Insert a pair< identifier, KeyP > into the lookup map. More...
 
static void insert_nonunique (std::string const &id, Key_ const &key)
 Insert a pair< identifier, KeyP > into the lookup map: Allow non-unique identifier. More...
 
static void erase (std::string const &id)
 Erase a pair< identifier, KeyP > from the lookup map. More...
 
static std::string stripped_whitespace (std::string const &s)
 Whitespace stripped tails copy of a string. More...
 
static Keyskeys ()
 Key collection. More...
 
static Mapm ()
 Map from identifier to (non-owning) pointer to key. More...
 
static bool not_blank (std::string const &s)
 string is not blank? More...
 

Detailed Description

template<typename K>
class utility::keys::KeyLookup< K >

Key lookup map and collection.

Member Typedef Documentation

◆ const_iterator

template<typename K >
typedef Keys::const_iterator utility::keys::KeyLookup< K >::const_iterator

◆ const_reference

template<typename K >
typedef Map::const_reference utility::keys::KeyLookup< K >::const_reference

◆ ConstIterator

template<typename K >
typedef Keys::const_iterator utility::keys::KeyLookup< K >::ConstIterator

◆ ConstReference

template<typename K >
typedef Map::const_reference utility::keys::KeyLookup< K >::ConstReference

◆ Key

template<typename K >
typedef K utility::keys::KeyLookup< K >::Key

◆ Key_

template<typename K >
typedef VariantKey< K > utility::keys::KeyLookup< K >::Key_
private

◆ key_type

template<typename K >
typedef K utility::keys::KeyLookup< K >::key_type

◆ KeyP

template<typename K >
typedef Key_ const* utility::keys::KeyLookup< K >::KeyP
private

◆ Keys

template<typename K >
typedef std::set< Key_ > utility::keys::KeyLookup< K >::Keys
private

◆ Map

template<typename K >
typedef std::map< std::string, KeyP > utility::keys::KeyLookup< K >::Map
private

◆ Mapped

template<typename K >
typedef Map::mapped_type utility::keys::KeyLookup< K >::Mapped

◆ mapped_type

template<typename K >
typedef Map::mapped_type utility::keys::KeyLookup< K >::mapped_type

◆ reference

template<typename K >
typedef Map::reference utility::keys::KeyLookup< K >::reference

◆ Reference

template<typename K >
typedef Map::reference utility::keys::KeyLookup< K >::Reference

◆ Size

template<typename K >
typedef Map::size_type utility::keys::KeyLookup< K >::Size

◆ size_type

template<typename K >
typedef Map::size_type utility::keys::KeyLookup< K >::size_type

◆ Value

template<typename K >
typedef Map::value_type utility::keys::KeyLookup< K >::Value

◆ value_type

template<typename K >
typedef Map::value_type utility::keys::KeyLookup< K >::value_type

Constructor & Destructor Documentation

◆ KeyLookup() [1/2]

template<typename K >
utility::keys::KeyLookup< K >::KeyLookup ( )
inlineprivatedefault

Default constructor.

◆ KeyLookup() [2/2]

template<typename K >
utility::keys::KeyLookup< K >::KeyLookup ( KeyLookup< K > const &  a)
inlineprivate

Copy constructor.

◆ ~KeyLookup()

template<typename K >
utility::keys::KeyLookup< K >::~KeyLookup ( )
inlineprivatedefault

Destructor.

Member Function Documentation

◆ add() [1/2]

template<typename K >
static void utility::keys::KeyLookup< K >::add ( Key const &  key)
inlinestatic

◆ add() [2/2]

template<typename K >
static void utility::keys::KeyLookup< K >::add ( Key const &  key,
std::string const &  identifier 
)
inlinestatic

◆ begin()

template<typename K >
static ConstIterator utility::keys::KeyLookup< K >::begin ( )
inlinestatic

◆ clear()

template<typename K >
static void utility::keys::KeyLookup< K >::clear ( )
inlinestatic

◆ empty()

template<typename K >
static bool utility::keys::KeyLookup< K >::empty ( )
inlinestatic

◆ end()

template<typename K >
static ConstIterator utility::keys::KeyLookup< K >::end ( )
inlinestatic

◆ erase()

template<typename K >
static void utility::keys::KeyLookup< K >::erase ( std::string const &  id)
inlinestaticprivate

◆ gen() [1/3]

template<typename K >
template<typename KeyC >
static Key const& utility::keys::KeyLookup< K >::gen ( std::string const &  id)
inlinestatic

◆ gen() [2/3]

template<typename K >
template<typename KeyC >
static Key const& utility::keys::KeyLookup< K >::gen ( std::string const &  id,
std::string const &  identifier 
)
inlinestatic

◆ gen() [3/3]

template<typename K >
template<typename KeyC >
static Key const& utility::keys::KeyLookup< K >::gen ( std::string const &  id,
std::string const &  identifier,
std::string const &  code 
)
inlinestatic

◆ has() [1/2]

template<typename K >
static bool utility::keys::KeyLookup< K >::has ( Key const &  key)
inlinestatic

◆ has() [2/2]

template<typename K >
static bool utility::keys::KeyLookup< K >::has ( std::string const &  id)
inlinestatic

◆ insert()

template<typename K >
static void utility::keys::KeyLookup< K >::insert ( std::string const &  id,
Key_ const &  key 
)
inlinestaticprivate

◆ insert_nonunique()

template<typename K >
static void utility::keys::KeyLookup< K >::insert_nonunique ( std::string const &  id,
Key_ const &  key 
)
inlinestaticprivate

◆ key()

template<typename K >
static Key const& utility::keys::KeyLookup< K >::key ( std::string const &  id)
inlinestatic

◆ keys()

template<typename K >
static Keys& utility::keys::KeyLookup< K >::keys ( )
inlinestaticprivate

◆ m()

template<typename K >
static Map& utility::keys::KeyLookup< K >::m ( )
inlinestaticprivate

◆ n_key()

template<typename K >
static Key::Size utility::keys::KeyLookup< K >::n_key ( )
inlinestatic

Number of keys with distinct indexes.

References n_key.

◆ not_blank()

template<typename K >
static bool utility::keys::KeyLookup< K >::not_blank ( std::string const &  s)
inlinestaticprivate

◆ operator=()

template<typename K >
KeyLookup& utility::keys::KeyLookup< K >::operator= ( KeyLookup< K > const &  a)
inlineprivate

Copy assignment.

◆ remove()

template<typename K >
static void utility::keys::KeyLookup< K >::remove ( Key const &  key)
inlinestatic

◆ size()

template<typename K >
static Size utility::keys::KeyLookup< K >::size ( )
inlinestatic

◆ stripped_whitespace()

template<typename K >
static std::string utility::keys::KeyLookup< K >::stripped_whitespace ( std::string const &  s)
inlinestaticprivate

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