CFile Class Reference
List of all members.
Detailed Description
A file consists of a header then an alternation of a type header and
data
or just raw data (simplefile=true)
the more complex stuff is currently not implemented
Definition at line 32 of file File.h.
|
Public Member Functions |
| CFile (FILE *f) |
| CFile (CHAR *fname, CHAR rw, EFeatureType type, CHAR fourcc[4]=NULL) |
| ~CFile () |
INT | parse_first_header (EFeatureType &type) |
INT | parse_next_header (EFeatureType &type) |
INT * | load_int_data (INT *target, LONG &num) |
DREAL * | load_real_data (DREAL *target, LONG &num) |
SHORTREAL * | load_shortreal_data (SHORTREAL *target, LONG &num) |
CHAR * | load_char_data (CHAR *target, LONG &num) |
BYTE * | load_byte_data (BYTE *target, LONG &num) |
WORD * | load_word_data (WORD *target, LONG &num) |
SHORT * | load_short_data (SHORT *target, LONG &num) |
bool | save_int_data (INT *src, LONG num) |
bool | save_real_data (DREAL *src, LONG num) |
bool | save_shortreal_data (SHORTREAL *src, LONG num) |
bool | save_char_data (CHAR *src, LONG num) |
bool | save_byte_data (BYTE *src, LONG num) |
bool | save_word_data (WORD *src, LONG num) |
bool | save_short_data (SHORT *src, LONG num) |
bool | is_ok () |
bool | read_real_valued_sparse (TSparse< DREAL > *&matrix, INT &num_feat, INT &num_vec) |
bool | write_real_valued_sparse (const TSparse< DREAL > *matrix, INT num_feat, INT num_vec) |
bool | read_real_valued_dense (DREAL *&matrix, INT &num_feat, INT &num_vec) |
bool | write_real_valued_dense (const DREAL *matrix, INT num_feat, INT num_vec) |
bool | read_char_valued_strings (T_STRING< CHAR > *&strings, INT &num_str, INT &max_string_len) |
bool | write_char_valued_strings (const T_STRING< CHAR > *strings, INT num_str) |
Static Public Attributes |
static CParallel | parallel |
static CIO | io |
static CVersion | version |
Protected Member Functions |
bool | read_header () |
bool | write_header () |
Protected Attributes |
FILE * | file |
bool | status |
CHAR | task |
CHAR * | filename |
EFeatureType | expected_type |
INT | num_header |
CHAR | fourcc [4] |
Constructor & Destructor Documentation
CFile::CFile |
( |
FILE * |
f |
) |
|
constructor
- Parameters:
-
Definition at line 24 of file File.cpp.
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
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.
INT * CFile::load_int_data |
( |
INT * |
target, |
|
|
LONG & |
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.
load shortreal data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 104 of file File.cpp.
load short data
- Parameters:
-
| target | loaded data |
| num | number of data elements |
- Returns:
- loaded data
Definition at line 180 of file File.cpp.
bool CFile::save_int_data |
( |
INT * |
src, |
|
|
LONG |
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 |
( |
DREAL * |
src, |
|
|
LONG |
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.
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_char_data |
( |
CHAR * |
src, |
|
|
LONG |
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_byte_data |
( |
BYTE * |
src, |
|
|
LONG |
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_word_data |
( |
WORD * |
src, |
|
|
LONG |
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::save_short_data |
( |
SHORT * |
src, |
|
|
LONG |
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.
check if status is ok
- Returns:
- whether status is ok
Definition at line 188 of file File.h.
bool CFile::read_real_valued_sparse |
( |
TSparse< DREAL > *& |
matrix, |
|
|
INT & |
num_feat, |
|
|
INT & |
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 345 of file File.cpp.
bool CFile::write_real_valued_sparse |
( |
const TSparse< DREAL > * |
matrix, |
|
|
INT |
num_feat, |
|
|
INT |
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 508 of file File.cpp.
bool CFile::read_real_valued_dense |
( |
DREAL *& |
matrix, |
|
|
INT & |
num_feat, |
|
|
INT & |
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 251 of file File.cpp.
bool CFile::write_real_valued_dense |
( |
const DREAL * |
matrix, |
|
|
INT |
num_feat, |
|
|
INT |
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 325 of file File.cpp.
bool CFile::read_char_valued_strings |
( |
T_STRING< CHAR > *& |
strings, |
|
|
INT & |
num_str, |
|
|
INT & |
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 531 of file File.cpp.
bool CFile::write_char_valued_strings |
( |
const T_STRING< CHAR > * |
strings, |
|
|
INT |
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 631 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::write_header |
( |
|
) |
[protected] |
write header
- Returns:
- whether operation was successful
Definition at line 225 of file File.cpp.
Member Data Documentation
file object
Definition at line 278 of file File.h.
status
Definition at line 280 of file File.h.
name of the handled file
Definition at line 284 of file File.h.
expected feature type
Definition at line 286 of file File.h.
number of headers
Definition at line 288 of file File.h.
fourcc
Definition at line 290 of file File.h.
The documentation for this class was generated from the following files: