GazeboMessage.hh
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef GAZEBOMESSAGE_HH
00029 #define GAZEBOMESSAGE_HH
00030
00031 #include <iostream>
00032 #include <fstream>
00033 #include <string>
00034 #include <sstream>
00035
00036 namespace gazebo
00037 {
00038
00042
00044 #define gzmsg(level) (gazebo::GazeboMessage::Instance()->Msg(level) << "[" << __FILE__ << ":" << __LINE__ << "]\n ")
00045
00046 #define gzerr(level) (gazebo::GazeboMessage::Instance()->Err(level) << "Error: [" << __FILE__ << ":" << __LINE__ << "]\n ")
00047
00049 #define gzlog() (gazebo::GazeboMessage::Instance()->Log() << "[" << __FILE__ << ":" << __LINE__ << "] ")
00050
00051 class XMLConfigNode;
00052
00055
00066 class GazeboMessage
00067 {
00069 public: GazeboMessage();
00070
00072 public: virtual ~GazeboMessage();
00073
00075 public: static GazeboMessage *Instance();
00076
00078 public: void Load(XMLConfigNode *node);
00079
00081 public: void Save(XMLConfigNode *node);
00082
00085 public: void SetVerbose( int level );
00086
00089 public: std::ostream &Msg( int level = 0 );
00090
00093 public: std::ostream &Err( int level = 0 );
00094
00096 public: std::ofstream &Log();
00097
00099 private: int level;
00100
00102 private: bool logData;
00103
00104 private: std::ostringstream nullStream;
00105 private: std::ostream *msgStream;
00106 private: std::ostream *errStream;
00107 private: std::ofstream logStream;
00108
00110 private: static GazeboMessage *myself;
00111 };
00112
00114 }
00115
00116 #endif