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-2008 Soeren Sonnenburg
00008  * Copyright (C) 1999-2008 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 template <class ST> class CStringFeatures;
00020 
00028 template <class ST> class CStringPreProc : public CPreProc
00029 {
00030     public:
00036         CStringPreProc(const char *name, const char* id) : CPreProc(name, id) {}
00037 
00041         virtual bool apply_to_string_features(CFeatures* f)=0;
00042 
00044         virtual ST* apply_to_string(ST* f, int32_t &len)=0;
00045 
00047         inline virtual EFeatureClass get_feature_class() { return C_STRING; }
00049         inline virtual EFeatureType get_feature_type();
00050 };
00051 
00052 template<> inline EFeatureType CStringPreProc<uint64_t>::get_feature_type()
00053 {
00054     return F_ULONG;
00055 }
00056 
00057 template<> inline EFeatureType CStringPreProc<uint16_t>::get_feature_type()
00058 {
00059     return F_WORD;
00060 }
00061 
00062 template<> inline EFeatureType CStringPreProc<uint8_t>::get_feature_type()
00063 {
00064     return F_BYTE;
00065 }
00066 
00067 template<> inline EFeatureType CStringPreProc<char>::get_feature_type()
00068 {
00069     return F_CHAR;
00070 }
00071 
00072 #endif

SHOGUN Machine Learning Toolbox - Documentation