Features.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _CFEATURES__H__
00014 #define _CFEATURES__H__
00015
00016 #include "lib/common.h"
00017 #include "base/SGObject.h"
00018
00019 enum EFeatureType
00020 {
00021 F_UNKNOWN = 0,
00022 F_CHAR = 10,
00023 F_BYTE = 20,
00024 F_SHORT = 30,
00025 F_WORD = 40,
00026 F_INT = 50,
00027 F_UINT = 60,
00028 F_LONG = 70,
00029 F_ULONG = 80,
00030 F_SHORTREAL = 90,
00031 F_DREAL = 100,
00032 F_LONGREAL = 110,
00033 F_ANY = 1000
00034 };
00035
00036 enum EFeatureClass
00037 {
00038 C_UNKNOWN = 0,
00039 C_SIMPLE = 10,
00040 C_SPARSE = 20,
00041 C_STRING = 30,
00042 C_COMBINED = 40,
00043 C_MINDYGRAM = 50,
00044 C_ANY = 1000
00045 };
00046
00047
00048 #include "preproc/PreProc.h"
00049 class CPreProc;
00050 class CFeatures;
00051
00052
00071 class CFeatures : public CSGObject
00072 {
00073 public:
00078 CFeatures(int32_t size);
00079
00081 CFeatures(const CFeatures& orig);
00082
00087 CFeatures(char* fname);
00088
00095 virtual CFeatures* duplicate() const=0 ;
00096
00097 virtual ~CFeatures();
00098
00105 virtual EFeatureType get_feature_type()=0;
00106
00113 virtual EFeatureClass get_feature_class()=0;
00114
00120 virtual int32_t add_preproc(CPreProc* p);
00121
00127 virtual CPreProc* del_preproc(int32_t num);
00128
00133 CPreProc* get_preproc(int32_t num);
00134
00139 inline void set_preprocessed(int32_t num) { preprocessed[num]=true; }
00140
00145 inline bool is_preprocessed(int32_t num) { return preprocessed[num]; }
00146
00151 int32_t get_num_preprocessed();
00152
00157 inline int32_t get_num_preproc() { return num_preproc; }
00158
00160 void clean_preprocs();
00161
00166 inline int32_t get_cache_size() { return cache_size; };
00167
00174 virtual int32_t get_num_vectors()=0 ;
00175
00184 virtual bool reshape(int32_t num_features, int32_t num_vectors) { return false; }
00185
00192 virtual int32_t get_size()=0;
00193
00195 void list_feature_obj();
00196
00202 virtual bool load(char* fname);
00203
00209 virtual bool save(char* fname);
00210
00216 bool check_feature_compatibility(CFeatures* f);
00217
00218 private:
00220 int32_t cache_size;
00221
00223 CPreProc** preproc;
00224
00226 int32_t num_preproc;
00227
00229 bool* preprocessed;
00230 };
00231 #endif