00001 #ifndef ROC_FileInput 00002 #define ROC_FileInput 00003 00004 #ifndef DABC_DataIO 00005 #include "dabc/DataIO.h" 00006 #endif 00007 00008 #ifndef DABC_Object 00009 #include "dabc/Object.h" 00010 #endif 00011 00012 #include <stdio.h> 00013 #include <stdint.h> 00014 00015 namespace fasp { 00016 00017 class FileInput : public dabc::DataInput { 00018 00019 enum { FaspBlockSize = 44, FaspSyncPos = 34 }; 00020 00021 enum { DummySync = 0xffffffff }; 00022 00023 public: 00024 FileInput(const char* fname = 0, uint32_t bufsize = 0x10000); 00025 virtual ~FileInput(); 00026 00027 virtual bool Read_Init(const dabc::WorkerRef& wrk, const dabc::Command& cmd); 00028 00029 bool Init(); 00030 00031 virtual unsigned Read_Size(); 00032 virtual unsigned Read_Complete(dabc::Buffer& buf); 00033 00034 protected: 00035 bool CloseFile(); 00036 00037 bool OpenNextFile(); 00038 00039 std::string fFileName; 00040 uint32_t fBufferSize; 00041 00042 dabc::Object* fFilesList; 00043 FILE* fFile; 00044 00045 std::string fCurrentFileName; 00046 uint64_t fCurrentRead; 00047 00048 uint8_t* fRaw; // raw buffer 00049 unsigned fRawSize; // size of raw buffer 00050 unsigned fRawPos; // fill position in buffer 00051 unsigned fRawSync; // current number of sync message in raw buffer 00052 00053 }; 00054 00055 } 00056 00057 #endif