00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #ifndef Input_Output_Manager_HPP
00010 #define Input_Output_Manager_HPP
00011 
00016 #include "common.hpp"  
00017 #include <fstream>
00018 #include <vector>
00019 #include <set>
00020 using namespace std;
00021 
00022 
00034 class Input_Output_Manager:public ofstream
00035 {
00036 public:
00037 
00038    Input_Output_Manager( ifstream& basket_file,  
00039                          const char* output_file_name );
00040    
00042    int read_in_a_line( set<itemtype>& basket );
00043 
00046    countertype find_frequent_items( 
00047       const double min_supp, vector<countertype>& support_of_items );
00048 
00050    void basket_recode( const set<itemtype>& original_basket, 
00051                        vector<itemtype>& new_basket );
00052 
00054    void write_out_basket( const set<itemtype>& itemset );
00055 
00057    void write_out_basket_and_counter( const set<itemtype>& itemset, 
00058                                       const countertype counter );
00059 
00061    void rewind(); 
00062 
00063    ~Input_Output_Manager( );
00064 
00065 private:
00067    ifstream& basket_file;
00068    
00074    vector<itemtype> new_code;
00075 
00080    vector<itemtype> new_code_inverse;
00081 };
00082 
00083 
00084 #endif