CMS 3D CMS Logo

StreamerInputFile.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_StreamerInputFile_h
2 #define IOPool_Streamer_StreamerInputFile_h
3 
10 
11 #include <memory>
12 
13 #include <string>
14 #include <vector>
15 
16 namespace edm {
17  class EventSkipperByID;
18  class FileCatalogItem;
19 } // namespace edm
20 namespace edm::streamer {
22  public:
24  explicit StreamerInputFile(std::string const& name,
25  std::string const& LFN,
26  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
27  unsigned int prefetchMBytes = 0);
28  explicit StreamerInputFile(std::string const& name,
29  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
30  unsigned int prefetchMBytes = 0);
31 
33  explicit StreamerInputFile(std::vector<FileCatalogItem> const& names,
34  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
35  unsigned int prefetchMBytes = 0);
36 
38 
39  enum class Next { kEvent, kFile, kStop };
40  Next next();
42  InitMsgView const* startMessage() const { return startMsg_.get(); }
45  EventMsgView const* currentRecord() const { return currentEvMsg_.get(); }
48  bool newHeader() {
49  bool tmp = newHeader_;
50  newHeader_ = false;
51  return tmp;
52  }
54  void closeStreamerFile();
55  bool openNextFile();
56 
57  private:
58  void openStreamerFile(std::string const& name, std::string const& LFN);
59  std::pair<storage::IOSize, char*> readBytes(char* buf,
60  storage::IOSize nBytes,
61  bool zeroCopy,
62  unsigned int skippedHdr = 0);
64 
65  void readStartMessage();
66  int readEventMessage();
67 
70  bool compareHeader();
71 
72  void logFileAction(char const* msg);
73 
76 
77  std::vector<char> headerBuf_;
78  std::vector<char> eventBuf_;
80  std::vector<char> tempBuf_;
81  unsigned int tempLen_ = 0;
82  unsigned int tempPos_ = 0;
83 
84  unsigned int currentFile_;
85  std::vector<FileCatalogItem> streamerNames_;
89 
91 
94 
95  bool newHeader_;
96 
98 
99  bool endOfFile_;
100  };
101 } // namespace edm::streamer
102 
103 #endif
int64_t IOOffset
Definition: IOTypes.h:20
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
void openStreamerFile(std::string const &name, std::string const &LFN)
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_
storage::IOOffset skipBytes(storage::IOSize nBytes)
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
StreamerInputFile(std::string const &name, std::string const &LFN, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)
const std::string names[nVars_]
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_
std::pair< storage::IOSize, char * > readBytes(char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
size_t IOSize
Definition: IOTypes.h:15
EventMsgView const * currentRecord() const
tuple msg
Definition: mps_check.py:286
HLT enums.
InitMsgView const * startMessage() const
std::vector< FileCatalogItem > streamerNames_
unsigned int uint32
Definition: MsgTools.h:14
tmp
align.sh
Definition: createJobs.py:716