BusBoy  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AlgorithmContext.h
Go to the documentation of this file.
1 
17 #ifndef __BUSBOY_ALGORITHM_CONTEXT_H__
18 #define __BUSBOY_ALGORITHM_CONTEXT_H__
19 
20 #include <string>
21 #include <sstream>
22 #include "context/Logger.h"
25 
32 #define BUSBOY_ALGO_LOG_CPP(context, level, msg) { \
33  std::ostringstream _ss; \
34  _ss << msg; \
35  (context).log( __FILE__, __LINE__, level, _ss.str()); \
36 }
37 
44 #define BUSBOY_ALGO_LOG_C(context, level, format, args...) { \
45  (context).log( __FILE__, __LINE__, level, format, ##args); \
46 }
47 
48 namespace BUSBOY {
49 
50 class AlgorithmContextImpl;
51 
59 
60  public:
61 
62  AlgorithmContext(const std::string& name);
63 
67  void log(Logger::LogLevel level, const char* format, ...);
68 
72  void log(const std::string& file, int line, Logger::LogLevel level, const char* format, ...);
73 
77  void log(Logger::LogLevel level, const std::string& msg);
78 
82  void log( const std::string& file, int line, Logger::LogLevel level, const std::string& msg);
83 
87  void progress(float percentDone, const char* format, ...);
88 
92  void progress(float percentDone, const std::string& msg);
93 
97  void registerLogger(Logger* logger);
98 
103 
108  std::string createTempDirectory();
109 
114  void sendMessage(const Message& msg);
115 
120 
122 
123  private:
124 
125  AlgorithmContextImpl* m_impl;
126 
127  // prevent calling these
128  AlgorithmContext(const AlgorithmContext& context);
129  AlgorithmContext& operator=(const AlgorithmContext& context);
130 
131 };
132 
133 }
134 
135 #endif

Copyright 2014 Google Inc. All rights reserved.