4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 // Stefan Bund <g0dil@berlios.de>
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.
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.
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.
24 \brief Target inline non-template implementation */
26 //#include "Target.ih"
31 #define prefix_ inline
32 ///////////////////////////////cci.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
37 prefix_ void senf::log::Target::route(detail::StreamBase const * stream,
38 detail::AreaBase const * area, unsigned level)
40 rib_.push_back(RoutingEntry(stream, area, level));
42 // Update the area/stream routing cache
44 updateAreaCache(*area, stream, level);
46 AreaRegistry::Registry::iterator i (AreaRegistry::instance().registry_.begin());
47 AreaRegistry::Registry::iterator const i_end (AreaRegistry::instance().registry_.end());
48 for (; i != i_end; ++i)
49 updateAreaCache(*(i->second), stream, level);
55 senf::log::Target::updateAreaCache(detail::AreaBase const & area,
56 detail::StreamBase const * stream, unsigned level)
59 if (level < area.streamLimit(*stream))
60 area.setStreamLimit(*stream, level);
62 StreamRegistry::Registry::iterator i (StreamRegistry::instance().registry_.begin());
63 StreamRegistry::Registry::iterator const i_end (StreamRegistry::instance().registry_.end());
64 for(; i != i_end; ++i)
65 if (level < area.streamLimit(*(i->second)))
66 area.setStreamLimit(*(i->second),level);
70 prefix_ void senf::log::Target::unroute(detail::StreamBase const * stream,
71 detail::AreaBase const * area, unsigned level)
73 rib_.erase(std::remove(rib_.begin(), rib_.end(), RoutingEntry(stream, area, level)),
76 ///\fixme Update area/stream routing cache
77 // Not doing anything here does not produce incorrect behavior, since removing a route
78 // can never lower the logging limit. Not updating the cache just reduces the performance.
81 ///////////////////////////////////////////////////////////////////////////
82 // senf::log::TargetRegistry
84 prefix_ void senf::log::TargetRegistry::registerTarget(Target * target)
86 targets_.insert(target);
89 prefix_ void senf::log::TargetRegistry::unregisterTarget(Target * target)
91 targets_.erase(target);
94 /////////////////////////////cci.e///////////////////////////////////////
101 // comment-column: 40
102 // c-file-style: "senf"
103 // indent-tabs-mode: nil
104 // ispell-local-dictionary: "american"
105 // compile-command: "scons -u test"