Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | List of all members
cet::registry_via_id< K, V > Class Template Reference

#include <registry_via_id.h>

Public Types

using collection_type = std::map< K const, V >
 
using key_type = typename collection_type::key_type
 
using mapped_type = typename collection_type::mapped_type
 
using value_type = typename collection_type::value_type
 
using size_type = typename collection_type::size_type
 
using const_iterator = typename collection_type::const_iterator
 

Public Member Functions

template<class FwdIt >
auto put (FwdIt b, FwdIt e) -> std::enable_if_t< std::is_same_v< typename std::iterator_traits< FwdIt >::value_type, mapped_type >>
 

Static Public Member Functions

static bool empty ()
 
static size_type size ()
 
static const_iterator begin ()
 
static const_iterator end ()
 
static const_iterator cbegin ()
 
static const_iterator cend ()
 
static detail::must_have_id< K, V >::type put (V const &value)
 
template<class FwdIt >
static std::enable_if_t< std::is_same_v< typename std::iterator_traits< FwdIt >::value_type, mapped_type > > put (FwdIt begin, FwdIt end)
 
template<class FwdIt >
static std::enable_if_t< std::is_same_v< typename std::iterator_traits< FwdIt >::value_type, value_type > > put (FwdIt begin, FwdIt end)
 
static void put (collection_type const &c)
 
static collection_type const & get () noexcept
 
static V const & get (K const &key)
 
static bool get (K const &key, V &value) noexcept
 

Private Member Functions

 registry_via_id ()=delete
 
 registry_via_id (registry_via_id const &)=delete
 
void operator= (registry_via_id const &)=delete
 

Static Private Member Functions

static collection_typethe_registry_ ()
 

Detailed Description

template<class K, class V>
class cet::registry_via_id< K, V >

Definition at line 19 of file registry_via_id.h.

Member Typedef Documentation

template<class K , class V >
using cet::registry_via_id< K, V >::collection_type = std::map<K const, V>

Definition at line 39 of file registry_via_id.h.

template<class K , class V >
using cet::registry_via_id< K, V >::const_iterator = typename collection_type::const_iterator

Definition at line 44 of file registry_via_id.h.

template<class K , class V >
using cet::registry_via_id< K, V >::key_type = typename collection_type::key_type

Definition at line 40 of file registry_via_id.h.

template<class K , class V >
using cet::registry_via_id< K, V >::mapped_type = typename collection_type::mapped_type

Definition at line 41 of file registry_via_id.h.

template<class K , class V >
using cet::registry_via_id< K, V >::size_type = typename collection_type::size_type

Definition at line 43 of file registry_via_id.h.

template<class K , class V >
using cet::registry_via_id< K, V >::value_type = typename collection_type::value_type

Definition at line 42 of file registry_via_id.h.

Constructor & Destructor Documentation

template<class K , class V >
cet::registry_via_id< K, V >::registry_via_id ( )
privatedelete
template<class K , class V >
cet::registry_via_id< K, V >::registry_via_id ( registry_via_id< K, V > const &  )
privatedelete

Member Function Documentation

template<class K , class V >
static const_iterator cet::registry_via_id< K, V >::begin ( )
inlinestatic

Definition at line 60 of file registry_via_id.h.

61  {
62  return the_registry_().begin();
63  }
static collection_type & the_registry_()
template<class K , class V >
static const_iterator cet::registry_via_id< K, V >::cbegin ( )
inlinestatic

Definition at line 70 of file registry_via_id.h.

71  {
72  return the_registry_().cbegin();
73  }
static collection_type & the_registry_()
template<class K , class V >
static const_iterator cet::registry_via_id< K, V >::cend ( )
inlinestatic

Definition at line 75 of file registry_via_id.h.

76  {
77  return the_registry_().cend();
78  }
static collection_type & the_registry_()
template<class K , class V >
static bool cet::registry_via_id< K, V >::empty ( )
inlinestatic

Definition at line 48 of file registry_via_id.h.

49  {
50  return the_registry_().empty();
51  }
static collection_type & the_registry_()
template<class K , class V >
static const_iterator cet::registry_via_id< K, V >::end ( )
inlinestatic

Definition at line 65 of file registry_via_id.h.

66  {
67  return the_registry_().end();
68  }
static collection_type & the_registry_()
template<class K , class V >
static collection_type const& cet::registry_via_id< K, V >::get ( )
inlinestaticnoexcept

Definition at line 102 of file registry_via_id.h.

103  {
104  return the_registry_();
105  }
static collection_type & the_registry_()
template<class K , class V >
V const & cet::registry_via_id< K, V >::get ( K const &  key)
static

Definition at line 163 of file registry_via_id.h.

164 {
165  const_iterator it = the_registry_().find(key);
166  if (it == the_registry_().end())
167  throw cet::exception("cet::registry_via_id")
168  << "Key \"" << key << "\" not found in registry";
169  return it->second;
170 }
static const_iterator end()
static collection_type & the_registry_()
def key(type, name=None)
Definition: graph.py:13
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
template<class K , class V >
bool cet::registry_via_id< K, V >::get ( K const &  key,
V &  value 
)
staticnoexcept

Definition at line 174 of file registry_via_id.h.

175 {
176  bool result;
177  const_iterator it = the_registry_().find(key);
178  if (it == the_registry_().end()) {
179  result = false;
180  } else {
181  value = it->second;
182  result = true;
183  }
184  return result;
185 }
static QCString result
static const_iterator end()
static collection_type & the_registry_()
def key(type, name=None)
Definition: graph.py:13
template<class K , class V >
void cet::registry_via_id< K, V >::operator= ( registry_via_id< K, V > const &  )
privatedelete
template<class K , class V >
cet::detail::must_have_id< K, V >::type cet::registry_via_id< K, V >::put ( V const &  value)
static

Definition at line 125 of file registry_via_id.h.

126 {
127  K id = value.id();
128  the_registry_().emplace(id, value);
129  return id;
130 }
static collection_type & the_registry_()
template<class K , class V >
template<class FwdIt >
static std::enable_if_t< std::is_same_v<typename std::iterator_traits<FwdIt>::value_type, mapped_type> > cet::registry_via_id< K, V >::put ( FwdIt  begin,
FwdIt  end 
)
static
template<class K , class V >
template<class FwdIt >
static std::enable_if_t< std::is_same_v<typename std::iterator_traits<FwdIt>::value_type, value_type> > cet::registry_via_id< K, V >::put ( FwdIt  begin,
FwdIt  end 
)
static
template<class K , class V >
void cet::registry_via_id< K, V >::put ( collection_type const &  c)
inlinestatic

Definition at line 153 of file registry_via_id.h.

154 {
155  put(c.cbegin(), c.cend());
156 }
static detail::must_have_id< K, V >::type put(V const &value)
template<class K , class V >
template<class FwdIt >
auto cet::registry_via_id< K, V >::put ( FwdIt  b,
FwdIt  e 
) -> std::enable_if_t< std::is_same_v<typename std::iterator_traits<FwdIt>::value_type, mapped_type>>
inline

Definition at line 135 of file registry_via_id.h.

137 {
138  for (; b != e; ++b)
139  put(*b);
140 }
const double e
static detail::must_have_id< K, V >::type put(V const &value)
static bool * b
Definition: config.cpp:1043
template<class K , class V >
static size_type cet::registry_via_id< K, V >::size ( )
inlinestatic

Definition at line 53 of file registry_via_id.h.

54  {
55  return the_registry_().size();
56  }
static collection_type & the_registry_()
template<class K , class V >
static collection_type& cet::registry_via_id< K, V >::the_registry_ ( )
inlinestaticprivate

Definition at line 112 of file registry_via_id.h.

113  {
114  static collection_type the_registry;
115  return the_registry;
116  }
std::map< K const, V > collection_type

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