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.hh

Go to the documentation of this file.
00001 // $Id: AreaRegistry.hh 1757 2011-01-06 16:52:09Z tho $
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 HH_SENF_Utils_Logger_AreaRegistry_
00027 #define HH_SENF_Utils_Logger_AreaRegistry_ 1
00028 
00029 // Custom includes
00030 #include <map>
00031 #include <boost/iterator/transform_iterator.hpp>
00032 #include <senf/Utils/singleton.hh>
00033 
00034 //#include "AreaRegistry.mpp"
00035 #include "AreaRegistry.ih"
00036 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00037 
00038 namespace senf {
00039 namespace log {
00040 
00041     namespace detail { struct AreaBase; }
00042 
00053     class AreaRegistry
00054         : public senf::singleton<AreaRegistry>
00055     {
00056         typedef std::map<std::string, detail::AreaBase const *> Registry;
00057 
00058         struct SelectName
00059         {
00060             typedef std::string result_type;
00061             std::string const & operator()(Registry::value_type const & v) const;
00062         };
00063 
00064     public:
00065         typedef boost::transform_iterator<SelectName, Registry::const_iterator> iterator;
00067 
00068 #       ifdef DOXYGEN
00069         // Hmm ... doxygen does not understand using declarations ...
00071         static AreaRegistry & instance();
00072 #       endif
00073 
00074         using senf::singleton<AreaRegistry>::instance;
00075 
00076         iterator begin();               
00077         iterator end();                 
00078 
00079         detail::AreaBase const * lookup(std::string const & name);
00080 
00081     private:
00082         AreaRegistry();
00083 
00084         void registerArea(detail::AreaBase const & area);
00085 
00086         Registry registry_;
00087 
00088         friend class senf::singleton<AreaRegistry>;
00089         friend class detail::AreaBase;
00090         friend class Target;
00091     };
00092 
00093 }}
00094 
00095 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00096 #include "AreaRegistry.cci"
00097 //#include "AreaRegistry.ct"
00098 //#include "AreaRegistry.cti"
00099 #endif
00100 
00101 
00102 // Local Variables:
00103 // mode: c++
00104 // fill-column: 100
00105 // comment-column: 40
00106 // c-file-style: "senf"
00107 // indent-tabs-mode: nil
00108 // ispell-local-dictionary: "american"
00109 // compile-command: "scons -u test"
00110 // End:

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