LAMA
/home/brandes/workspace/LAMA/src/lama/solver/creator/LoggerCreator.hpp
Go to the documentation of this file.
00001 
00034 #ifndef LAMA_LOGGERCREATOR_HPP_
00035 #define LAMA_LOGGERCREATOR_HPP_
00036 
00037 // for dll_import
00038 #include <lama/config.hpp>
00039 
00040 // others
00041 #include <lama/LAMATypes.hpp>
00042 
00043 // assert
00044 #include <lama/exception/LAMAAssert.hpp>
00045 
00046 #include <logging/logging.hpp>
00047 
00048 //Timer
00049 #include <lama/solver/logger/OpenMPTimer.hpp>
00050 
00051 //Logger
00052 #include <lama/solver/logger/CommonLogger.hpp>
00053 #include <lama/solver/logger/FileLogger.hpp>
00054 
00055 // boost
00056 #include <boost/spirit/include/qi.hpp>
00057 #include <boost/variant.hpp>
00058 
00059 #include <string>
00060 #include <ostream>
00061 
00062 namespace lama
00063 {
00064 
00065 namespace qi = boost::spirit::qi;
00066 namespace ascii = boost::spirit::ascii;
00067 
00068 class LAMA_DLL_IMPORTEXPORT LoggerCreator
00069 {
00070 public:
00071     typedef qi::rule<std::string::const_iterator, LoggerPtr(), ascii::space_type> RuleType;
00072     typedef qi::symbols<char, LoggerPtr > LoggerInstanceMap;
00073 
00074     static RuleType& getSolverBoundRule();
00075 
00076     static qi::rule<std::string::const_iterator, void(), ascii::space_type>& getIndependentRule();
00077 
00078 protected:
00079     LAMA_LOG_DECL_STATIC_LOGGER(logger);
00080 
00081 private:
00082     static LoggerCreator& getInstance();
00083 
00090     void addLogger( const std::string& name, LoggerPtr logger );
00091 
00092     qi::symbols<char, LogLevel::LogLevel> mLogLevel;
00093     qi::symbols<char, LoggerWriteBehaviour::LoggerWriteBehaviour> mWriteBehaviour;
00094 
00095     qi::rule<std::string::const_iterator, std::string(), ascii::space_type> mRLoggerName;
00096     qi::rule<std::string::const_iterator, std::string(), ascii::space_type> mRFileName;
00097     qi::rule<std::string::const_iterator, Timer*(), ascii::space_type> mRTimer;
00098 
00099     RuleType mRSolverBoundLogger;
00100     qi::rule<std::string::const_iterator, std::string(), ascii::space_type> mRId;
00101     qi::rule<std::string::const_iterator, void(), ascii::space_type> mRIndependentLogger;
00102     qi::rule<std::string::const_iterator, Logger*(), ascii::space_type> mRCommonLogger;
00103     qi::rule<std::string::const_iterator, Logger*(), ascii::space_type> mRFileLogger;
00104 
00105     LoggerInstanceMap mLoggerInstanceMap;
00106 
00107     LoggerCreator();
00108 };
00109 
00110 } // namespace lama
00111 
00112 #endif // LAMA_LOGGERCREATOR_HPP_