CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamerInputModule.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_StreamerInputModule_h
2 #define IOPool_Streamer_StreamerInputModule_h
3 
5 
8 
9 #include <memory>
10 #include <string>
11 #include <fstream>
12 #include <vector>
13 #include <utility>
14 #include <iostream>
15 #include <algorithm>
16 #include <iterator>
17 
18 namespace edm
19 {
20  template <typename Producer>
27  public:
28  explicit StreamerInputModule(ParameterSet const& pset,
29  InputSourceDescription const& desc);
30  virtual ~StreamerInputModule();
31  private:
32  virtual void genuineCloseFile() override {
33  if(pr_.get() != nullptr) pr_->closeFile();
34  }
35 
36  virtual bool checkNextEvent();
37 
38  //ProductRegistry const* prod_reg_;
40  }; //end-of-class-def
41 
42  template <typename Producer>
44 
45  template <typename Producer>
47  ParameterSet const& pset,
48  InputSourceDescription const& desc):
49  StreamerInputSource(pset, desc),
50  //prod_reg_(&productRegistry()),
51  pr_(new Producer(pset)) {
52  //Get header/init from Producer
53  InitMsgView const* header = pr_->getHeader();
55  }
56 
57  template <typename Producer>
59 
60  EventMsgView const* eview = pr_->getNextEvent();
61 
62  if (pr_->newHeader()) {
63  FDEBUG(6) << "A new file has been opened and we must compare Headers here !!" << std::endl;
64  // A new file has been opened and we must compare Headers here !!
65  //Get header/init from Producer
66  InitMsgView const* header = pr_->getHeader();
67  deserializeAndMergeWithRegistry(*header, true);
68  }
69  if (eview == 0) {
70  return false;
71  }
72  deserializeEvent(*eview);
73  return true;
74  }
75 
76 } // end of namespace-edm
77 
78 #endif
edm::propagate_const< std::unique_ptr< Producer > > pr_
#define FDEBUG(lev)
Definition: DebugMacros.h:18
StreamerInputModule(ParameterSet const &pset, InputSourceDescription const &desc)
virtual void genuineCloseFile() override
element_type const * get() const
void deserializeAndMergeWithRegistry(InitMsgView const &initView, bool subsequent=false)