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 
7 
8 #include <memory>
9 #include <string>
10 #include <fstream>
11 #include <vector>
12 #include <utility>
13 #include <iostream>
14 #include <algorithm>
15 #include <iterator>
16 
17 namespace edm
18 {
19  template <typename Producer>
26  public:
27  explicit StreamerInputModule(ParameterSet const& pset,
28  InputSourceDescription const& desc);
29  virtual ~StreamerInputModule();
30  private:
31  virtual void closeFile_() {
32  if(pr_.get() != nullptr) pr_->closeFile();
33  }
34 
35  virtual bool checkNextEvent();
36 
37  //ProductRegistry const* prod_reg_;
38  std::auto_ptr<Producer> pr_;
39  }; //end-of-class-def
40 
41  template <typename Producer>
43 
44  template <typename Producer>
46  ParameterSet const& pset,
47  InputSourceDescription const& desc):
48  StreamerInputSource(pset, desc),
49  //prod_reg_(&productRegistry()),
50  pr_(new Producer(pset)) {
51  //Get header/init from Producer
52  InitMsgView const* header = pr_->getHeader();
54  }
55 
56  template <typename Producer>
58 
59  EventMsgView const* eview = pr_->getNextEvent();
60 
61  if (pr_->newHeader()) {
62  FDEBUG(6) << "A new file has been opened and we must compare Headers here !!" << std::endl;
63  // A new file has been opened and we must compare Headers here !!
64  //Get header/init from Producer
65  InitMsgView const* header = pr_->getHeader();
66  deserializeAndMergeWithRegistry(*header, true);
67  }
68  if (eview == 0) {
69  return false;
70  }
71  deserializeEvent(*eview);
72  return true;
73  }
74 
75 } // end of namespace-edm
76 
77 #endif
#define FDEBUG(lev)
Definition: DebugMacros.h:18
StreamerInputModule(ParameterSet const &pset, InputSourceDescription const &desc)
void deserializeAndMergeWithRegistry(InitMsgView const &initView, bool subsequent=false)
std::auto_ptr< Producer > pr_