Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:21:23

0001 #ifndef DaqSource_RawFile_h
0002 #define DaqSource_RawFile_h
0003 
0004 /** \class RawFile
0005  *  Utility class to open, read and manage local and rfio files
0006  *  in a transparent way
0007  *
0008  *  \author J. Alcaraz - CIEMAT, Madrid
0009  */
0010 
0011 #include <iostream>
0012 //#include <boost/cstdint.hpp>
0013 
0014 class RawFile {
0015 public:
0016   /// Default constructor
0017   RawFile();
0018 
0019   /// Usual constructor
0020   RawFile(const char* path);
0021 
0022   /// Open file
0023   RawFile* open(const char* path);
0024 
0025   /// Close file if necessary
0026   int close();
0027 
0028   /// Destructor
0029   virtual ~RawFile();
0030 
0031   /// Get file pointer
0032   FILE* GetPointer();
0033 
0034   /// It is OK (i.e. file was correctly opened)
0035   bool ok();
0036 
0037   /// It is not OK
0038   bool fail();
0039 
0040   /// Castor flag
0041   bool isRFIO();
0042 
0043   /// XROOTD flag
0044   bool isXROOTD();
0045 
0046   /// Read from file
0047   int read(void* data, size_t nbytes);
0048 
0049   /// Go somewhere
0050   int seek(long offset, int whence);
0051 
0052   /// Ignore some bytes
0053   int ignore(long offset);
0054 
0055   /// Check end of file
0056   int eof();
0057 
0058   /// Tell instruction
0059   long tell();
0060 
0061 private:
0062   FILE* inputFile;
0063   bool xrootdFlag;
0064 };
0065 #endif