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.
公有成员 | |
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_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) |
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 | ( | 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') |
uint8_t * load_byte_data | ( | uint8_t * | target, | |
int64_t & | num | |||
) |
char * load_char_data | ( | char * | target, | |
int64_t & | num | |||
) |
DT* load_data | ( | DT * | target, | |
int64_t & | num | |||
) |
int32_t * load_int_data | ( | int32_t * | target, | |
int64_t & | num | |||
) |
int16_t * load_short_data | ( | int16_t * | target, | |
int64_t & | num | |||
) |
uint16_t * load_word_data | ( | uint16_t * | target, | |
int64_t & | num | |||
) |
int32_t parse_first_header | ( | EFeatureType & | type | ) |
int32_t parse_next_header | ( | EFeatureType & | type | ) |
bool read_char_valued_strings | ( | T_STRING< char > *& | strings, | |
int32_t & | num_str, | |||
int32_t & | max_string_len | |||
) |
bool read_header | ( | ) | [protected] |
bool read_real_valued_dense | ( | float64_t *& | matrix, | |
int32_t & | num_feat, | |||
int32_t & | num_vec | |||
) |
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 |
bool save_byte_data | ( | uint8_t * | src, | |
int64_t | num | |||
) |
bool save_char_data | ( | char * | src, | |
int64_t | num | |||
) |
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_short_data | ( | int16_t * | src, | |
int64_t | num | |||
) |
bool save_shortreal_data | ( | float32_t * | src, | |
int64_t | num | |||
) |
bool save_word_data | ( | uint16_t * | src, | |
int64_t | num | |||
) |
bool write_char_valued_strings | ( | const T_STRING< char > * | strings, | |
int32_t | num_str | |||
) |
bool write_header | ( | ) | [protected] |
bool write_real_valued_dense | ( | const 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 | |||
) |
EFeatureType expected_type [protected] |
int32_t num_header [protected] |