logger_level.hpp

Go to the documentation of this file.
00001 // -*- mode: c++; indent-tabs-mode: nil; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2006, Tim Robertson <kid50@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details.
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License
00018 //along with this program; if not, write to the Free Software Foundation,
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00023 
00024 #ifndef BTK_IO_LOGGER_LEVEL_HPP
00025 #define BTK_IO_LOGGER_LEVEL_HPP
00026 
00027 namespace BTK {
00028 namespace IO {
00029 namespace LOGGING {
00030 
00057 class LoggerLevel
00058 {
00059  public:
00061   LoggerLevel() : _lvl(0), _src(0) {}
00062   
00064   LoggerLevel(unsigned l,unsigned s) : _lvl(l), _src(s) {}
00065 
00067   const LoggerLevel operator|(LoggerLevel const & rhs) const
00068   {
00069     return LoggerLevel((_lvl | rhs._lvl), (_src | rhs._src));
00070   }
00071 
00073   const LoggerLevel operator&(LoggerLevel const & rhs) const
00074   {
00075     return LoggerLevel((_lvl & rhs._lvl), (_src & rhs._src));
00076   }
00077 
00079   operator bool() const 
00080   { 
00081     return (static_cast<bool>(_lvl) && static_cast<bool>(_src)); 
00082   }
00083 
00084 private:
00085   unsigned _lvl;
00086   unsigned _src;
00087 };
00088 
00089 const unsigned ALL(static_cast<unsigned>(-1));
00090 
00092 
00093 static const LoggerLevel ERROR(1,ALL); 
00094 static const LoggerLevel WARNING(2,ALL); 
00095 static const LoggerLevel TRACE(4,ALL); 
00096 static const LoggerLevel DEBUG(8,ALL); 
00097 
00098 static const LoggerLevel ALL_LEVELS(ALL,ALL); 
00099 
00100 
00102 
00103 static const LoggerLevel ATOMS(ALL,1); 
00104 static const LoggerLevel CONTAINERS(ALL,2); 
00105 static const LoggerLevel ITERATORS(ALL,4); 
00106 static const LoggerLevel ALGORITHMS(ALL,8); 
00107 static const LoggerLevel IO(ALL,16);  
00108 static const LoggerLevel MATH(ALL,32); 
00109 static const LoggerLevel UTILITY(ALL,64); 
00110 
00111 static const LoggerLevel ALL_SOURCES(ALL,ALL); 
00112 
00113 
00115 static const LoggerLevel NOTHING(0,0);
00116 
00118 static const LoggerLevel EVERYTHING(ALL,ALL);
00119 
00120 } // LOGGING
00121 } // IO
00122 } // BTK
00123 
00124 #endif 

Generated on Sun Jul 15 20:46:25 2007 for BTK Core by  doxygen 1.5.1