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

vector/FrequentItemInserter.hpp

Go to the documentation of this file.
00001 #ifndef FrequentItemInserter_HPP
00002 #define FrequentItemInserter_HPP
00003 
00004 #include "apriori/bodon-vector/vector_typedef.hpp"
00005 #include "common.hpp"
00006 #include <vector>
00007 //#include <cstdio>
00008 //#include <iterator>   //for test
00009 
00010 
00011 namespace Bodon
00012 {
00013 namespace vector_based
00014 {
00015 template <class DATASTRUCTURE, class D>
00016 class FrequentItemInserter
00017 {
00018    protected:
00019       D& decoder;
00020    public:
00021       FrequentItemInserter<DATASTRUCTURE, D>( DATASTRUCTURE& candidates, 
00022                                D& decoder ) :
00023          decoder(decoder) {}
00024 
00026       void setEmptysetSupport(const counter_t emptyset_support)
00027       {
00028          std::vector<item_t> itemset;
00029          decoder.writeItemsetAndCounter(
00030             itemset.begin(), itemset.end(), emptyset_support);
00031       }
00032 
00034       void insertFrequentItems(const std::vector<counter_t>& freq_counters )
00035       {
00036          std::vector<item_t> itemset;
00037          for(std::vector<counter_t>::size_type index=0; 
00038              index< freq_counters.size(); ++index )
00039          {
00040             itemset.push_back(index);
00041             decoder.writeItemsetAndCounter(
00042                itemset.begin(), itemset.end(), freq_counters[index]);
00043             itemset.pop_back();
00044          }
00045       }
00046 };
00047 }
00048 }
00049 
00050 #endif

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