CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ELcollected.h
Go to the documentation of this file.
1 #ifndef FWCore_MessageService_ELcollected_h
2 #define FWCore_MessageService_ELcollected_h
3 
4 
5 // ----------------------------------------------------------------------
6 //
7 // ELcollected is a subclass of ELdestination representing a
8 // destination designed for collection of messages
9 // from multiple processes.
10 //
11 // Usage:
12 //
13 // (0) Define "clients" and "server" such that multiple clients each run
14 // user code which will issue ErrorLogger messages, and a single server
15 // is to amalgamated those messages into a single flow with unified
16 // statistics output.
17 //
18 // (1) Each client connects (one or more) ELcollected destinations to the
19 // ELadministrator. These can be controlled in terms of filtering,
20 // throttling and so forth. The semantics are like those for ELoutput.
21 //
22 // (2) When a ELcollected destination is instantiated, the constructor
23 // takes as an argument an object of a type derived from ELsender.
24 // ELsender is an abstract class containing a pure virtual method
25 // send (int n, const char* data). The derived class provides a definition
26 // of send(n, data) which moves n bytes of data to the server.
27 // ELsender also has a pure virtual clone() method;
28 // provision of this follows a boiler-plate we provide.
29 // One advantage of setting up an ELsender object, rather than making
30 // the user provide a global-scope function ELsend, is flexibility:
31 // It makes it trivial to set up two ELcollecteds that send their data to
32 // two different places or even use two distinct transport mechanisms.
33 //
34 // (3) The server process must set up its own ELadministrator, and attach
35 // whatever destinations it wants to have, such as ELoutput and
36 // ELstatistics destinations, in the usual manner.
37 //
38 // (4a) The server can be set up such that it has an ErrorLog errlog and
39 // whenever one of these chunks of data is moved to it, it does
40 // errlog (n, data).
41 // This is a natural syntax for a framework used to using
42 // errlog to log messages. If the server process is also doing
43 // other things that might issue error messages, this syntax
44 // has the advantageous feature that whatever module name is
45 // assinged to this errlog, will be prepended to the module name
46 // sent as part of the message.
47 //
48 // (4b) Alternatively, the server cam be set up such that whenever one of these
49 // chunks of data is moved to it, it calls ELrecv (n, data).
50 // This may be marginally more convenient.
51 //
52 // (*) The effect of an error message on the client is that when the data
53 // is moved to the server, and that causes ELrecv (or errlog(nbytes,data))
54 // to be called, the data is unraveled into the individual items that were
55 // supplied, and an error message is issued which is identical to the
56 // error message that was issued on the client. Thus all these messages
57 // end up amalgamated on the server destination(s).
58 //
59 // 2/22/00 mf Created file, based mainly on ELoutput.h
60 // 3/16/00 mf Mods to support ELsender operation.
61 // 6/7/00 web Reflect consolidation of ELdestination/X and ELoutput/X
62 // and consolidate ELcollected/X.
63 // 6/14/00 web Declare classes before granting friendship.
64 //
65 // ----------------------------------------------------------------------
66 
69 
72 
73 #include "boost/shared_ptr.hpp"
74 
75 namespace edm {
76 namespace service {
77 
78 
79 // ----------------------------------------------------------------------
80 // prerequisite classes:
81 // ----------------------------------------------------------------------
82 
83 class ELoutput;
84 class ELdestControl;
85 
86 
87 // ----------------------------------------------------------------------
88 // ELcollected:
89 // ----------------------------------------------------------------------
90 
91 class ELcollected : public ELoutput {
92 
93  friend class ELdestControl;
94 
95 public:
96 
97  // ----- Birth/death:
98  //
99  ELcollected( const ELsender & sender );
100  ELcollected( const ELcollected & orig );
101  ELcollected( ELoutput * d);
102  virtual ~ELcollected();
103 
104  // ----- Methods invoked by the ELadministrator:
105  //
106 public:
107  virtual
108  ELcollected *
109  clone() const;
110  // Used by attach() to put the destination on the ELadministrators list
111  //-| There is a note in Design Notes about semantics
112  //-| of copying a destination onto the list: ofstream
113  //-| ownership is passed to the new copy.
114 
115  virtual bool log( const edm::ErrorObj & msg );
116 
117  // ----- Methods invoked through the ELdestControl handle:
118  //
119 protected:
120  // trivial clearSummary(), wipe(), zero() from base class
121  // trivial three summary(..) from base class
122 
123  // ----- Data fundamental to the ELcollected destination:
124  //
125 
126  // ----- Data affected by methods of specific ELdestControl handle:
127  //
128 protected:
129  // ELcollected uses the generic ELdestControl handle
130 
131  // ----- Internal Methods -- Users should not invoke these:
132  //
133 protected:
134  void emitToken( const ELstring & s, bool nl=false );
135 
136  boost::shared_ptr<ELsender> sender;
137 
138  void intoBuf ( const ELstring & s );
139  void emitXid ( const ELextendedID & xid );
140 
142 
143 private:
144  ELcollected & operator=( const ELcollected & orig ); // verboten
145 
146 }; // ELcollected
147 
148 
149 // ----------------------------------------------------------------------
150 
151 
152 } // end of namespace service
153 } // end of namespace edm
154 
155 
156 #endif // MessageService_ELcollected_h
boost::shared_ptr< ELsender > sender
Definition: ELcollected.h:136
virtual ELcollected * clone() const
Definition: ELcollected.cc:82
void emitToken(const ELstring &s, bool nl=false)
Definition: ELcollected.cc:126
edm::ELextendedID xid
Definition: ELoutput.h:115
void intoBuf(const ELstring &s)
Definition: ELcollected.cc:95
void emitXid(const ELextendedID &xid)
Definition: ELcollected.cc:107
ELcollected & operator=(const ELcollected &orig)
virtual bool log(const edm::ErrorObj &msg)
Definition: ELcollected.cc:175
ELcollected(const ELsender &sender)
Definition: ELcollected.cc:37
std::string ELstring
Definition: ELstring.h:26