X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FLogger%2FStream.hh;h=d30d2ca816bc92f056ce0eb8a56966a873d2c474;hb=54eed72c506b09ef5b4be0b62fecedfbc0e3f261;hp=b4bab9797064dceb0a64d3bdaa4aaf8d98a3ddcc;hpb=b52002fa2001e6472d6aa3dde263b85f654c6e8e;p=senf.git diff --git a/Utils/Logger/Stream.hh b/Utils/Logger/Stream.hh index b4bab97..d30d2ca 100644 --- a/Utils/Logger/Stream.hh +++ b/Utils/Logger/Stream.hh @@ -27,10 +27,13 @@ #define HH_Stream_ 1 // Custom includes +#include +#include +#include #include "Levels.hh" +#include "../singleton.hh" //#include "Stream.mpp" -#include "Stream.ih" ///////////////////////////////hh.p//////////////////////////////////////// /** \brief Define log stream @@ -47,18 +50,57 @@ */ #define SENF_LOG_DEF_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_) \ struct stream \ - : public senf::log::detail::StreamBase \ + : public senf::log::detail::StreamBase, public senf::singleton \ { \ typedef defaultLevel_ defaultLevel; \ typedef runtimeLimit_ runtimeLimit; \ typedef compileLimit_ compileLimit; \ - \ - static char const * name() { return #stream ; } \ - virtual char const * v_name() { return name(); } \ + static std::string name() { return instance().v_name(); } \ + private: \ + stream() { init(); } \ + friend class senf::singleton; \ } -///////////////////////////////hh.e//////////////////////////////////////// -//#include "Stream.cci" +namespace senf { +namespace log { + + namespace detail { struct StreamBase; } + + class StreamRegistry + : public senf::singleton + { + typedef std::map Registry; + + struct SelectName + { + typedef std::string result_type; + std::string const & operator()(Registry::value_type const & v) const; + }; + + public: + typedef boost::transform_iterator iterator; + + using senf::singleton::instance; + + iterator begin(); + iterator end(); + + private: + StreamRegistry(); + + void registerStream(detail::StreamBase const & stream); + + Registry registry_; + + friend class senf::singleton; + friend class detail::StreamBase; + friend class Target; + }; + +}} + +///////////////////////////////hh.e////////////////////////////////////////# +#include "Stream.cci" //#include "Stream.ct" //#include "Stream.cti" #endif