|
SHOGUN
v1.1.0
|
memory mapped emulation via binary streams (files)
Implements memory mapped file emulation (
Definition at line 27 of file BinaryStream.h.

Public Member Functions | |
| CBinaryStream () | |
| CBinaryStream (const char *fname, const char *flag="r") | |
| CBinaryStream (const CBinaryStream &bs) | |
| virtual | ~CBinaryStream () |
| void | open_stream (const char *fname, const char *flag="r") |
| void | close_stream () |
| uint64_t | get_length () |
| uint64_t | get_size () |
| char * | get_line (uint64_t &len, uint64_t &offs) |
| int32_t | get_num_lines () |
| void | pre_buffer (T *buffer, long index, long num) const |
| T | read_next () const |
| T | operator[] (int32_t index) const |
| virtual const char * | get_name () const |
Public Member Functions inherited from CSGObject | |
| CSGObject () | |
| CSGObject (const CSGObject &orig) | |
| virtual | ~CSGObject () |
| virtual bool | is_generic (EPrimitiveType *generic) const |
| template<class T > | |
| void | set_generic () |
| void | unset_generic () |
| virtual void | print_serializable (const char *prefix="") |
| virtual bool | save_serializable (CSerializableFile *file, const char *prefix="") |
| virtual bool | load_serializable (CSerializableFile *file, const char *prefix="") |
| void | set_global_io (SGIO *io) |
| SGIO * | get_global_io () |
| void | set_global_parallel (Parallel *parallel) |
| Parallel * | get_global_parallel () |
| void | set_global_version (Version *version) |
| Version * | get_global_version () |
| SGVector< char * > | get_modelsel_names () |
| char * | get_modsel_param_descr (const char *param_name) |
| index_t | get_modsel_param_index (const char *param_name) |
Protected Attributes | |
| FILE * | fd |
| uint64_t | length |
| char * | rw |
| char * | m_fname |
Additional Inherited Members | |
Public Attributes inherited from CSGObject | |
| SGIO * | io |
| Parallel * | parallel |
| Version * | version |
| Parameter * | m_parameters |
| Parameter * | m_model_selection_parameters |
Protected Member Functions inherited from CSGObject | |
| virtual void | load_serializable_pre () throw (ShogunException) |
| virtual void | load_serializable_post () throw (ShogunException) |
| virtual void | save_serializable_pre () throw (ShogunException) |
| virtual void | save_serializable_post () throw (ShogunException) |
| CBinaryStream | ( | ) |
default constructor
Definition at line 32 of file BinaryStream.h.
| CBinaryStream | ( | const char * | fname, |
| const char * | flag = "r" |
||
| ) |
constructor
open a file for read mode
| fname | name of file, zero terminated string |
| flag | determines read or read write mode (currently only 'r' is supported) |
Definition at line 47 of file BinaryStream.h.
| CBinaryStream | ( | const CBinaryStream< T > & | bs | ) |
copy constructor
| bs | binary stream to copy from |
Definition at line 59 of file BinaryStream.h.
|
virtual |
destructor
Definition at line 67 of file BinaryStream.h.
| void close_stream | ( | ) |
close a file stream
Definition at line 95 of file BinaryStream.h.
| uint64_t get_length | ( | ) |
get the number of objects of type T cointained in the file
Definition at line 112 of file BinaryStream.h.
| char* get_line | ( | uint64_t & | len, |
| uint64_t & | offs | ||
| ) |
get next line from file
The returned line may be modfied in case the file was opened read/write. It is otherwise read-only.
| len | length of line (returned via reference) |
| offs | offset to be passed for reading next line, should be 0 initially (returned via reference) |
Definition at line 137 of file BinaryStream.h.
|
virtual |
| int32_t get_num_lines | ( | ) |
count the number of lines in a file
Definition at line 146 of file BinaryStream.h.
| uint64_t get_size | ( | ) |
get the size of the file in bytes
Definition at line 121 of file BinaryStream.h.
| void open_stream | ( | const char * | fname, |
| const char * | flag = "r" |
||
| ) |
open file stream
| fname | file name |
| flag | flags "r" for reading etc |
Definition at line 77 of file BinaryStream.h.
| T operator[] | ( | int32_t | index | ) | const |
operator overload for file read only access
| index | index |
Definition at line 192 of file BinaryStream.h.
| void pre_buffer | ( | T * | buffer, |
| long | index, | ||
| long | num | ||
| ) | const |
read num elements starting from index into buffer
| buffer | buffer that has to be at least num elements long |
| index | index into file starting from which elements are read |
| num | number of elements to be read |
Definition at line 157 of file BinaryStream.h.
| T read_next | ( | ) | const |
|
protected |
file descriptor
Definition at line 211 of file BinaryStream.h.
|
protected |
size of file
Definition at line 213 of file BinaryStream.h.
|
protected |
fname
Definition at line 217 of file BinaryStream.h.
|
protected |
mode
Definition at line 215 of file BinaryStream.h.