00001 #ifndef FileReprBase_HPP 00002 #define FileReprBase_HPP 00003 00008 #include <fstream> 00009 00017 class FileReprBase 00018 { 00019 public: 00020 enum Mode 00021 { 00022 READ, 00023 WRITE, 00024 }; 00025 00028 class params_t 00029 { 00030 public: 00032 char* file_name; 00034 std::streamsize file_buffer_size; 00035 00036 Mode mode; 00037 00038 params_t() 00039 { 00040 file_name = NULL; 00041 file_buffer_size = 128 * 1024; 00042 mode = READ; 00043 } 00044 }; 00045 FileReprBase(const params_t* par) : 00046 file_buffer_size(par->file_buffer_size) 00047 { 00048 file_buffer = new char[par->file_buffer_size]; 00049 this->mode=par->mode; 00050 } 00051 00052 ~FileReprBase() 00053 { 00054 delete [] file_buffer; 00055 } 00060 void rewind(){} 00061 00063 void flush(){} 00064 00074 std::streamsize readFromFile(char* buffer, std::streamsize buffer_size) 00075 { 00076 return 0; 00077 } 00078 00084 void writeToFile( const char* buffer, std::streamsize n ){} 00085 00086 00087 protected: 00089 char* file_buffer; 00091 std::streamsize file_buffer_size; 00093 Mode mode; 00094 00095 }; 00096 00097 #endif