00001 #ifndef CacheNormalDecoder_HPP 00002 #define CacheNormalDecoder_HPP 00003 00008 #include <iterator> 00009 #include "io/codec/decoder/CacheDecoderBase.hpp" 00010 #include "io/FDRepr.hpp" 00011 00012 template <class FR = FDRepr> 00013 class CacheNormalDecoder : public CacheDecoderBase<FR> 00014 { 00015 protected: 00016 typedef CacheDecoderBase<FR> PARENT; 00017 public: 00018 00019 typedef typename CacheDecoderBase<FR>::params_t params_t; 00020 00021 CacheNormalDecoder(const params_t* par) 00022 : CacheDecoderBase<FR>(par){} 00023 00024 static bool DINLINE isDFO() 00025 { 00026 return false; 00027 } 00028 00029 00030 template <typename InputIterator> void writeItemsetAndCounter( 00031 InputIterator first, InputIterator last, 00032 counter_t support ) 00033 { 00034 std::streamsize pos = PARENT::buffer_size; 00035 Formatter::SupportToStringBack(support, PARENT::buffer, pos); 00036 00037 unsigned int length; 00038 while( last != first ) 00039 { 00040 --last; 00041 PARENT::buffer[--pos] = ' '; 00042 length = PARENT::code_inverse[*last].second; 00043 pos -= length; 00044 memcpy( &PARENT::buffer[pos], PARENT::code_inverse[*last].first, 00045 length); 00046 } 00047 writeToFile( &PARENT::buffer[pos], PARENT::buffer_size - pos ); 00048 }; 00049 }; 00050 00051 #endif