Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Target.cci

Go to the documentation of this file.
00001 // $Id: Target.cci 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00026 #include "Target.ih"
00027 
00028 // Custom includes
00029 #include "AreaRegistry.hh"
00030 
00031 #define prefix_ inline
00032 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00033 
00034 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00035 // senf::log::Target
00036 
00037 prefix_ void senf::log::Target::route(action_t action, int index)
00038 {
00039     route(0, 0, NONE::value, action, index);
00040 }
00041 
00042 prefix_ void senf::log::Target::unroute(action_t action)
00043 {
00044     unroute(0, 0, NONE::value, action);
00045 }
00046 
00047 prefix_ senf::log::Target::iterator senf::log::Target::begin()
00048     const
00049 {
00050     return rib_.begin();
00051 }
00052 
00053 prefix_ senf::log::Target::iterator senf::log::Target::end()
00054     const
00055 {
00056     return rib_.end();
00057 }
00058 
00059 prefix_ senf::log::Target::RoutingEntry const & senf::log::Target::operator[](size_type i)
00060     const
00061 {
00062     return rib_[i];
00063 }
00064 
00065 prefix_ senf::log::Target::size_type senf::log::Target::size()
00066     const
00067 {
00068     return rib_.size();
00069 }
00070 
00071 prefix_ bool senf::log::Target::empty()
00072     const
00073 {
00074     return rib_.empty();
00075 }
00076 
00077 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00078 // senf::log::Target::RoutingEntry
00079 
00080 prefix_ senf::log::Target::RoutingEntry::RoutingEntry(detail::StreamBase const * stream,
00081                                                       detail::AreaBase const * area,
00082                                                       unsigned level, action_t action)
00083     : stream_(stream), area_(area), level_(level), action_(action)
00084 {}
00085 
00086 prefix_ senf::log::Target::RoutingEntry::RoutingEntry()
00087     : stream_(0), area_(0), level_(0), action_(ACCEPT)
00088 {}
00089 
00090 prefix_ bool senf::log::Target::RoutingEntry::operator==(RoutingEntry const & other)
00091     const
00092 {
00093     return
00094         stream_ == other.stream_ &&
00095         area_ == other.area_ &&
00096         level_ == other.level_ &&
00097         action_ == other.action_;
00098 }
00099 
00100 prefix_ std::string senf::log::Target::RoutingEntry::stream()
00101     const
00102 {
00103     return stream_ ? stream_->v_name() : "";
00104 }
00105 
00106 prefix_ std::string senf::log::Target::RoutingEntry::area()
00107     const
00108 {
00109     return area_ ? area_->v_name() : "";
00110 }
00111 
00112 prefix_ unsigned senf::log::Target::RoutingEntry::level()
00113     const
00114 {
00115     return level_;
00116 }
00117 
00118 prefix_ senf::log::Target::action_t senf::log::Target::RoutingEntry::action()
00119     const
00120 {
00121     return action_;
00122 }
00123 
00124 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00125 // senf::log::detail::TargetRegistry
00126 
00127 prefix_ void senf::log::detail::TargetRegistry::routed()
00128 {
00129     fallbackRouting_ = false;
00130 }
00131 
00132 prefix_ bool senf::log::detail::TargetRegistry::fallbackRouting()
00133 {
00134     return fallbackRouting_;
00135 }
00136 
00137 prefix_ senf::console::ScopedDirectory<> & senf::log::detail::TargetRegistry::consoleDir()
00138 {
00139     return consoleDir_();
00140 }
00141 
00142 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00143 // private members
00144 
00145 prefix_ void senf::log::detail::TargetRegistry::unregisterTarget(Target * target)
00146 {
00147     targets_.erase(target);
00148 }
00149 
00150 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00151 #undef prefix_
00152 
00153 
00154 // Local Variables:
00155 // mode: c++
00156 // fill-column: 100
00157 // comment-column: 40
00158 // c-file-style: "senf"
00159 // indent-tabs-mode: nil
00160 // ispell-local-dictionary: "american"
00161 // compile-command: "scons -u test"
00162 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research