CFile类参考


详细描述

A File access class.

A file consists of a fourcc header then an alternation of a type header and data or just raw data (simplefile=true). However this implementation is not complete - the more complex stuff is currently not implemented.

在文件File.h40行定义。

继承图,类CFile
Inheritance graph
[图例]

所有成员的列表。

公有成员

 CFile (FILE *f)
 CFile (char *fname, char rw, EFeatureType type, char fourcc[4]=NULL)
virtual ~CFile ()
int32_t parse_first_header (EFeatureType &type)
int32_t parse_next_header (EFeatureType &type)
int32_t * load_int_data (int32_t *target, int64_t &num)
float64_tload_real_data (float64_t *target, int64_t &num)
float32_tload_shortreal_data (float32_t *target, int64_t &num)
char * load_char_data (char *target, int64_t &num)
uint8_t * load_byte_data (uint8_t *target, int64_t &num)
uint16_t * load_word_data (uint16_t *target, int64_t &num)
int16_t * load_short_data (int16_t *target, int64_t &num)
template<class DT >
DT * load_data (DT *target, int64_t &num)
template<class DT >
bool save_data (DT *src, int64_t num)
bool save_int_data (int32_t *src, int64_t num)
bool save_real_data (float64_t *src, int64_t num)
bool save_shortreal_data (float32_t *src, int64_t num)
bool save_char_data (char *src, int64_t num)
bool save_byte_data (uint8_t *src, int64_t num)
bool save_word_data (uint16_t *src, int64_t num)
bool save_short_data (int16_t *src, int64_t num)
bool is_ok ()
bool read_real_valued_sparse (TSparse< float64_t > *&matrix, int32_t &num_feat, int32_t &num_vec)
bool write_real_valued_sparse (const TSparse< float64_t > *matrix, int32_t num_feat, int32_t num_vec)
bool read_real_valued_dense (float64_t *&matrix, int32_t &num_feat, int32_t &num_vec)
bool write_real_valued_dense (const float64_t *matrix, int32_t num_feat, int32_t num_vec)
bool read_char_valued_strings (T_STRING< char > *&strings, int32_t &num_str, int32_t &max_string_len)
bool write_char_valued_strings (const T_STRING< char > *strings, int32_t num_str)
virtual const char * get_name () const

保护成员

bool read_header ()
bool write_header ()

保护属性

FILE * file
bool status
char task
char * filename
EFeatureType expected_type
int32_t num_header
char fourcc [4]

构造及析构函数文档

CFile ( FILE *  f  ) 

constructor

参数:
f already opened file

在文件File.cpp25行定义。

CFile ( char *  fname,
char  rw,
EFeatureType  type,
char  fourcc[4] = NULL 
)

constructor

参数:
fname filename to open
rw mode, 'r' or 'w'
type specifies the datatype used in the file (F_INT,...)
fourcc in the case fourcc is 0, type will be ignored and the file is treated as if it has a header/[typeheader,data]+ else the files header will be checked to contain the specified fourcc (e.g. 'RFEA')

在文件File.cpp33行定义。

~CFile (  )  [virtual]

在文件File.cpp70行定义。


成员函数文档

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

实现了CSGObject

在文件File.h300行定义。

bool is_ok (  ) 

check if status is ok

返回:
whether status is ok

在文件File.h223行定义。

uint8_t * load_byte_data ( uint8_t *  target,
int64_t &  num 
)

load byte data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp147行定义。

char * load_char_data ( char *  target,
int64_t &  num 
)

load char data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp130行定义。

DT* load_data ( DT *  target,
int64_t &  num 
)

load data (templated)

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.h142行定义。

int32_t * load_int_data ( int32_t *  target,
int64_t &  num 
)

load integer data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp79行定义。

float64_t * load_real_data ( float64_t target,
int64_t &  num 
)

load real data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp96行定义。

int16_t * load_short_data ( int16_t *  target,
int64_t &  num 
)

load short data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp181行定义。

float32_t * load_shortreal_data ( float32_t target,
int64_t &  num 
)

load shortreal data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp105行定义。

uint16_t * load_word_data ( uint16_t *  target,
int64_t &  num 
)

load word data

参数:
target loaded data
num number of data elements
返回:
loaded data

在文件File.cpp164行定义。

int32_t parse_first_header ( EFeatureType type  ) 

parse first header - defunct!

参数:
type feature type
返回:
-1

在文件File.cpp198行定义。

int32_t parse_next_header ( EFeatureType type  ) 

parse next header - defunct!

参数:
type feature type
返回:
-1

在文件File.cpp203行定义。

bool read_char_valued_strings ( T_STRING< char > *&  strings,
int32_t &  num_str,
int32_t &  max_string_len 
)

read char string features, simple ascii format e.g. foo bar ACGTACGTATCT

two strings

参数:
strings strings to read into
num_str number of strings
max_string_len length of longest string
返回:
if reading was successful

在文件File.cpp537行定义。

bool read_header (  )  [protected]

read header

返回:
whether operation was successful

在文件File.cpp209行定义。

bool read_real_valued_dense ( float64_t *&  matrix,
int32_t &  num_feat,
int32_t &  num_vec 
)

read dense real valued features, simple ascii format e.g. 1.0 1.1 0.2 2.3 3.5 5

a matrix that consists of 3 vectors with each of 2d

参数:
matrix matrix to read into
num_feat number of features for each vector
num_vec number of vectors in matrix
返回:
if reading was successful

在文件File.cpp253行定义。

bool read_real_valued_sparse ( TSparse< float64_t > *&  matrix,
int32_t &  num_feat,
int32_t &  num_vec 
)

read sparse real valued features in svm light format e.g. -1 1:10.0 2:100.2 1000:1.3 with -1 == (optional) label and dim 1 - value 10.0 dim 2 - value 100.2 dim 1000 - value 1.3

参数:
matrix matrix to read into
num_feat number of features for each vector
num_vec number of vectors in matrix
返回:
if reading was successful

在文件File.cpp349行定义。

bool save_byte_data ( uint8_t *  src,
int64_t  num 
)

save byte data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp156行定义。

bool save_char_data ( char *  src,
int64_t  num 
)

save char data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp139行定义。

bool save_data ( DT *  src,
int64_t  num 
)

save data (templated)

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.h156行定义。

bool save_int_data ( int32_t *  src,
int64_t  num 
)

save integer data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp88行定义。

bool save_real_data ( float64_t src,
int64_t  num 
)

save real data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp114行定义。

bool save_short_data ( int16_t *  src,
int64_t  num 
)

save short data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp190行定义。

bool save_shortreal_data ( float32_t src,
int64_t  num 
)

save shortreal data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp122行定义。

bool save_word_data ( uint16_t *  src,
int64_t  num 
)

save word data

参数:
src data to save
num number of data elements
返回:
whether operation was successful

在文件File.cpp173行定义。

bool write_char_valued_strings ( const T_STRING< char > *  strings,
int32_t  num_str 
)

write char string features, simple ascii format

参数:
strings strings to write
num_str number of strings
返回:
if writing was successful

在文件File.cpp638行定义。

bool write_header (  )  [protected]

write header

返回:
whether operation was successful

在文件File.cpp226行定义。

bool write_real_valued_dense ( const float64_t matrix,
int32_t  num_feat,
int32_t  num_vec 
)

write dense real valued features, simple ascii format

参数:
matrix matrix to write
num_feat number of features for each vector
num_vec number of vectros in matrix
返回:
if writing was successful

在文件File.cpp328行定义。

bool write_real_valued_sparse ( const TSparse< float64_t > *  matrix,
int32_t  num_feat,
int32_t  num_vec 
)

write sparse real valued features in svm light format

参数:
matrix matrix to write
num_feat number of features for each vector
num_vec number of vectros in matrix
返回:
if writing was successful

在文件File.cpp513行定义。


成员数据文档

expected feature type

在文件File.h328行定义。

FILE* file [protected]

file object

在文件File.h320行定义。

char* filename [protected]

name of the handled file

在文件File.h326行定义。

char fourcc[4] [protected]

fourcc

在文件File.h332行定义。

int32_t num_header [protected]

number of headers

在文件File.h330行定义。

bool status [protected]

status

在文件File.h322行定义。

char task [protected]

task

在文件File.h324行定义。


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

SHOGUN Machine Learning Toolbox - Documentation