00001 #ifndef FWCore_MessageService_ELcollected_h 00002 #define FWCore_MessageService_ELcollected_h 00003 00004 00005 // ---------------------------------------------------------------------- 00006 // 00007 // ELcollected is a subclass of ELdestination representing a 00008 // destination designed for collection of messages 00009 // from multiple processes. 00010 // 00011 // Usage: 00012 // 00013 // (0) Define "clients" and "server" such that multiple clients each run 00014 // user code which will issue ErrorLogger messages, and a single server 00015 // is to amalgamated those messages into a single flow with unified 00016 // statistics output. 00017 // 00018 // (1) Each client connects (one or more) ELcollected destinations to the 00019 // ELadministrator. These can be controlled in terms of filtering, 00020 // throttling and so forth. The semantics are like those for ELoutput. 00021 // 00022 // (2) When a ELcollected destination is instantiated, the constructor 00023 // takes as an argument an object of a type derived from ELsender. 00024 // ELsender is an abstract class containing a pure virtual method 00025 // send (int n, const char* data). The derived class provides a definition 00026 // of send(n, data) which moves n bytes of data to the server. 00027 // ELsender also has a pure virtual clone() method; 00028 // provision of this follows a boiler-plate we provide. 00029 // One advantage of setting up an ELsender object, rather than making 00030 // the user provide a global-scope function ELsend, is flexibility: 00031 // It makes it trivial to set up two ELcollecteds that send their data to 00032 // two different places or even use two distinct transport mechanisms. 00033 // 00034 // (3) The server process must set up its own ELadministrator, and attach 00035 // whatever destinations it wants to have, such as ELoutput and 00036 // ELstatistics destinations, in the usual manner. 00037 // 00038 // (4a) The server can be set up such that it has an ErrorLog errlog and 00039 // whenever one of these chunks of data is moved to it, it does 00040 // errlog (n, data). 00041 // This is a natural syntax for a framework used to using 00042 // errlog to log messages. If the server process is also doing 00043 // other things that might issue error messages, this syntax 00044 // has the advantageous feature that whatever module name is 00045 // assinged to this errlog, will be prepended to the module name 00046 // sent as part of the message. 00047 // 00048 // (4b) Alternatively, the server cam be set up such that whenever one of these 00049 // chunks of data is moved to it, it calls ELrecv (n, data). 00050 // This may be marginally more convenient. 00051 // 00052 // (*) The effect of an error message on the client is that when the data 00053 // is moved to the server, and that causes ELrecv (or errlog(nbytes,data)) 00054 // to be called, the data is unraveled into the individual items that were 00055 // supplied, and an error message is issued which is identical to the 00056 // error message that was issued on the client. Thus all these messages 00057 // end up amalgamated on the server destination(s). 00058 // 00059 // 2/22/00 mf Created file, based mainly on ELoutput.h 00060 // 3/16/00 mf Mods to support ELsender operation. 00061 // 6/7/00 web Reflect consolidation of ELdestination/X and ELoutput/X 00062 // and consolidate ELcollected/X. 00063 // 6/14/00 web Declare classes before granting friendship. 00064 // 00065 // ---------------------------------------------------------------------- 00066 00067 #include "FWCore/MessageService/interface/ELoutput.h" 00068 #include "FWCore/MessageService/interface/ELsender.h" 00069 00070 #include "FWCore/MessageLogger/interface/ELstring.h" 00071 #include "FWCore/MessageLogger/interface/ELextendedID.h" 00072 #include "FWCore/MessageLogger/interface/ErrorObj.h" 00073 00074 namespace edm { 00075 namespace service { 00076 00077 00078 // ---------------------------------------------------------------------- 00079 // prerequisite classes: 00080 // ---------------------------------------------------------------------- 00081 00082 class ELoutput; 00083 class ELdestControl; 00084 00085 00086 // ---------------------------------------------------------------------- 00087 // ELcollected: 00088 // ---------------------------------------------------------------------- 00089 00090 class ELcollected : public ELoutput { 00091 00092 friend class ELdestControl; 00093 00094 public: 00095 00096 // ----- Birth/death: 00097 // 00098 ELcollected( const ELsender & sender ); 00099 ELcollected( const ELcollected & orig ); 00100 ELcollected( ELoutput * d); 00101 virtual ~ELcollected(); 00102 00103 // ----- Methods invoked by the ELadministrator: 00104 // 00105 public: 00106 virtual 00107 ELcollected * 00108 clone() const; 00109 // Used by attach() to put the destination on the ELadministrators list 00110 //-| There is a note in Design Notes about semantics 00111 //-| of copying a destination onto the list: ofstream 00112 //-| ownership is passed to the new copy. 00113 00114 virtual bool log( const edm::ErrorObj & msg ); 00115 00116 // ----- Methods invoked through the ELdestControl handle: 00117 // 00118 protected: 00119 // trivial clearSummary(), wipe(), zero() from base class 00120 // trivial three summary(..) from base class 00121 00122 // ----- Data fundamental to the ELcollected destination: 00123 // 00124 00125 // ----- Data affected by methods of specific ELdestControl handle: 00126 // 00127 protected: 00128 // ELcollected uses the generic ELdestControl handle 00129 00130 // ----- Internal Methods -- Users should not invoke these: 00131 // 00132 protected: 00133 void emit( const ELstring & s, bool nl=false ); 00134 00135 ELsender * sender; 00136 00137 void intoBuf ( const ELstring & s ); 00138 void emitXid ( const ELextendedID & xid ); 00139 00140 ELstring buf; 00141 00142 00143 }; // ELcollected 00144 00145 00146 // ---------------------------------------------------------------------- 00147 00148 00149 } // end of namespace service 00150 } // end of namespace edm 00151 00152 00153 #endif // MessageService_ELcollected_h