公有成员 | 保护属性

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

构造及析构函数文档

CBinaryStream (  ) 

default constructor

在文件BinaryStream.h32行定义。

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)

在文件BinaryStream.h47行定义。

CBinaryStream ( const CBinaryStream< T > &  bs  ) 

copy constructor

参数:
bs binary stream to copy from

在文件BinaryStream.h58行定义。

virtual ~CBinaryStream (  )  [virtual]

destructor

在文件BinaryStream.h66行定义。


成员函数文档

void close_stream (  ) 

close a file stream

在文件BinaryStream.h94行定义。

uint64_t get_length (  ) 

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

返回:
length of file

在文件BinaryStream.h111行定义。

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)
返回:
line (NOT ZERO TERMINATED)

在文件BinaryStream.h136行定义。

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

实现了CSGObject

在文件BinaryStream.h206行定义。

int32_t get_num_lines (  ) 

count the number of lines in a file

返回:
number of lines

在文件BinaryStream.h145行定义。

uint64_t get_size (  ) 

get the size of the file in bytes

返回:
size of file in bytes

在文件BinaryStream.h120行定义。

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

open file stream

参数:
fname file name
flag flags "r" for reading etc

在文件BinaryStream.h76行定义。

T operator[] ( int32_t  index  )  const

operator overload for file read only access

参数:
index index
返回:
element at index

在文件BinaryStream.h191行定义。

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

在文件BinaryStream.h156行定义。

T read_next (  )  const

read next

返回:
next element

在文件BinaryStream.h175行定义。


成员数据文档

FILE* fd [protected]

file descriptor

在文件BinaryStream.h210行定义。

uint64_t length [protected]

size of file

在文件BinaryStream.h212行定义。

char* m_fname [protected]

fname

在文件BinaryStream.h216行定义。

char* rw [protected]

mode

在文件BinaryStream.h214行定义。


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

SHOGUN Machine Learning Toolbox - Documentation