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

AreaRegistry.ih

Go to the documentation of this file.
00001 // $Id: AreaRegistry.ih 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 #ifndef IH_SENF_Utils_Logger_AreaRegistry_
00027 #define IH_SENF_Utils_Logger_AreaRegistry_ 1
00028 
00029 // Custom includes
00030 #include <string>
00031 #include <vector>
00032 #include <list>
00033 #include "Levels.hh"
00034 #include "TimeSource.hh"
00035 
00036 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00037 
00038 namespace senf {
00039 namespace log {
00040 
00041     class Target;
00042 
00043 namespace detail {
00044 
00045     class StreamBase;
00046 
00048     struct AreaBase
00049     {
00050         AreaBase();
00051         virtual ~AreaBase();
00052 
00053         std::string fullName() const;
00054         virtual std::string v_name() const;
00055 
00056         void init();
00057         bool alive() const;
00058 
00059         unsigned limit(StreamBase const & stream) const;
00060         void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const;
00061         void removeRoutingCache(Target & target, StreamBase const & stream) const;
00062         void write(time_type timestamp, StreamBase const & stream, unsigned level,
00063                    std::string const & msg) const;
00064 
00065     private:
00066         struct RouteEntry {
00067             RouteEntry(unsigned limit_, Target * target_) : limit(limit_), target(target_) {}
00068             unsigned limit;
00069             Target * target;
00070         };
00071         typedef std::list<RouteEntry> Routes;
00072         struct CacheEntry {
00073             CacheEntry() : limit (DISABLED::value), routes() {}
00074             unsigned limit;
00075             Routes routes;
00076         };
00077         typedef std::vector<CacheEntry> RoutingCache;
00078         mutable RoutingCache routingCache_;
00079         bool alive_;
00080     };
00081 
00082 }}}
00083 
00084 
00085 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00086 #endif
00087 
00088 
00089 // Local Variables:
00090 // mode: c++
00091 // fill-column: 100
00092 // comment-column: 40
00093 // c-file-style: "senf"
00094 // indent-tabs-mode: nil
00095 // ispell-local-dictionary: "american"
00096 // compile-command: "scons -u test"
00097 // End:

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