Public Member Functions | Protected Attributes

CSimpleFile< T > Class Template Reference

Detailed Description

template<class T>
class shogun::CSimpleFile< T >

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.

Inheritance diagram for CSimpleFile< T >:
Inheritance graph

List of all members.

Public Member Functions

 CSimpleFile (void)
 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

Constructor & Destructor Documentation

CSimpleFile ( void   ) 

default constructor

Definition at line 31 of file SimpleFile.h.

CSimpleFile ( char *  fname,
FILE *  f 

constructor rw is either r for read and w for write

fname filename
f file descriptor

Definition at line 46 of file SimpleFile.h.

virtual ~CSimpleFile (  )  [virtual]

Definition at line 54 of file SimpleFile.h.

Member Function Documentation

void free_line_buffer (  ) 

free the line buffer

Definition at line 184 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 160 of file SimpleFile.h.

virtual const char* get_name ( void   )  const [virtual]
object name

Implements CSGObject.

Definition at line 210 of file SimpleFile.h.

bool is_ok (  ) 

check if status is ok

if status is ok

Definition at line 207 of file SimpleFile.h.

T* load ( T *  target,
int64_t &  num = 0 


target load target
num number of read elements
loaded target or NULL if unsuccessful

Definition at line 66 of file SimpleFile.h.

bool save ( T *  target,
int64_t  num 


target target to save to
num number of elements to write
if saving was successful

Definition at line 135 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 194 of file SimpleFile.h.

Member Data Documentation

FILE* file [protected]

file descriptor

Definition at line 214 of file SimpleFile.h.

char* filename [protected]


Definition at line 220 of file SimpleFile.h.

char* line_buffer [protected]

line buffer

Definition at line 225 of file SimpleFile.h.

int32_t line_buffer_size [protected]

size of line buffer

Definition at line 223 of file SimpleFile.h.

bool status [protected]

status of file operations

Definition at line 216 of file SimpleFile.h.

char task [protected]


Definition at line 218 of file SimpleFile.h.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation