Rosetta 3.3
Classes | Namespaces
src/utility/keys/KeyLookup.hh File Reference

Key lookup map and collection and functors. More...

#include <utility/keys/KeyLookup.fwd.hh>
#include <utility/keys/Key.hh>
#include <utility/keys/NoClient.hh>
#include <utility/keys/VariantKey.hh>
#include <cassert>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>

Classes

class  utility::keys::KeyLookup< K >
 Key lookup map and collection. More...
struct  utility::keys::lookup::has< K >
 Key lookup has query functor. More...
struct  utility::keys::lookup::key< K >
 Key lookup key query functor. More...
struct  utility::keys::lookup::gen< K >
 Key lookup/generator functor. More...
struct  utility::keys::lookup::n_key< K >
 Key lookup n_key query functor. More...
struct  utility::keys::lookup::begin< K >
 Key lookup begin iterator functor. More...
struct  utility::keys::lookup::end< K >
 Key lookup end iterator functor. More...

Namespaces

namespace  utility
 

unresizable vector whose size is known at compile time, which may be allocated on the stack, and which indexes from 1.


namespace  utility::keys
 

Keys and key-accessed containers for fast, safe object lookup.


namespace  utility::keys::lookup

Detailed Description

Key lookup map and collection and functors.

Author:
Stuart G. Mentzer (Stuart_Mentzer@objexx.com)
Note:
  • Monostate singleton: map and collection are static
  • Key (K) parameter: The key type
  • Client (C) parameter: The client (user) of the KeyLookup
  • Key must provide id(), identifier(), and code() members returning std::string
  • KeyLookup doesn't use map::operator[] to avoid default constructing keys, which would trigger an infinite cycle of add/insert calls
  • Holds copy of key in VariantKey to preserve dynamic key type
  • Holds just one copy of each key with a given value (determined by its operator <) even if the identifiers vary
  • If same value key is added again with any different identifiers all the identifiers refer to the original key in the lookup map
  • An identifier can only be used for a single key value: assert will catch violation
  • Keys are cloned by VariantKey so add them in their actual type constructor body
  • Functors for KeyLookup queries and key iterators are provided for key collections
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines