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 _STRINGKERNEL_H___ 00012 #define _STRINGKERNEL_H___ 00013 00014 #include "kernel/Kernel.h" 00015 #include "features/StringFeatures.h" 00016 00018 template <class ST> class CStringKernel : public CKernel 00019 { 00020 public: 00025 CStringKernel(INT cachesize) : CKernel(cachesize) {} 00026 00032 CStringKernel(CFeatures *l, CFeatures *r) : CKernel(10) 00033 { 00034 init(l, r); 00035 } 00036 00047 virtual bool init(CFeatures* l, CFeatures* r) 00048 { 00049 CKernel::init(l,r); 00050 00051 ASSERT(l->get_feature_class()==C_STRING); 00052 ASSERT(r->get_feature_class()==C_STRING); 00053 ASSERT(l->get_feature_type()==this->get_feature_type()); 00054 ASSERT(r->get_feature_type()==this->get_feature_type()); 00055 00056 return true; 00057 } 00058 00063 inline virtual EFeatureClass get_feature_class() { return C_STRING; } 00064 00069 virtual EFeatureType get_feature_type(); 00070 }; 00071 00072 template<> inline EFeatureType CStringKernel<DREAL>::get_feature_type() { return F_DREAL; } 00073 00074 template<> inline EFeatureType CStringKernel<ULONG>::get_feature_type() { return F_ULONG; } 00075 00076 template<> inline EFeatureType CStringKernel<INT>::get_feature_type() { return F_INT; } 00077 00078 template<> inline EFeatureType CStringKernel<WORD>::get_feature_type() { return F_WORD; } 00079 00080 template<> inline EFeatureType CStringKernel<SHORT>::get_feature_type() { return F_SHORT; } 00081 00082 template<> inline EFeatureType CStringKernel<BYTE>::get_feature_type() { return F_BYTE; } 00083 00084 template<> inline EFeatureType CStringKernel<CHAR>::get_feature_type() { return F_CHAR; } 00085 00086 #endif /* _STRINGKERNEL_H__ */ 00087