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(std::string const & stream, action_t action)
39 detail::StreamBase const * s (StreamRegistry::instance().lookup(stream));
41 throw InvalidStreamException();
42 route(s, 0, NONE::value, action);
45 prefix_ void senf::log::Target::route(std::string const & stream, std::string const & area,
48 detail::StreamBase const * s (StreamRegistry::instance().lookup(stream));
50 throw InvalidStreamException();
51 detail::AreaBase const * a (AreaRegistry::instance().lookup(area));
53 throw InvalidAreaException();
54 route(s, a, NONE::value, action);
57 prefix_ void senf::log::Target::route(std::string const & stream, unsigned level, action_t action)
59 detail::StreamBase const * s (StreamRegistry::instance().lookup(stream));
61 throw InvalidStreamException();
62 route(s, 0, level, action);
65 prefix_ void senf::log::Target::route(std::string const & stream, std::string const & area,
66 unsigned level, action_t action)
68 detail::StreamBase const * s (StreamRegistry::instance().lookup(stream));
70 throw InvalidStreamException();
71 detail::AreaBase const * a (AreaRegistry::instance().lookup(area));
73 throw InvalidAreaException();
74 route(s, a, level, action);
77 ////////////////////////////////////////
80 prefix_ void senf::log::Target::route(detail::StreamBase const * stream,
81 detail::AreaBase const * area, unsigned level,
84 rib_.push_back(RoutingEntry(stream, area, level, action));
86 updateRoutingCache(stream, area);
89 prefix_ void senf::log::Target::unroute(detail::StreamBase const * stream,
90 detail::AreaBase const * area, unsigned level,
93 rib_.erase(std::remove(rib_.begin(), rib_.end(), RoutingEntry(stream, area, level, action)),
96 updateRoutingCache(stream, area);
99 ///////////////////////////////////////////////////////////////////////////
100 // senf::log::Target::RoutingEntry
102 prefix_ senf::log::Target::RoutingEntry::RoutingEntry(detail::StreamBase const * stream_,
103 detail::AreaBase const * area_,
104 unsigned level_, action_t action_)
105 : stream(stream_), area(area_), level(level_), action(action_)
108 prefix_ senf::log::Target::RoutingEntry::RoutingEntry()
109 : stream(0), area(0), level(0), action(ACCEPT)
112 prefix_ bool senf::log::Target::RoutingEntry::operator==(RoutingEntry const & other)
115 stream == other.stream &&
116 area == other.area &&
117 level == other.level &&
118 action == other.action;
121 ///////////////////////////////////////////////////////////////////////////
122 // senf::log::TargetRegistry
124 prefix_ void senf::log::TargetRegistry::registerTarget(Target * target)
126 targets_.insert(target);
129 prefix_ void senf::log::TargetRegistry::unregisterTarget(Target * target)
131 targets_.erase(target);
134 /////////////////////////////cci.e///////////////////////////////////////
141 // comment-column: 40
142 // c-file-style: "senf"
143 // indent-tabs-mode: nil
144 // ispell-local-dictionary: "american"
145 // compile-command: "scons -u test"