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

Definitions.hh

Go to the documentation of this file.
00001 // $Id: Definitions.hh 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 HH_SENF_Utils_Logger_Definitions_
00027 #define HH_SENF_Utils_Logger_Definitions_ 1
00028 
00029 // Custom includes
00030 
00031 //#include "Definitions.mpp"
00032 #include "Definitions.ih"
00033 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00034 
00035 namespace senf {
00036 namespace log {
00037 
00039     //\{
00041     //\{
00042 
00059 #   define SENF_LOG_DEFINE_STREAM(stream, defaultLevel_, runtimeLimit_, compileLimit_)            \
00060         struct stream                                                                             \
00061             : public senf::log::detail::StreamBase, public senf::singleton<stream>                \
00062         {                                                                                         \
00063             typedef defaultLevel_ defaultLevel;                                                   \
00064             typedef runtimeLimit_ runtimeLimit;                                                   \
00065             typedef compileLimit_ compileLimit;                                                   \
00066             static std::string name() { return instance().v_name(); }                             \
00067             unsigned defaultRuntimeLimit() const { return runtimeLimit::value; }                  \
00068             using senf::singleton<stream>::instance;                                              \
00069         private:                                                                                  \
00070             stream() { init(); }                                                                  \
00071             friend class senf::singleton<stream>;                                                 \
00072         }
00073 
00080 #   define SENF_LOG_DEFINE_AREA(area) SENF_LOG_DEFINE_AREA_I(area, ; )
00081 
00089     // See Definitions.ih for implementation details on SENF_LOG_CLASS_AREA
00090 #   define SENF_LOG_CLASS_AREA()                                                                  \
00091         SENF_LOG_DEFINE_AREA_I(                                                                   \
00092             SENFLogArea,                                                                          \
00093             std::string v_name() const                                                            \
00094                 { std::string s (fullName()); return std::string(s,0,s.size()-13); });            \
00095         SENF_LOG_DEFAULT_AREA(SENFLogArea)
00096 
00097 
00105 #   define SENF_LOG_DEFINE_ALIAS(alias,args)                                                      \
00106         struct alias : public senf::log::detail::AliasBase                                        \
00107         {                                                                                         \
00108             template <class Base>                                                                 \
00109             struct apply                                                                          \
00110             {                                                                                     \
00111                 typedef typename SENF_LOG_MERGE_PARAMETERS_I(Base,args) type;                     \
00112             };                                                                                    \
00113         }
00114 
00116     SENF_LOG_DEFINE_STREAM(Debug, MESSAGE, MESSAGE, NOTICE);
00117 
00119     SENF_LOG_DEFINE_AREA(DefaultArea);
00120 
00121     //\}
00122     //\}
00123 
00124 }}
00125 
00126 //-/////////////////////////////////////////////////////////////////////////////////////////////////
00127 //#include "Definitions.cci"
00128 //#include "Definitions.ct"
00129 //#include "Definitions.cti"
00130 #endif
00131 
00132 
00133 // Local Variables:
00134 // mode: c++
00135 // fill-column: 100
00136 // comment-column: 40
00137 // c-file-style: "senf"
00138 // indent-tabs-mode: nil
00139 // ispell-local-dictionary: "american"
00140 // compile-command: "scons -u test"
00141 // End:

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