StreamRegistry.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_StreamRegistry_
18 #define HH_SENF_Utils_Logger_StreamRegistry_ 1
19 
20 // Custom includes
21 #include <map>
22 #include <ext/functional>
23 #include <boost/iterator/transform_iterator.hpp>
24 #include <senf/Utils/singleton.hh>
25 
26 //#include "StreamRegistry.mpp"
27 #include "StreamRegistry.ih"
28 //-/////////////////////////////////////////////////////////////////////////////////////////////////
29 
30 namespace senf {
31 namespace log {
32 
33  namespace detail { struct StreamBase; }
34 
44  : public senf::singleton<StreamRegistry>
45  {
46  typedef std::map<std::string, detail::StreamBase const *> Registry;
47 
48  public:
49  typedef boost::transform_iterator< ::__gnu_cxx::select1st<Registry::value_type>,
50  Registry::const_iterator > iterator;
51 
52 # ifdef DOXYGEN
53  // Hmm ... doxygen does not understand 'using declarations' ...
55  static AreaRegistry & instance();
56 # endif
57 
59 
60  iterator begin();
61  iterator end();
62 
63  detail::StreamBase const * lookup(std::string const & name);
64 
65  private:
67 
68  void registerStream(detail::StreamBase const & stream);
69 
70  Registry registry_;
71 
73  friend struct detail::StreamBase;
74  friend class Target;
75  };
76 
77 }}
78 
79 //-/////////////////////////////////////////////////////////////////////////////////////////////////
80 #include "StreamRegistry.cci"
81 //#include "StreamRegistry.ct"
82 //#include "StreamRegistry.cti"
83 #endif
84 
85 
86 // Local Variables:
87 // mode: c++
88 // fill-column: 100
89 // comment-column: 40
90 // c-file-style: "senf"
91 // indent-tabs-mode: nil
92 // ispell-local-dictionary: "american"
93 // compile-command: "scons -u test"
94 // End:
boost::transform_iterator< ::__gnu_cxx::select1st< Registry::value_type >, Registry::const_iterator > iterator
Logging target base class.
Definition: Target.hh:133