CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_6/src/IOPool/Streamer/interface/StreamerOutputModule.h

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