Utils/Logger: Remove dependency on libboost_datetime
[senf.git] / Utils / Logger / AreaRegistry.ih
index 362c3f6..a3b6124 100644 (file)
@@ -1,8 +1,8 @@
 // $Id$
 //
-// Copyright (C) 2007 
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
 //     Stefan Bund <g0dil@berlios.de>
 //
 // This program is free software; you can redistribute it and/or modify
 // Custom includes
 #include <string>
 #include <vector>
+#include <list>
+#include "Levels.hh"
+#include "TimeSource.hh"
 
 ///////////////////////////////ih.p////////////////////////////////////////
 
 namespace senf {
 namespace log {
+
+    class Target;
+
 namespace detail {
 
     class StreamBase;
@@ -48,13 +54,26 @@ namespace detail {
 
         void init();
 
-        unsigned streamLimit(StreamBase const & stream) const;
-        void setStreamLimit(StreamBase const & stream, unsigned value) const;
+        unsigned limit(StreamBase const & stream) const;
+        void updateRoutingCache(Target & target, StreamBase const & stream, unsigned limit) const; 
+        void removeRoutingCache(Target & target, StreamBase const & stream) const; 
+        void write(time_type timestamp, StreamBase const & stream, unsigned level,
+              std::string msg) const;
 
     private:
-        typedef std::vector<unsigned> StreamLimits;
-        // mutable since this is a cache and may therefore change at unexpected places ...
-        mutable StreamLimits streamLimits_;
+        struct RouteEntry {
+            RouteEntry(unsigned limit_, Target * target_) : limit(limit_), target(target_) {}
+            unsigned limit;
+            Target * target;
+        };
+        typedef std::list<RouteEntry> Routes;
+        struct CacheEntry {
+            CacheEntry() : limit (DISABLED::value), routes() {}
+            unsigned limit;
+            Routes routes;
+        };
+        typedef std::vector<CacheEntry> RoutingCache;
+        mutable RoutingCache routingCache_;
     };
 
 }}}