CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MessageSender.h
Go to the documentation of this file.
1 #ifndef FWCore_MessageLogger_MessageSender_h
2 #define FWCore_MessageLogger_MessageSender_h
3 
7 
8 #include <memory>
9 
10 #include <map>
12 
13 // Change log
14 //
15 // 1 mf 8/25/08 error summary information for LoggedErrorsSummary()
16 //
17 // 2 mf 6/22/09 add severity to LoggedErrorsSummary by using
18 // ErrorSummaryEntry as map key
19 //
20 // 3 wmtan 6/22/11 Hold the ErrorObj with a shared pointer with a custom deleter.
21 // The custom deleter takes over the function of the message sending from the MessageSender destructor.
22 // This allows MessageSender to be copyable, which fixes the clang compilation errors.
23 
24 
25 namespace edm
26 {
27 
29 {
30  struct ErrorObjDeleter {
32  void operator()(ErrorObj * errorObjPtr);
33  };
34 
35 public:
36  // --- birth/death:
38  MessageSender( ELseverityLevel const & sev,
39  ELstring const & id,
40  bool verbatim = false, bool suppressed = false );
42 
43  // --- stream out the next part of a message:
44  template< class T >
46  operator<< ( T const & t )
47  {
48 #ifndef __GCCXML__
49  if (valid()) (*errorobj_p) << t;
50 #endif
51  return *this;
52  }
53 
54  bool valid() {
55  return errorobj_p != 0;
56  }
57 
58 private:
59  // data:
60  std::shared_ptr<ErrorObj> errorobj_p;
61 
62 }; // MessageSender
63 
64 
65 } // namespace edm
66 
67 
68 #endif // FWCore_MessageLogger_MessageSender_h
MessageSender & operator<<(T const &t)
Definition: MessageSender.h:46
std::shared_ptr< ErrorObj > errorobj_p
Definition: MessageSender.h:60
void operator()(ErrorObj *errorObjPtr)
long double T
std::string ELstring
Definition: ELstring.h:26