Rosetta  2020.46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

typedefkey_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
 
typedefKey
 
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,
KeyP
Map
 

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

template<typename K>
typedef Keys::const_iterator utility::keys::KeyLookup< K >::const_iterator
template<typename K>
typedef Map::const_reference utility::keys::KeyLookup< K >::const_reference
template<typename K>
typedef Map::const_reference utility::keys::KeyLookup< K >::ConstReference
template<typename K>
typedef K utility::keys::KeyLookup< K >::Key
template<typename K>
typedef VariantKey< K > utility::keys::KeyLookup< K >::Key_
private
template<typename K>
typedef K utility::keys::KeyLookup< K >::key_type
template<typename K>
typedef Key_ const* utility::keys::KeyLookup< K >::KeyP
private
template<typename K>
typedef std::set< Key_ > utility::keys::KeyLookup< K >::Keys
private
template<typename K>
typedef std::map< std::string, KeyP > utility::keys::KeyLookup< K >::Map
private
template<typename K>
typedef Map::mapped_type utility::keys::KeyLookup< K >::Mapped
template<typename K>
typedef Map::mapped_type utility::keys::KeyLookup< K >::mapped_type
template<typename K>
typedef Map::reference utility::keys::KeyLookup< K >::reference
template<typename K>
typedef Map::reference utility::keys::KeyLookup< K >::Reference
template<typename K>
typedef Map::size_type utility::keys::KeyLookup< K >::Size
template<typename K>
typedef Map::size_type utility::keys::KeyLookup< K >::size_type
template<typename K>
typedef Map::value_type utility::keys::KeyLookup< K >::Value
template<typename K>
typedef Map::value_type utility::keys::KeyLookup< K >::value_type

Constructor & Destructor Documentation

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

Default constructor.

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

Copy constructor.

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

Destructor.

Member Function Documentation

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

Clear the collection and lookup map.

References utility::keys::KeyLookup< K >::keys(), and utility::keys::KeyLookup< K >::m().

template<typename K>
static bool utility::keys::KeyLookup< K >::empty ( )
inlinestatic
template<typename K>
static ConstIterator utility::keys::KeyLookup< K >::end ( )
inlinestatic
template<typename K>
static void utility::keys::KeyLookup< K >::erase ( std::string const &  id)
inlinestaticprivate
template<typename K>
template<typename KeyC >
static Key const& utility::keys::KeyLookup< K >::gen ( std::string const &  id)
inlinestatic
template<typename K>
template<typename KeyC >
static Key const& utility::keys::KeyLookup< K >::gen ( std::string const &  id,
std::string const &  identifier 
)
inlinestatic
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
template<typename K>
static bool utility::keys::KeyLookup< K >::has ( std::string const &  id)
inlinestatic
template<typename K>
static bool utility::keys::KeyLookup< K >::has ( Key const &  key)
inlinestatic

Has a key?

References utility::keys::KeyLookup< K >::keys().

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

Insert a pair< identifier, KeyP > into the lookup map: Allow non-unique identifier.

References utility::keys::KeyLookup< K >::m(), utility::keys::KeyLookup< K >::not_blank(), and utility::keys::KeyLookup< K >::stripped_whitespace().

Referenced by utility::keys::KeyLookup< K >::add().

template<typename K>
static Key const& utility::keys::KeyLookup< K >::key ( std::string const &  id)
inlinestatic
template<typename K>
static Keys& utility::keys::KeyLookup< K >::keys ( )
inlinestaticprivate
template<typename K>
static Map& utility::keys::KeyLookup< K >::m ( )
inlinestaticprivate
template<typename K>
static Key::Size utility::keys::KeyLookup< K >::n_key ( )
inlinestatic

Number of keys with distinct indexes.

References n_key.

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

Copy assignment.

template<typename K>
static void utility::keys::KeyLookup< K >::remove ( Key const &  key)
inlinestatic
template<typename K>
static Size utility::keys::KeyLookup< K >::size ( )
inlinestatic
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: