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 
00022 template <class ST> class CStringPreProc : public CPreProc
00023 {
00024     public:
00030         CStringPreProc(const CHAR *name, const CHAR* id) : CPreProc(name, id) {}
00031 
00035         virtual bool apply_to_string_features(CFeatures* f)=0;
00036 
00038         virtual ST* apply_to_string(ST* f, INT &len)=0;
00039 
00041         inline virtual EFeatureClass get_feature_class() { return C_STRING; }
00043         inline virtual EFeatureType get_feature_type();
00044 };
00045 
00046 template<> inline EFeatureType CStringPreProc<ULONG>::get_feature_type()
00047 {
00048     return F_ULONG;
00049 }
00050 
00051 template<> inline EFeatureType CStringPreProc<WORD>::get_feature_type()
00052 {
00053     return F_WORD;
00054 }
00055 
00056 template<> inline EFeatureType CStringPreProc<BYTE>::get_feature_type()
00057 {
00058     return F_BYTE;
00059 }
00060 
00061 template<> inline EFeatureType CStringPreProc<CHAR>::get_feature_type()
00062 {
00063     return F_CHAR;
00064 }
00065 
00066 #endif

SHOGUN Machine Learning Toolbox - Documentation