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
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
15 \brief AreaRegistry inline non-template implementation */
17 #include "AreaRegistry.ih"
20 #include <senf/Utils/TypeInfo.hh>
22 #include "StreamRegistry.hh"
24 #define prefix_ inline
25 //-/////////////////////////////////////////////////////////////////////////////////////////////////
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 // senf::log::AreaRegistry
30 prefix_ std::string const &
31 senf::log::AreaRegistry::SelectName::operator()(Registry::value_type const & v)
37 prefix_ senf::log::AreaRegistry::AreaRegistry()
40 prefix_ senf::log::AreaRegistry::iterator senf::log::AreaRegistry::begin()
42 return boost::make_transform_iterator(registry_.begin(), SelectName());
45 prefix_ senf::log::AreaRegistry::iterator senf::log::AreaRegistry::end()
47 return boost::make_transform_iterator(registry_.end(), SelectName());
50 prefix_ void senf::log::AreaRegistry::registerArea(detail::AreaBase const & area)
52 registry_.insert( std::make_pair(area.v_name(), &area) );
55 prefix_ senf::log::detail::AreaBase const *
56 senf::log::AreaRegistry::lookup(std::string const & name)
58 Registry::iterator i (registry_.find(name));
59 return i == registry_.end() ? 0 : i->second;
62 //-/////////////////////////////////////////////////////////////////////////////////////////////////
63 // senf::log::detail::AreaBase
65 prefix_ std::string senf::log::detail::AreaBase::fullName()
68 return prettyName(typeid(*this));
71 prefix_ std::string senf::log::detail::AreaBase::v_name()
77 prefix_ void senf::log::detail::AreaBase::init()
79 senf::log::AreaRegistry::instance().registerArea(*this);
82 prefix_ bool senf::log::detail::AreaBase::alive()
88 prefix_ unsigned senf::log::detail::AreaBase::limit(StreamBase const & stream)
91 return stream.index >= routingCache_.size() ?
92 DISABLED::value : routingCache_[stream.index].limit;
95 //-/////////////////////////////////////////////////////////////////////////////////////////////////
102 // comment-column: 40
103 // c-file-style: "senf"
104 // indent-tabs-mode: nil
105 // ispell-local-dictionary: "american"
106 // compile-command: "scons -u test"