CFile Class Reference
List of all members.
|
Public Member Functions |
| CFile (FILE *f) |
| CFile (char *fname, char rw, EFeatureType type, char fourcc[4]=NULL) |
| ~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_t * | load_real_data (float64_t *target, int64_t &num) |
float32_t * | load_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) |
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) |
Protected Member Functions |
bool | read_header () |
bool | write_header () |
Protected Attributes |
FILE * | file |
bool | status |
char | task |
char * | filename |
EFeatureType | expected_type |
int32_t | num_header |
char | fourcc [4] |
Detailed Description
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.
Definition at line 31 of file File.h.
Constructor & Destructor Documentation
CFile::CFile |
( |
FILE * |
f |
) |
|
constructor
- Parameters:
-
Definition at line 24 of file File.cpp.
CFile::CFile |
( |
char * |
fname, |
|
|
char |
rw, |
|
|
EFeatureType |
type, |
|
|
char |
fourcc[4] = NULL | |
|
) |
| | |
constructor
- Parameters:
-
| 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') |
Definition at line 32 of file File.cpp.
Member Function Documentation
check if status is ok
- Returns:
- whether status is ok
Definition at line 187 of file File.h.
uint8_t * CFile::load_byte_data |
( |
uint8_t * |
target, |
|
|
int64_t & |
num | |
|
) |
| | |
char * CFile::load_char_data |
( |
char * |
target, |
|
|
int64_t & |
num | |
|
) |
| | |
int32_t * CFile::load_int_data |
( |
int32_t * |
target, |
|
|
int64_t & |
num | |
|
) |
| | |
load integer data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 78 of file File.cpp.
load real data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 95 of file File.cpp.
int16_t * CFile::load_short_data |
( |
int16_t * |
target, |
|
|
int64_t & |
num | |
|
) |
| | |
load short data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 180 of file File.cpp.
load shortreal data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 104 of file File.cpp.
uint16_t * CFile::load_word_data |
( |
uint16_t * |
target, |
|
|
int64_t & |
num | |
|
) |
| | |
parse first header - defunct!
- Parameters:
-
- Returns:
- -1
Definition at line 197 of file File.cpp.
parse next header - defunct!
- Parameters:
-
- Returns:
- -1
Definition at line 202 of file File.cpp.
bool CFile::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
- Parameters:
-
| strings | strings to read into |
| num_str | number of strings |
| max_string_len | length of longest string |
- Returns:
- if reading was successful
Definition at line 536 of file File.cpp.
bool CFile::read_header |
( |
|
) |
[protected] |
read header
- Returns:
- whether operation was successful
Definition at line 208 of file File.cpp.
bool CFile::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
- Parameters:
-
| matrix | matrix to read into |
| num_feat | number of features for each vector |
| num_vec | number of vectors in matrix |
- Returns:
- if reading was successful
Definition at line 252 of file File.cpp.
bool CFile::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
- Parameters:
-
| matrix | matrix to read into |
| num_feat | number of features for each vector |
| num_vec | number of vectors in matrix |
- Returns:
- if reading was successful
Definition at line 348 of file File.cpp.
bool CFile::save_byte_data |
( |
uint8_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save byte data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 155 of file File.cpp.
bool CFile::save_char_data |
( |
char * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save char data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 138 of file File.cpp.
bool CFile::save_int_data |
( |
int32_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save integer data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 87 of file File.cpp.
bool CFile::save_real_data |
( |
float64_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save real data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 113 of file File.cpp.
bool CFile::save_short_data |
( |
int16_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save short data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 189 of file File.cpp.
bool CFile::save_shortreal_data |
( |
float32_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save shortreal data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 121 of file File.cpp.
bool CFile::save_word_data |
( |
uint16_t * |
src, |
|
|
int64_t |
num | |
|
) |
| | |
save word data
- Parameters:
-
| src | data to save |
| num | number of data elements |
- Returns:
- whether operation was successful
Definition at line 172 of file File.cpp.
bool CFile::write_char_valued_strings |
( |
const T_STRING< char > * |
strings, |
|
|
int32_t |
num_str | |
|
) |
| | |
write char string features, simple ascii format
- Parameters:
-
| strings | strings to write |
| num_str | number of strings |
- Returns:
- if writing was successful
Definition at line 637 of file File.cpp.
bool CFile::write_header |
( |
|
) |
[protected] |
write header
- Returns:
- whether operation was successful
Definition at line 225 of file File.cpp.
bool CFile::write_real_valued_dense |
( |
const float64_t * |
matrix, |
|
|
int32_t |
num_feat, |
|
|
int32_t |
num_vec | |
|
) |
| | |
write dense real valued features, simple ascii format
- Parameters:
-
| matrix | matrix to write |
| num_feat | number of features for each vector |
| num_vec | number of vectros in matrix |
- Returns:
- if writing was successful
Definition at line 327 of file File.cpp.
bool CFile::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
- Parameters:
-
| matrix | matrix to write |
| num_feat | number of features for each vector |
| num_vec | number of vectros in matrix |
- Returns:
- if writing was successful
Definition at line 512 of file File.cpp.
Member Data Documentation
expected feature type
Definition at line 289 of file File.h.
file object
Definition at line 281 of file File.h.
name of the handled file
Definition at line 287 of file File.h.
fourcc
Definition at line 293 of file File.h.
number of headers
Definition at line 291 of file File.h.
status
Definition at line 283 of file File.h.
The documentation for this class was generated from the following files: