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-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _CSIMPLEPREPROC__H__ 00012 #define _CSIMPLEPREPROC__H__ 00013 00014 #include <shogun/features/Features.h> 00015 #include <shogun/features/SimpleFeatures.h> 00016 #include <shogun/lib/common.h> 00017 #include <shogun/preprocessor/Preprocessor.h> 00018 00019 namespace shogun 00020 { 00021 template <class ST> class CSimpleFeatures; 00022 00031 template <class ST> class CSimplePreprocessor : public CPreprocessor 00032 { 00033 public: 00036 CSimplePreprocessor() : CPreprocessor() {} 00037 00041 virtual SGMatrix<ST> apply_to_feature_matrix(CFeatures* features)=0; 00042 00045 virtual SGVector<ST> apply_to_feature_vector(SGVector<ST> vector)=0; 00046 00048 virtual inline EFeatureClass get_feature_class() { return C_SIMPLE; } 00050 virtual inline EFeatureType get_feature_type(); 00051 00053 virtual inline EPreprocessorType get_type() const { return P_UNKNOWN; } 00054 00055 }; 00056 00057 template<> inline EFeatureType CSimplePreprocessor<float64_t>::get_feature_type() 00058 { 00059 return F_DREAL; 00060 } 00061 00062 template<> inline EFeatureType CSimplePreprocessor<int16_t>::get_feature_type() 00063 { 00064 return F_SHORT; 00065 } 00066 00067 template<> inline EFeatureType CSimplePreprocessor<uint16_t>::get_feature_type() 00068 { 00069 return F_WORD; 00070 } 00071 00072 template<> inline EFeatureType CSimplePreprocessor<char>::get_feature_type() 00073 { 00074 return F_CHAR; 00075 } 00076 00077 template<> inline EFeatureType CSimplePreprocessor<uint8_t>::get_feature_type() 00078 { 00079 return F_BYTE; 00080 } 00081 00082 template<> inline EFeatureType CSimplePreprocessor<uint64_t>::get_feature_type() 00083 { 00084 return F_ULONG; 00085 } 00086 } 00087 #endif