00001 00016 #ifndef _NOTIFIER_H 00017 #define _NOTIFIER_H 00018 00019 #include <iostream> 00020 #include <string> 00021 00022 // Comment out following line, if boost library is not available. 00023 // Progress bar display is based on boost "progress" library. It's not 00024 // necessary to have progress bar displayed - it's just comfortable. 00025 #define _BOOST_ON 00026 00027 #ifdef _BOOST_ON 00028 #include <boost/progress.hpp> 00029 #endif 00030 00031 namespace ace { 00032 00033 #ifdef _BOOST_ON 00034 00036 typedef boost::progress_display progress_display_t; 00037 #endif 00038 00042 class Notifier { 00043 protected: 00047 std::ostream& _output; 00048 public: 00052 Notifier(std::ostream& output): _output(output) {} 00056 void fatal_error(const std::string& message) const; 00060 void info(const std::string& message) const; 00063 inline std::ostream& output_stream(void) { return _output; } 00067 void warning(const std::string& message) const; 00068 }; 00069 00075 class ProgressNotifier: public Notifier { 00076 #ifdef _BOOST_ON 00077 00079 static boost::progress_timer _timer; // static - so starts timing immediately 00080 #endif 00081 public: 00085 ProgressNotifier(std::ostream& output): Notifier(output) {} 00089 void elapsed(const std::string& message) const; 00090 }; 00091 00094 void print_usage(void); 00095 00099 namespace notifier { 00100 00103 extern Notifier error; 00106 extern ProgressNotifier progress; 00107 00108 } // namespace notifier 00109 00110 } // namespace ace 00111 00112 #endif
1.5.6