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 
8 
9 #include "boost/shared_ptr.hpp"
10 
11 #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 typedef std::map<ErrorSummaryMapKey, unsigned int>::iterator
31 
33 {
34  struct ErrorObjDeleter {
36  void operator()(ErrorObj * errorObjPtr);
37  };
38 
39 public:
40  // --- birth/death:
42  MessageSender( ELseverityLevel const & sev,
43  ELstring const & id,
44  bool verbatim = false, bool suppressed = false );
46 
47  // --- stream out the next part of a message:
48  template< class T >
50  operator<< ( T const & t )
51  {
52  if (valid()) (*errorobj_p) << t;
53  return *this;
54  }
55 
56  // static data: // change log 1
58  static bool freshError;
59  static std::map<ErrorSummaryMapKey, unsigned int> errorSummaryMap;
60  bool valid() {
61  return errorobj_p != 0;
62  }
63 
64 private:
65  // data:
66  boost::shared_ptr<ErrorObj> errorobj_p;
67 
68 }; // MessageSender
69 
70 
71 } // namespace edm
72 
73 
74 #endif // FWCore_MessageLogger_MessageSender_h
ErrorSummaryEntry ErrorSummaryMapKey
Definition: MessageSender.h:28
MessageSender & operator<<(T const &t)
Definition: MessageSender.h:50
void operator()(ErrorObj *errorObjPtr)
std::map< ErrorSummaryMapKey, unsigned int >::iterator ErrorSummaryMapIterator
Definition: MessageSender.h:30
boost::shared_ptr< ErrorObj > errorobj_p
Definition: MessageSender.h:66
static bool errorSummaryIsBeingKept
Definition: MessageSender.h:57
static bool freshError
Definition: MessageSender.h:58
static std::map< ErrorSummaryMapKey, unsigned int > errorSummaryMap
Definition: MessageSender.h:59
long double T
std::string ELstring
Definition: ELstring.h:26