00001 00002 #ifndef _QAPOLLOMESSENGER_HH_ 00003 #define _QAPOLLOMESSENGER_HH_ 00004 00005 #include <sstream> 00006 00007 // Apollo Includes 00008 #include "QCuore.hh" 00009 #include "QMessageDefs.hh" 00010 #include "QDaqCommonDefs.hh" 00011 00012 class QError; 00013 class QMsgClient; 00014 00021 class QApolloMessenger : public std::ostringstream 00022 { 00023 00024 public: 00025 00027 static QApolloMessenger& GetInstance(); 00028 00030 virtual ~QApolloMessenger(); 00031 00036 virtual void Send(MsgLevel severity=InfoMsg); 00037 00038 const std::string& GetName() const { return fName; } 00039 00045 virtual void SendStatus(QDaqCommonDefs::ProcessStatus_t status); 00046 00054 bool SetName(const std::string& name, bool force); 00055 00062 void AllowStdOut(bool allow) { fAllowStdOut = allow;} 00063 00064 private: 00066 QApolloMessenger(); 00067 00069 void RegisterProcess(); 00070 00072 void UnregisterProcess(); 00073 00077 bool fRegistered; 00082 bool fAllowStdOut; 00083 00084 bool fUseStdOut; 00085 00090 const int fOutputFD; 00091 00092 std::string fName; 00093 00094 QMsgClient* fClient; 00095 00096 bool IsNetworkError(const QError& err) const; 00097 00098 void UseStdOut(); 00099 }; 00100 00101 #endif // _QAPOLLOMESSENGER_HH_