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;
20  public:
22  explicit StreamerInputFile(std::string const& name,
23  std::string const& LFN,
24  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
25  unsigned int prefetchMBytes = 0);
26  explicit StreamerInputFile(std::string const& name,
27  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
28  unsigned int prefetchMBytes = 0);
29 
31  explicit StreamerInputFile(std::vector<FileCatalogItem> const& names,
32  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>(),
33  unsigned int prefetchMBytes = 0);
34 
36 
37  enum class Next { kEvent, kFile, kStop };
38  Next next();
40  InitMsgView const* startMessage() const { return startMsg_.get(); }
43  EventMsgView const* currentRecord() const { return currentEvMsg_.get(); }
46  bool newHeader() {
47  bool tmp = newHeader_;
48  newHeader_ = false;
49  return tmp;
50  }
52  void closeStreamerFile();
53  bool openNextFile();
54 
55  private:
56  void openStreamerFile(std::string const& name, std::string const& LFN);
57  std::pair<storage::IOSize, char*> readBytes(char* buf,
58  storage::IOSize nBytes,
59  bool zeroCopy,
60  unsigned int skippedHdr = 0);
62 
63  void readStartMessage();
64  int readEventMessage();
65 
68  bool compareHeader();
69 
70  void logFileAction(char const* msg);
71 
74 
75  std::vector<char> headerBuf_;
76  std::vector<char> eventBuf_;
78  std::vector<char> tempBuf_;
79  unsigned int tempLen_ = 0;
80  unsigned int tempPos_ = 0;
81 
82  unsigned int currentFile_;
83  std::vector<FileCatalogItem> streamerNames_;
87 
89 
92 
93  bool newHeader_;
94 
96 
97  bool endOfFile_;
98  };
99 } // namespace edm
100 
101 #endif
int64_t IOOffset
Definition: IOTypes.h:20
std::vector< char > eventBuf_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
EventMsgView const * currentRecord() const
const std::string names[nVars_]
constexpr element_type const * get() const
std::pair< storage::IOSize, char * > readBytes(char *buf, storage::IOSize nBytes, bool zeroCopy, unsigned int skippedHdr=0)
storage::IOOffset skipBytes(storage::IOSize nBytes)
StreamerInputFile(std::string const &name, std::string const &LFN, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >(), unsigned int prefetchMBytes=0)
void openStreamerFile(std::string const &name, std::string const &LFN)
unsigned int uint32
Definition: MsgTools.h:13
InitMsgView const * startMessage() const
size_t IOSize
Definition: IOTypes.h:15
void logFileAction(char const *msg)
tuple msg
Definition: mps_check.py:286
std::vector< char > headerBuf_
HLT enums.
edm::propagate_const< std::shared_ptr< EventMsgView > > currentEvMsg_
std::vector< FileCatalogItem > streamerNames_
std::vector< char > tempBuf_
edm::propagate_const< std::shared_ptr< InitMsgView > > startMsg_
tmp
align.sh
Definition: createJobs.py:716
edm::propagate_const< std::unique_ptr< edm::storage::Storage > > storage_