Packets: senf::Parse_Variant documentation
[senf.git] / Utils / Logger / Area.cci
1 // $Id$
2 //
3 // Copyright (C) 2007 
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief Area inline non-template implementation */
25
26 #include "Area.ih"
27
28 // Custom includes
29 #include "../TypeInfo.hh"
30 #include "Levels.hh"
31 #include "Stream.hh"
32
33 #define prefix_ inline
34 ///////////////////////////////cci.p///////////////////////////////////////
35
36 ///////////////////////////////////////////////////////////////////////////
37 // senf::log::AreaRegistry
38
39 prefix_ std::string const &
40 senf::log::AreaRegistry::SelectName::operator()(Registry::value_type const & v)
41     const
42 {
43     return v.first;
44 }
45
46 prefix_ senf::log::AreaRegistry::AreaRegistry()
47 {}
48
49 prefix_ senf::log::AreaRegistry::iterator senf::log::AreaRegistry::begin()
50 {
51     return boost::make_transform_iterator(registry_.begin(), SelectName());
52 }
53
54 prefix_ senf::log::AreaRegistry::iterator senf::log::AreaRegistry::end()
55 {
56     return boost::make_transform_iterator(registry_.end(), SelectName());
57 }
58
59 prefix_ void senf::log::AreaRegistry::registerArea(detail::AreaBase const & area)
60 {
61     registry_.insert( std::make_pair(area.v_name(), &area) );
62 }
63
64 ///////////////////////////////////////////////////////////////////////////
65 // senf::log::detail::AreaBase
66
67 prefix_ std::string senf::log::detail::AreaBase::fullName()
68     const
69 {
70     return prettyName(typeid(*this));
71 }
72
73 prefix_ std::string senf::log::detail::AreaBase::v_name()
74     const
75 {
76     return fullName();
77 }
78
79 prefix_ void senf::log::detail::AreaBase::init()
80 {
81     senf::log::AreaRegistry::instance().registerArea(*this);
82 }
83
84 prefix_ unsigned senf::log::detail::AreaBase::streamLimit(StreamBase const & stream)
85     const
86 {
87     return stream.index >= streamLimits_.size() ? DISABLED::value : streamLimits_[stream.index];
88 }
89
90 prefix_ void senf::log::detail::AreaBase::setStreamLimit(StreamBase const & stream, unsigned value)
91     const
92 {
93     if (stream.index >= streamLimits_.size())
94         streamLimits_.resize(stream.index+1,0u);
95     streamLimits_[stream.index] = value;
96 }
97
98 ///////////////////////////////cci.e///////////////////////////////////////
99 #undef prefix_
100
101 \f
102 // Local Variables:
103 // mode: c++
104 // fill-column: 100
105 // comment-column: 40
106 // c-file-style: "senf"
107 // indent-tabs-mode: nil
108 // ispell-local-dictionary: "american"
109 // compile-command: "scons -u test"
110 // End: