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<uint16_t>::get_feature_type() 00060 { 00061 return F_WORD; 00062 } 00063 00064 template<> inline EFeatureType CStringPreProc<uint8_t>::get_feature_type() 00065 { 00066 return F_BYTE; 00067 } 00068 00069 template<> inline EFeatureType CStringPreProc<char>::get_feature_type() 00070 { 00071 return F_CHAR; 00072 } 00073 } 00074 #endif