source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/common/base/include/EsafMsgSource.hh @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 2.3 KB
Line 
1// $Id: EsafMsgSource.hh 2804 2008-10-09 12:10:06Z biktem $
2// Author: M. Pallavicini    Sep, 24 2004
3
4/*****************************************************************************
5 * ESAF: Euso Simulation and Analysis Framework                              *
6 *                                                                           *
7 *  Id: EsafMsgSource                                                        *
8 *  Package: Base                                                            *
9 *  Coordinator: Marco.Pallavicini                                           *
10 *                                                                           *
11 *****************************************************************************/
12
13#ifndef __ESAFMSGSOURCE_HH_
14#define __ESAFMSGSOURCE_HH_
15
16#include <string>
17#include "euso.hh"
18#include "EsafMsg.hh"
19
20////////////////////////////////////////////////////////////////////////////////
21//                                                                            //
22// EsafMsgSource                                                              //
23//                                                                            //
24// ESAF Message Source                                                        //
25//                                                                            //
26////////////////////////////////////////////////////////////////////////////////
27
28class EsafMsgSource {
29protected:
30
31    EsafMsgSource();
32    // default ctor
33
34    EsafMsgSource(const EsafMsgSource& );
35
36public:
37    virtual ~EsafMsgSource() {}
38    // dtor
39
40    EsafMsg& Msg( EsafMsg::MsgSeverity ) const;
41    // prepare message and returns it for writing
42
43    void MsgForm( EsafMsg::MsgSeverity, const char *fmt, ...) const;
44//     void MsgForm( EsafMsg::MsgSeverity, const char *fmt) const;
45    // prepare and send a message with printf syntax
46
47    inline void Dispatch() const { fMsg.Dispatch(); }
48    // dispatch message
49
50    inline void FatalError( const string& ) const;
51
52    inline void SetSender(const char* s) {fMsg.SetSender(s);}
53    //
54
55private:
56
57    mutable EsafMsg fMsg;
58    // the message
59
60public:
61    ClassDef(EsafMsgSource,0)
62};
63
64
65inline void EsafMsgSource::FatalError( const string& errmsg ) const {
66    Msg(EsafMsg::Panic)  << errmsg  << MsgDispatch;
67}
68
69#endif  /* __ESAFMSGSOURCE_HH_ */
Note: See TracBrowser for help on using the repository browser.