StringPreProc.h

Go to the documentation of this file.
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 _CSTRINGPREPROC__H__
00012 #define _CSTRINGPREPROC__H__
00013 
00014 #include "features/Features.h"
00015 #include "features/StringFeatures.h"
00016 #include "lib/common.h"
00017 #include "preproc/PreProc.h"
00018 
00019 namespace shogun
00020 {
00021 template <class ST> class CStringFeatures;
00022 
00030 template <class ST> class CStringPreProc : public CPreProc
00031 {
00032     public:
00038         CStringPreProc(const char *name, const char* id) : CPreProc(name, id) {}
00039 
00043         virtual bool apply_to_string_features(CFeatures* f)=0;
00044 
00046         virtual ST* apply_to_string(ST* f, int32_t &len)=0;
00047 
00049         inline virtual EFeatureClass get_feature_class() { return C_STRING; }
00051         inline virtual EFeatureType get_feature_type();
00052 };
00053 
00054 template<> inline EFeatureType CStringPreProc<uint64_t>::get_feature_type()
00055 {
00056     return F_ULONG;
00057 }
00058 
00059 template<> inline EFeatureType CStringPreProc<int64_t>::get_feature_type()
00060 {
00061     return F_LONG;
00062 }
00063 
00064 template<> inline EFeatureType CStringPreProc<uint32_t>::get_feature_type()
00065 {
00066     return F_UINT;
00067 }
00068 
00069 template<> inline EFeatureType CStringPreProc<int32_t>::get_feature_type()
00070 {
00071     return F_INT;
00072 }
00073 
00074 template<> inline EFeatureType CStringPreProc<uint16_t>::get_feature_type()
00075 {
00076     return F_WORD;
00077 }
00078 
00079 template<> inline EFeatureType CStringPreProc<int16_t>::get_feature_type()
00080 {
00081     return F_WORD;
00082 }
00083 
00084 template<> inline EFeatureType CStringPreProc<uint8_t>::get_feature_type()
00085 {
00086     return F_BYTE;
00087 }
00088 
00089 template<> inline EFeatureType CStringPreProc<int8_t>::get_feature_type()
00090 {
00091     return F_BYTE;
00092 }
00093 
00094 template<> inline EFeatureType CStringPreProc<char>::get_feature_type()
00095 {
00096     return F_CHAR;
00097 }
00098 
00099 template<> inline EFeatureType CStringPreProc<bool>::get_feature_type()
00100 {
00101     return F_BOOL;
00102 }
00103 
00104 template<> inline EFeatureType CStringPreProc<float32_t>::get_feature_type()
00105 {
00106     return F_SHORTREAL;
00107 }
00108 
00109 template<> inline EFeatureType CStringPreProc<float64_t>::get_feature_type()
00110 {
00111     return F_DREAL;
00112 }
00113 
00114 template<> inline EFeatureType CStringPreProc<floatmax_t>::get_feature_type()
00115 {
00116     return F_LONGREAL;
00117 }
00118 
00119 }
00120 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation