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 <boost/shared_ptr.hpp>
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  int* numberOfEventsToSkip = 0,
23  boost::shared_ptr<EventSkipperByID> eventSkipperByID = boost::shared_ptr<EventSkipperByID>());
24 
26  explicit StreamerInputFile(std::vector<std::string> const& names,
27  int* numberOfEventsToSkip = 0,
28  boost::shared_ptr<EventSkipperByID> eventSkipperByID = boost::shared_ptr<EventSkipperByID>());
29 
31 
32  bool next();
34  InitMsgView const* startMessage() const { return startMsg_.get(); }
37  EventMsgView const* currentRecord() const { return currentEvMsg_.get(); }
40  bool const newHeader() { bool tmp = newHeader_; newHeader_ = false; return tmp;}
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  boost::shared_ptr<InitMsgView> startMsg_;
60  boost::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_;
68  std::string currentFileName_;
70 
71  boost::shared_ptr<EventSkipperByID> eventSkipperByID_;
72 
74 
77 
78  bool newHeader_;
79 
80  boost::shared_ptr<Storage> storage_;
81 
82  bool endOfFile_;
83  };
84 }
85 
86 #endif
std::vector< char > eventBuf_
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
boost::shared_ptr< EventMsgView > currentEvMsg_
IOOffset skipBytes(IOSize nBytes)
std::vector< std::string > streamerNames_
boost::shared_ptr< Storage > storage_
InitMsgView const * startMessage() const
unsigned int uint32
Definition: MsgTools.h:13
boost::shared_ptr< InitMsgView > startMsg_
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
void openStreamerFile(std::string const &name)
static const HistoName names[]
StreamerInputFile(std::string const &name, int *numberOfEventsToSkip=0, boost::shared_ptr< EventSkipperByID > eventSkipperByID=boost::shared_ptr< EventSkipperByID >())