CMS 3D CMS Logo

StreamerInputFile.h

Go to the documentation of this file.
00001 #ifndef IOPool_Streamer_StreamerInputFile_h
00002 #define IOPool_Streamer_StreamerInputFile_h
00003 
00004 #include "IOPool/Streamer/interface/InitMessage.h"
00005 #include "IOPool/Streamer/interface/EventMessage.h"
00006 #include "IOPool/Streamer/interface/MsgTools.h"
00007 #include "IOPool/Streamer/interface/IndexRecords.h"
00008 #include "Utilities/StorageFactory/interface/IOTypes.h"
00009 #include "Utilities/StorageFactory/interface/Storage.h"
00010 
00011 #include <boost/shared_ptr.hpp>
00012 
00013 #include<string>
00014 #include<vector>
00015 
00016 class StreamerInputIndexFile;
00017 
00018   class StreamerInputFile
00019   {
00020   public:
00021 
00023     explicit StreamerInputFile(const std::string& name);
00024 
00027     explicit StreamerInputFile(const std::string& name, const std::string& order);
00028 
00030     explicit StreamerInputFile(const std::string& name, const StreamerInputIndexFile& order);
00031 
00033     explicit StreamerInputFile(const std::vector<std::string>& names);
00034 
00035     ~StreamerInputFile();
00036 
00037     bool next() ; 
00039     const InitMsgView*  startMessage() const { return startMsg_; }
00042     const EventMsgView*  currentRecord() const { return currentEvMsg_; }
00045     const StreamerInputIndexFile* index(); 
00047     const bool newHeader() { bool tmp=newHeader_; newHeader_=false; return tmp;}  
00050   private:
00051 
00052     void openStreamerFile(const std::string& name);
00053     IOSize readBytes(char *buf, IOSize nBytes);
00054 
00055     void readStartMessage();
00056     int  readEventMessage();
00057 
00058     bool openNextFile();
00061     bool compareHeader();
00062 
00063     void logFileAction(const char* msg);
00064 
00065     bool useIndex_;
00066     StreamerInputIndexFile* index_;
00067     indexRecIter indexIter_b;
00068     indexRecIter indexIter_e;
00069 
00070     InitMsgView* startMsg_;
00071     EventMsgView* currentEvMsg_;
00072 
00073     std::vector<char> headerBuf_; 
00074     std::vector<char> eventBuf_;  
00076     unsigned int currentFile_; 
00077     std::vector<std::string> streamerNames_; 
00078     bool multiStreams_;  
00079     std::string currentFileName_;
00080     bool currentFileOpen_;
00081 
00082     uint32 currRun_;
00083     uint32 currProto_;
00084 
00085     bool newHeader_;
00086 
00087     boost::shared_ptr<Storage> storage_;
00088 
00089     bool endOfFile_;
00090   };
00091 
00092 
00093 
00094 #endif

Generated on Tue Jun 9 17:39:18 2009 for CMSSW by  doxygen 1.5.4