00001
00007 #ifndef _QAPOLLOMESSENGER_HH_
00008 #define _QAPOLLOMESSENGER_HH_
00009
00010 #include <sstream>
00011
00012
00013 #include "QCuore.hh"
00014 #include "QMessageDefs.hh"
00015 #include "QDaqCommonDefs.hh"
00016
00017 class QError;
00018 class QMsgClient;
00019
00020 class QApolloMessenger : public std::ostringstream
00021 {
00022
00023 public:
00024
00026 static QApolloMessenger& GetInstance();
00027
00029 virtual ~QApolloMessenger();
00030
00035 virtual void Send(MsgLevel severity=InfoMsg);
00036
00037 const std::string& GetName() const { return fName; }
00038
00044 virtual void SendStatus(ProcessStatus_t status);
00045
00053 bool SetName(const std::string& name, bool force);
00054
00061 void AllowStdOut(bool allow) { fAllowStdOut = allow;}
00062
00063 private:
00065 QApolloMessenger();
00066
00068 void RegisterProcess();
00069
00071 void UnregisterProcess();
00072
00076 bool fRegistered;
00081 bool fAllowStdOut;
00082
00083 bool fUseStdOut;
00084
00089 const int fOutputFD;
00090
00091 std::string fName;
00092
00093 QMsgClient* fClient;
00094
00095 bool IsNetworkError(const QError& err) const;
00096
00097 void UseStdOut();
00098 };
00099
00100 #endif // _QAPOLLOMESSENGER_HH_