AreaRegistry.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_Logger_AreaRegistry_
18 #define HH_SENF_Utils_Logger_AreaRegistry_ 1
19 
20 // Custom includes
21 #include <map>
22 #include <boost/iterator/transform_iterator.hpp>
23 #include <senf/Utils/singleton.hh>
24 
25 //#include "AreaRegistry.mpp"
26 #include "AreaRegistry.ih"
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 namespace log {
31 
32  namespace detail { struct AreaBase; }
33 
45  : public senf::singleton<AreaRegistry>
46  {
47  typedef std::map<std::string, detail::AreaBase const *> Registry;
48 
49  struct SelectName
50  {
51  typedef std::string result_type;
52  std::string const & operator()(Registry::value_type const & v) const;
53  };
54 
55  public:
56  typedef boost::transform_iterator<SelectName, Registry::const_iterator> iterator;
58 
59 # ifdef DOXYGEN
60  // Hmm ... doxygen does not understand using declarations ...
62  static AreaRegistry & instance();
63 # endif
64 
66 
67  iterator begin();
68  iterator end();
69 
70  detail::AreaBase const * lookup(std::string const & name);
71 
72  private:
73  AreaRegistry();
74 
75  void registerArea(detail::AreaBase const & area);
76 
77  Registry registry_;
78 
80  friend struct detail::AreaBase;
81  friend class Target;
82  };
83 
84 }}
85 
86 //-/////////////////////////////////////////////////////////////////////////////////////////////////
87 #include "AreaRegistry.cci"
88 //#include "AreaRegistry.ct"
89 //#include "AreaRegistry.cti"
90 #endif
91 
92 
93 // Local Variables:
94 // mode: c++
95 // fill-column: 100
96 // comment-column: 40
97 // c-file-style: "senf"
98 // indent-tabs-mode: nil
99 // ispell-local-dictionary: "american"
100 // compile-command: "scons -u test"
101 // End:
boost::transform_iterator< SelectName, Registry::const_iterator > iterator
Iterator type.
Definition: AreaRegistry.hh:56
Logging target base class.
Definition: Target.hh:133