4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer NETwork research (NET)
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 template implementation */
31 #define prefix_ inline
32 ///////////////////////////////cti.p///////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////////////
37 // senf::log::Target::route
41 template <class Stream>
42 prefix_ void senf::log::Target::route(action_t action, int index)
44 route(&Stream::instance(), 0, NONE::value, action, index);
47 template <class Stream, class Level>
48 prefix_ void senf::log::Target::
49 route(action_t action, int index,
50 typename boost::enable_if< boost::is_convertible<Level*, detail::LevelBase *> >::type *)
52 route(&Stream::instance(), 0, Level::value, action, index);
55 template <class Stream, class Area>
56 prefix_ void senf::log::Target::
57 route(action_t action, int index,
58 typename boost::enable_if< boost::is_convertible<Area*, detail::AreaBase *> >::type *)
60 route(&Stream::instance(), &Area::instance(), NONE::value, action, index);
63 template <class Stream, class AreaClass>
64 prefix_ void senf::log::Target::
65 route(action_t action, int index,
66 typename boost::enable_if< boost::is_convertible<typename AreaClass::SENFLogArea *, detail::AreaBase *> >::type *)
68 route(&Stream::instance(), &AreaClass::SENFLogArea::instance(), NONE::value, action, index);
71 template <class Stream, class Area, class Level>
72 prefix_ void senf::log::Target::
73 route(action_t action, int index,
74 typename boost::enable_if< boost::is_convertible<Area *, detail::AreaBase *> >::type *)
76 route(&Stream::instance(), &Area::instance(), Level::value, action, index);
79 template <class Stream, class AreaClass, class Level>
80 prefix_ void senf::log::Target::
81 route(action_t action, int index,
82 typename boost::enable_if< boost::is_convertible<typename AreaClass::SENFLogArea *, detail::AreaBase *> >::type *)
84 route(&Stream::instance(), &AreaClass::SENFLogArea::instance(), Level::value, action, index);
87 // senf::log::target::ununroute
89 template <class Stream>
90 prefix_ void senf::log::Target::unroute(action_t action)
92 unroute(&Stream::instance(), 0, NONE::value, action);
95 template <class Stream, class Level>
96 prefix_ void senf::log::Target::
97 unroute(action_t action,
98 typename boost::enable_if< boost::is_convertible<Level*, detail::LevelBase *> >::type *)
100 unroute(&Stream::instance(), 0, Level::value, action);
103 template <class Stream, class Area>
104 prefix_ void senf::log::Target::
105 unroute(action_t action,
106 typename boost::enable_if< boost::is_convertible<Area*, detail::AreaBase *> >::type *)
108 unroute(&Stream::instance(), &Area::instance(), NONE::value, action);
111 template <class Stream, class AreaClass>
112 prefix_ void senf::log::Target::
113 unroute(action_t action,
114 typename boost::enable_if< boost::is_convertible<typename AreaClass::SENFLogArea *, detail::AreaBase *> >::type *)
116 unroute(&Stream::instance(), &AreaClass::SENFLogArea::instance(), NONE::value, action);
119 template <class Stream, class Area, class Level>
120 prefix_ void senf::log::Target::
121 unroute(action_t action,
122 typename boost::enable_if< boost::is_convertible<Area *, detail::AreaBase *> >::type *)
124 unroute(&Stream::instance(), &Area::instance(), Level::value, action);
127 template <class Stream, class AreaClass, class Level>
128 prefix_ void senf::log::Target::
129 unroute(action_t action,
130 typename boost::enable_if< boost::is_convertible<typename AreaClass::SENFLogArea *, detail::AreaBase *> >::type *)
132 unroute(&Stream::instance(), &AreaClass::SENFLogArea::instance(), Level::value, action);
137 ///////////////////////////////////////////////////////////////////////////
138 // namespace senf::log::detail members
140 template <class Stream, class Area, class Level>
141 prefix_ void senf::log::detail::write(std::string msg)
143 TargetRegistry::instance().write(Stream::instance(), Area::instance(), Level::value, msg);
146 template <class Source>
147 prefix_ void senf::log::timeSource()
149 timeSource(std::auto_ptr<Source>(new Source()));
152 ///////////////////////////////cti.e///////////////////////////////////////
159 // comment-column: 40
160 // c-file-style: "senf"
161 // indent-tabs-mode: nil
162 // ispell-local-dictionary: "american"
163 // compile-command: "scons -u test"