Template class SimpleFile to read and write from files.
Currently only simple reading and writing of blocks is supported.
Definition at line 27 of file SimpleFile.h.
Public Member Functions | |
CSimpleFile (char *fname, FILE *f) | |
virtual | ~CSimpleFile () |
T * | load (T *target, int64_t &num=0) |
bool | save (T *target, int64_t num) |
void | get_buffered_line (char *line, uint64_t len) |
void | free_line_buffer () |
void | set_line_buffer_size (int32_t bufsize) |
bool | is_ok () |
virtual const char * | get_name () const |
Protected Attributes | |
FILE * | file |
bool | status |
char | task |
char * | filename |
int32_t | line_buffer_size |
char * | line_buffer |
CSimpleFile | ( | char * | fname, | |
FILE * | f | |||
) |
constructor rw is either r for read and w for write
fname | filename | |
f | file descriptor |
Definition at line 36 of file SimpleFile.h.
virtual ~CSimpleFile | ( | ) | [virtual] |
Definition at line 44 of file SimpleFile.h.
void free_line_buffer | ( | ) |
free the line buffer
Definition at line 174 of file SimpleFile.h.
void get_buffered_line | ( | char * | line, | |
uint64_t | len | |||
) |
read a line (buffered; to be implemented)
line | linebuffer to write to | |
len | maximum length |
Definition at line 150 of file SimpleFile.h.
virtual const char* get_name | ( | ) | const [virtual] |
bool is_ok | ( | ) |
T* load | ( | T * | target, | |
int64_t & | num = 0 | |||
) |
load
target | load target | |
num | number of read elements |
Definition at line 56 of file SimpleFile.h.
bool save | ( | T * | target, | |
int64_t | num | |||
) |
save
target | target to save to | |
num | number of elements to write |
Definition at line 125 of file SimpleFile.h.
void set_line_buffer_size | ( | int32_t | bufsize | ) |
set the size of the line buffer
bufsize | size of the line buffer |
Definition at line 184 of file SimpleFile.h.
FILE* file [protected] |
file descriptor
Definition at line 204 of file SimpleFile.h.
char* filename [protected] |
filename
Definition at line 210 of file SimpleFile.h.
char* line_buffer [protected] |
line buffer
Definition at line 215 of file SimpleFile.h.
int32_t line_buffer_size [protected] |
size of line buffer
Definition at line 213 of file SimpleFile.h.
bool status [protected] |
status of file operations
Definition at line 206 of file SimpleFile.h.
char task [protected] |
task
Definition at line 208 of file SimpleFile.h.