SHOGUN v0.9.0
公有成员 | 保护属性
CBinaryStream< T >模板类参考

详细描述

template<class T>
class shogun::CBinaryStream< T >

memory mapped emulation via binary streams (files)

Implements memory mapped file emulation (

参见:
CMemoryMappedFile) via standard file operations like fseek, fread etc

在文件BinaryStream.h27行定义。

继承图,类CBinaryStream< T >
Inheritance graph
[图例]

所有成员的列表。

公有成员

 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
read_next () const
operator[] (int32_t index) const
virtual const char * get_name () const

保护属性

FILE * fd
uint64_t length
char * rw
char * m_fname

构造及析构函数文档

default constructor

在文件BinaryStream.h32行定义。

CBinaryStream ( const char *  fname,
const char *  flag = "r" 
)

constructor

open a file for read mode

参数:
fnamename of file, zero terminated string
flagdetermines read or read write mode (currently only 'r' is supported)

在文件BinaryStream.h47行定义。

CBinaryStream ( const CBinaryStream< T > &  bs)

copy constructor

参数:
bsbinary stream to copy from

在文件BinaryStream.h59行定义。

virtual ~CBinaryStream ( ) [virtual]

destructor

在文件BinaryStream.h67行定义。


成员函数文档

void close_stream ( )

close a file stream

在文件BinaryStream.h95行定义。

uint64_t get_length ( )

get the number of objects of type T cointained in the file

返回:
length of file

在文件BinaryStream.h112行定义。

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.

参数:
lenlength of line (returned via reference)
offsoffset to be passed for reading next line, should be 0 initially (returned via reference)
返回:
line (NOT ZERO TERMINATED)

在文件BinaryStream.h137行定义。

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

实现了CSGObject

在文件BinaryStream.h207行定义。

int32_t get_num_lines ( )

count the number of lines in a file

返回:
number of lines

在文件BinaryStream.h146行定义。

uint64_t get_size ( )

get the size of the file in bytes

返回:
size of file in bytes

在文件BinaryStream.h121行定义。

void open_stream ( const char *  fname,
const char *  flag = "r" 
)

open file stream

参数:
fnamefile name
flagflags "r" for reading etc

在文件BinaryStream.h77行定义。

T operator[] ( int32_t  index) const

operator overload for file read only access

参数:
indexindex
返回:
element at index

在文件BinaryStream.h192行定义。

void pre_buffer ( T *  buffer,
long  index,
long  num 
) const

read num elements starting from index into buffer

参数:
bufferbuffer that has to be at least num elements long
indexindex into file starting from which elements are read
numnumber of elements to be read

在文件BinaryStream.h157行定义。

T read_next ( ) const

read next

返回:
next element

在文件BinaryStream.h176行定义。


成员数据文档

FILE* fd [protected]

file descriptor

在文件BinaryStream.h211行定义。

uint64_t length [protected]

size of file

在文件BinaryStream.h213行定义。

char* m_fname [protected]

fname

在文件BinaryStream.h217行定义。

char* rw [protected]

mode

在文件BinaryStream.h215行定义。


该类的文档由以下文件生成:

SHOGUN Machine Learning Toolbox - Documentation