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) 2009 Soeren Sonnenburg 00008 * Copyright (C) 2009 Berlin Institute of Technology 00009 */ 00010 00011 #ifndef _CDECOMPRESS_STRING__H__ 00012 #define _CDECOMPRESS_STRING__H__ 00013 00014 #include <shogun/features/Features.h> 00015 #include <shogun/features/StringFeatures.h> 00016 #include <shogun/lib/common.h> 00017 #include <shogun/lib/Compressor.h> 00018 #include <shogun/preprocessor/StringPreprocessor.h> 00019 00020 namespace shogun 00021 { 00022 template <class ST> class CStringFeatures; 00023 class CCompressor; 00024 00035 template <class ST> class CDecompressString : public CStringPreprocessor<ST> 00036 { 00037 public: 00039 CDecompressString(); 00040 00043 CDecompressString(E_COMPRESSION_TYPE ct); 00044 00046 virtual ~CDecompressString(); 00047 00049 virtual bool init(CFeatures* f); 00050 00052 virtual void cleanup(); 00053 00055 bool load(FILE* f); 00056 00058 bool save(FILE* f); 00059 00063 virtual bool apply_to_string_features(CFeatures* f); 00064 00066 virtual ST* apply_to_string(ST* f, int32_t &len); 00067 00069 virtual inline const char* get_name() const { return "DecompressString"; } 00070 00072 virtual EPreprocessorType get_type() const; 00073 00074 protected: 00076 CCompressor* compressor; 00077 }; 00078 } 00079 #endif