00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 1999-2008 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society 00010 */ 00011 00012 00013 #ifndef _CFEATURES__H__ 00014 #define _CFEATURES__H__ 00015 00016 #include "lib/common.h" 00017 #include "base/SGObject.h" 00018 00019 #include "preproc/PreProc.h" 00020 00021 class CPreProc; 00022 class CFeatures; 00023 00027 class CFeatures : public CSGObject 00028 { 00029 public: 00034 CFeatures(INT size); 00035 00037 CFeatures(const CFeatures& orig); 00038 00043 CFeatures(CHAR* fname); 00044 00051 virtual CFeatures* duplicate() const=0 ; 00052 00053 virtual ~CFeatures(); 00054 00061 virtual EFeatureType get_feature_type()=0; 00062 00069 virtual EFeatureClass get_feature_class()=0; 00070 00076 virtual INT add_preproc(CPreProc* p); 00077 00083 virtual CPreProc* del_preproc(INT num); 00084 00089 CPreProc* get_preproc(INT num); 00090 00095 inline void set_preprocessed(INT num) { preprocessed[num]=true; } 00096 00101 inline bool is_preprocessed(INT num) { return preprocessed[num]; } 00102 00107 INT get_num_preprocessed(); 00108 00113 inline INT get_num_preproc() { return num_preproc; } 00114 00116 void clean_preprocs(); 00117 00122 inline INT get_cache_size() { return cache_size; }; 00123 00130 virtual INT get_num_vectors()=0 ; 00131 00140 virtual bool reshape(INT num_features, INT num_vectors) { return false; } 00141 00148 virtual INT get_size()=0; 00149 00151 void list_feature_obj(); 00152 00158 virtual bool load(CHAR* fname); 00159 00165 virtual bool save(CHAR* fname); 00166 00172 bool check_feature_compatibility(CFeatures* f); 00173 00174 private: 00176 INT cache_size; 00177 00179 CPreProc** preproc; 00180 00182 INT num_preproc; 00183 00185 bool* preprocessed; 00186 }; 00187 #endif