00001 #ifndef IOPool_Streamer_StreamerOutputModule_h 00002 #define IOPool_Streamer_StreamerOutputModule_h 00003 00004 #include "IOPool/Streamer/interface/StreamerOutputModuleBase.h" 00005 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" 00006 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" 00007 00008 namespace edm { 00009 template <class Consumer> 00010 class StreamerOutputModule : public StreamerOutputModuleBase { 00011 00020 public: 00021 explicit StreamerOutputModule(ParameterSet const& ps); 00022 virtual ~StreamerOutputModule(); 00023 static void fillDescriptions(ConfigurationDescriptions& descriptions); 00024 00025 private: 00026 virtual void start() const; 00027 virtual void stop() const; 00028 virtual void doOutputHeader(InitMsgBuilder const& init_message) const; 00029 virtual void doOutputEvent(EventMsgBuilder const& msg) const; 00030 00031 private: 00032 std::auto_ptr<Consumer> c_; 00033 }; //end-of-class-def 00034 00035 00036 00037 template <class Consumer> 00038 StreamerOutputModule<Consumer>::StreamerOutputModule(ParameterSet const& ps) : 00039 StreamerOutputModuleBase(ps), 00040 c_(new Consumer(ps)) { 00041 } 00042 00043 template <class Consumer> 00044 StreamerOutputModule<Consumer>::~StreamerOutputModule() {} 00045 00046 template <class Consumer> 00047 void 00048 StreamerOutputModule<Consumer>::start() const { 00049 c_->start(); 00050 } 00051 00052 template <class Consumer> 00053 void 00054 StreamerOutputModule<Consumer>::stop() const { 00055 c_->stop(); 00056 } 00057 00058 template <class Consumer> 00059 void 00060 StreamerOutputModule<Consumer>::doOutputHeader(InitMsgBuilder const& init_message) const { 00061 c_->doOutputHeader(init_message); 00062 } 00063 00064 //______________________________________________________________________________ 00065 template <class Consumer> 00066 void 00067 StreamerOutputModule<Consumer>::doOutputEvent(EventMsgBuilder const& msg) const { 00068 c_->doOutputEvent(msg); // You can't use msg in StreamerOutputModule after this point 00069 } 00070 00071 template <class Consumer> 00072 void 00073 StreamerOutputModule<Consumer>::fillDescriptions(ConfigurationDescriptions& descriptions) { 00074 ParameterSetDescription desc; 00075 StreamerOutputModuleBase::fillDescription(desc); 00076 Consumer::fillDescription(desc); 00077 descriptions.add("streamerOutput", desc); 00078 } 00079 } // end of namespace-edm 00080 00081 #endif 00082