CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/IOPool/Streamer/interface/StreamerInputSource.h

Go to the documentation of this file.
00001 #ifndef IOPool_Streamer_StreamerInputSource_h
00002 #define IOPool_Streamer_StreamerInputSource_h
00003 
00012 #include "TBufferFile.h"
00013 
00014 #include "FWCore/Framework/interface/Frameworkfwd.h"
00015 #include "FWCore/Sources/interface/RawInputSource.h"
00016 
00017 #include "DataFormats/Streamer/interface/StreamedProducts.h"
00018 #include "DataFormats/Common/interface/EDProductGetter.h"
00019 
00020 #include "boost/shared_ptr.hpp"
00021 
00022 #include <vector>
00023 
00024 class InitMsgView;
00025 class EventMsgView;
00026 
00027 namespace edm {
00028   class BranchIDListHelper;
00029   class ParameterSetDescription;
00030   class StreamerInputSource : public RawInputSource {
00031   public:  
00032     explicit StreamerInputSource(ParameterSet const& pset,
00033                  InputSourceDescription const& desc);
00034     virtual ~StreamerInputSource();
00035     static void fillDescription(ParameterSetDescription& description);
00036 
00037     static
00038     std::auto_ptr<SendJobHeader> deserializeRegistry(InitMsgView const& initView);
00039 
00040     void deserializeAndMergeWithRegistry(InitMsgView const& initView, bool subsequent = false);
00041 
00042     void deserializeEvent(EventMsgView const& eventView);
00043 
00044     static
00045     void mergeIntoRegistry(SendJobHeader const& header, ProductRegistry&, BranchIDListHelper&, bool subsequent);
00046 
00055     static unsigned int uncompressBuffer(unsigned char* inputBuffer,
00056                                          unsigned int inputSize,
00057                                          std::vector<unsigned char>& outputBuffer,
00058                                          unsigned int expectedFullSize);
00059   protected:
00060     static void declareStreamers(SendDescs const& descs);
00061     static void buildClassCache(SendDescs const& descs);
00062     void resetAfterEndRun();
00063 
00064   private:
00065 
00066     class ProductGetter : public EDProductGetter {
00067     public:
00068       ProductGetter();
00069       virtual ~ProductGetter();
00070 
00071       virtual WrapperHolder getIt(edm::ProductID const& id) const;
00072 
00073       void setEventPrincipal(EventPrincipal *ep);
00074 
00075     private:
00076       // We don't own the principal.  The lifetime must be managed externally.
00077       EventPrincipal const* eventPrincipal_;
00078     };
00079 
00080     virtual EventPrincipal* read(EventPrincipal& eventPrincipal);
00081 
00082     virtual void setRun(RunNumber_t r);
00083 
00084     virtual boost::shared_ptr<FileBlock> readFile_();
00085 
00086     TClass* tc_;
00087     std::vector<unsigned char> dest_;
00088     TBufferFile xbuf_;
00089     std::unique_ptr<SendEvent> sendEvent_;
00090     ProductGetter productGetter_;
00091     bool adjustEventToNewProductRegistry_;
00092 
00093     //Do not like these to be static, but no choice as deserializeRegistry() that sets it is a static memeber 
00094     static std::string processName_;
00095     static unsigned int protocolVersion_;
00096   }; //end-of-class-def
00097 } // end of namespace-edm
00098   
00099 #endif