// $Id: EsafMsg.hh,v 1.8 2005/01/15 16:56:58 thea Exp $ // M. Pallavicini created Sep, 24 2004 /***************************************************************************** * ESAF: Euso Simulation and Analysis Framework * * * * Id: EsafMsg * * Package: Base * * Coordinator: Marco.Pallavicini * * * *****************************************************************************/ #ifndef __ESAFMSG_HH__ #define __ESAFMSG_HH__ #include "euso.hh" #include #include // // The following definitions are needed to compile EsafMsg in the Lyon CC gcc // 2.96 environment, where ostrstream and strstreambase are not defined. // #if ( __GNUC__ < 3 ) #ifndef __MAKECINT__ typedef ostringstream ostrstream; typedef stringstreambase strstreambase; #endif /*__MAKECINT__*/ #endif //////////////////////////////////////////////////////////////////////////////// // // // EsafMsg // // // // ESAF Message // // // //////////////////////////////////////////////////////////////////////////////// class EsafMsg : public ostringstream { public: enum MsgSeverity { Debug=1, Info=2, Warning=3, Panic=4, None=100 }; EsafMsg(); // constructor EsafMsg( const EsafMsg& ); // copy constructor EsafMsg(MsgSeverity, const string&, const string&); virtual ~EsafMsg(); void Copy( EsafMsg& ) const; EsafMsg& operator=(const EsafMsg& ); inline void SetSeverity(MsgSeverity svr) { fSeverity = svr; } inline void SetSender(const string& snd) { fSender = snd; } inline void SetText(const string& txt) { str(txt); } inline MsgSeverity GetSeverity() const { return fSeverity;} inline const string GetSender() const { return fSender; } inline const string GetText() const { return str(); } void Clear(); void Dispatch(); void Flush(); private: MsgSeverity fSeverity; string fSender; ClassDef(EsafMsg,0) }; inline std::ostream& MsgDispatch(ostream& os) { // function to allow syntax: msg << "bla bla" << MsgDispatch; (dynamic_cast(os)).Dispatch(); return os; } inline std::ostream& MsgFlush(ostream& os) { // function to allow syntax: msg << "bla bla" << MsgDispatch; (dynamic_cast(os)).Flush(); return os; } #endif /* __ESAFMSG_HH__ */