CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StreamerInputFile.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_StreamerInputFile_h
2 #define IOPool_Streamer_StreamerInputFile_h
3 
9 
10 #include <memory>
11 
12 #include<string>
13 #include<vector>
14 
15 namespace edm {
16  class EventSkipperByID;
18  public:
19 
21  explicit StreamerInputFile(std::string const& name,
22  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>());
23 
25  explicit StreamerInputFile(std::vector<std::string> const& names,
26  std::shared_ptr<EventSkipperByID> eventSkipperByID = std::shared_ptr<EventSkipperByID>());
27 
29 
30  bool next();
32  InitMsgView const* startMessage() const { return startMsg_.get(); }
35  EventMsgView const* currentRecord() const { return currentEvMsg_.get(); }
38  bool newHeader() { bool tmp = newHeader_; newHeader_ = false; return tmp;}
40  void closeStreamerFile();
42 
43  private:
44 
45  void openStreamerFile(std::string const& name);
46  IOSize readBytes(char* buf, IOSize nBytes);
47  IOOffset skipBytes(IOSize nBytes);
48 
49  void readStartMessage();
50  int readEventMessage();
51 
52  bool openNextFile();
55  bool compareHeader();
56 
57  void logFileAction(char const* msg);
58 
59  std::shared_ptr<InitMsgView> startMsg_;
60  std::shared_ptr<EventMsgView> currentEvMsg_;
61 
62  std::vector<char> headerBuf_;
63  std::vector<char> eventBuf_;
65  unsigned int currentFile_;
66  std::vector<std::string> streamerNames_;
70 
71  std::shared_ptr<EventSkipperByID> eventSkipperByID_;
72 
75 
76  bool newHeader_;
77 
78  std::shared_ptr<Storage> storage_;
79 
80  bool endOfFile_;
81  };
82 }
83 
84 #endif
std::shared_ptr< EventMsgView > currentEvMsg_
std::vector< char > eventBuf_
static const HistoName names[]
void closeStreamerFile()
Needs to be public because of forking.
std::shared_ptr< InitMsgView > startMsg_
IOOffset skipBytes(IOSize nBytes)
std::vector< std::string > streamerNames_
InitMsgView const * startMessage() const
unsigned int uint32
Definition: MsgTools.h:13
void logFileAction(char const *msg)
IOSize readBytes(char *buf, IOSize nBytes)
int64_t IOOffset
Definition: IOTypes.h:19
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
EventMsgView const * currentRecord() const
std::vector< char > headerBuf_
size_t IOSize
Definition: IOTypes.h:14
StreamerInputFile(std::string const &name, std::shared_ptr< EventSkipperByID > eventSkipperByID=std::shared_ptr< EventSkipperByID >())
void openStreamerFile(std::string const &name)
std::shared_ptr< EventSkipperByID > eventSkipperByID_
std::shared_ptr< Storage > storage_