Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

BinaryDFOutput.hpp

Go to the documentation of this file.
00001 #ifndef BinaryDFOutput_HPP
00002 #define BinaryDFOutput_HPP
00003 
00011 #include <vector>
00012 
00013 #include "io/output/WriteOutput.hpp"  
00014 
00021 template <class WO>
00022 class BinaryDFOutput : public WO
00023 {
00024    public:
00025 
00026       typedef typename WO::params_t params_t;
00027       BinaryDFOutput(const params_t* par)
00028          : WO(par){
00029          output_set.push_back(0);//guard for support
00030          output_set.push_back(0);//guard for itemset length
00031       }
00032 
00033       static bool DINLINE isDFO()
00034       {
00035          return true;
00036       }  
00037 
00038       void pushItem(item_t item)
00039       {
00040          output_set.push_back(item);
00041       }
00042 
00043       void write(counter_t support)
00044       {
00045          output_set[0]=support;
00046          output_set[1]=output_set.size()-2;
00047          writeToFile((char*)&(output_set[0]),output_set.size()*sizeof(item_t));
00048          last_support = support;
00049       }
00050 
00051       void pushItemWithWrite(item_t item, counter_t support)
00052       {
00053          pushItem(item);
00054          write(support);
00055       }
00056          
00057       void pushItemWithPrevSupport(item_t item)
00058       {
00059          pushItemWithWrite(item, last_support);
00060       }
00061          
00062       void popItem()
00063       {
00064          output_set.pop_back();
00065       }
00066 
00067       void popAll() {
00068          output_set.resize(2);
00069       }
00070 
00071    private:
00072       std::vector<item_t> output_set; 
00073       counter_t last_support;
00074 
00075 };
00076 
00077 #endif

Generated on Sun Sep 17 17:50:37 2006 for FIM environment by  doxygen 1.4.4