CMS 3D CMS Logo

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>
11 
12 // Change log
13 //
14 // 1 mf 8/25/08 error summary information for LoggedErrorsSummary()
15 //
16 // 2 mf 6/22/09 add severity to LoggedErrorsSummary by using
17 // ErrorSummaryEntry as map key
18 //
19 // 3 wmtan 6/22/11 Hold the ErrorObj with a shared pointer with a custom deleter.
20 // The custom deleter takes over the function of the message sending from the MessageSender destructor.
21 // This allows MessageSender to be copyable, which fixes the clang compilation errors.
22 
23 namespace edm {
24 
25  class MessageSender {
26  struct ErrorObjDeleter {
28  void operator()(ErrorObj* errorObjPtr);
29  };
30 
31  public:
32  // --- birth/death:
34  MessageSender(ELseverityLevel const& sev, ELstring const& id, bool verbatim = false, bool suppressed = false);
36 
37  // --- stream out the next part of a message:
38  template <class T>
40  if (valid())
41  (*errorobj_p) << t;
42  return *this;
43  }
44 
45  bool valid() { return errorobj_p != nullptr; }
46 
47  private:
48  // data:
49  std::shared_ptr<ErrorObj> errorobj_p;
50 
51  }; // MessageSender
52 
53 } // namespace edm
54 
55 #endif // FWCore_MessageLogger_MessageSender_h
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ErrorObj
Definition: ErrorObj.h:44
edm::MessageSender::operator<<
MessageSender & operator<<(T const &t)
Definition: MessageSender.h:39
edm::MessageSender::valid
bool valid()
Definition: MessageSender.h:45
ErrorObj.h
edm::ELstring
std::string ELstring
Definition: ELstring.h:21
edm::MessageSender::~MessageSender
~MessageSender()
Definition: MessageSender.cc:139
edm::MessageSender::ErrorObjDeleter::operator()
void operator()(ErrorObj *errorObjPtr)
Definition: MessageSender.cc:93
edm::MessageSender::ErrorObjDeleter::ErrorObjDeleter
ErrorObjDeleter()
Definition: MessageSender.h:27
edm::MessageSender::ErrorObjDeleter
Definition: MessageSender.h:26
OrderedSet.t
t
Definition: OrderedSet.py:90
edm::MessageSender
Definition: MessageSender.h:25
ELseverityLevel.h
edm::ELseverityLevel
Definition: ELseverityLevel.h:96
T
long double T
Definition: Basic3DVectorLD.h:48
ELstring.h
edm::MessageSender::errorobj_p
std::shared_ptr< ErrorObj > errorobj_p
Definition: MessageSender.h:49
edm::MessageSender::MessageSender
MessageSender()
Definition: MessageSender.h:33