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

InputreaderTester.cpp

Go to the documentation of this file.
00001 
00006 #include "test/io/input/InputreaderTester.hpp"
00007 #include "io/input/transaction_reader/SimpleTransactionReader.hpp"
00008 #include "io/StreamRepr.hpp"
00009 #include "io/FILERepr.hpp"
00010 #include "io/FDRepr.hpp"
00011 
00012 #include <iostream>
00013 
00014 void InputreaderTester::usageSimpleInput()
00015 {
00016    std::cerr << "\nUsage: input_test file_repr reader input_file_name lowlevel_buffer_size [nr_of_scan]\n ";
00017    std::cerr << " The possible file representations are:"<<std::endl;
00018    std::cerr << " file_repr\t {filedes, FILE, stream}"<<std::endl;
00019    std::cerr << " reader\t {simple, lars, bracz}"<<std::endl;
00020    std::cerr << " The size of the low level buffer will be lowlevel_buffer_size."<<std::endl;
00021 }
00022 
00023 void InputreaderTester::doTest( int argc, char *argv[] )
00024 {
00025    if( argc < 5 )
00026       usageSimpleInput();
00027    else
00028    {
00029       std::streamsize lowlevel_buffer_size = atoi(argv[4]);
00030       log_info(0,"Low level buffer size is set to %d.", lowlevel_buffer_size);
00031       unsigned int nr_of_scan;
00032       if(argc == 6)
00033          nr_of_scan = atoi(argv[5]);
00034       else 
00035          // Most FIM algorithms read the original transaction database two times.
00036          nr_of_scan = 2;
00037       log_info(0,"The number of scan is set to %d.", nr_of_scan);
00038       if( strcmp(argv[2], "simple") == 0)
00039       {
00040          log_info(0,"Simple transaction reader is selected for test.");
00041          if(strcmp(argv[1],"stream") == 0)
00042             readDatabase<SimpleTransactionReader>(argv[3], nr_of_scan, lowlevel_buffer_size);
00043          else
00044             std::cerr<<"\nOnly stream file representation is implemented for simple reader ;("<<std::endl;
00045       }
00046       else if( strcmp(argv[1],"filedes") == 0) 
00047       {
00048          log_info(0,"filedes is selected as a file representation.");
00049          selectReader<FDRepr>(argv[2], argv[3], nr_of_scan, lowlevel_buffer_size);
00050       }
00051       else if( strcmp(argv[1],"FILE") == 0) 
00052       {
00053          log_info(0,"FILE* is selected as a file representation.");
00054          selectReader<FILERepr>(argv[2], argv[3], nr_of_scan, lowlevel_buffer_size);
00055       }
00056       else if( strcmp(argv[1],"stream") == 0)
00057       {
00058          log_info(0,"std::ifstream is selected as a file representation.");
00059          selectReader<StreamRepr>(argv[2], argv[3], nr_of_scan, lowlevel_buffer_size);
00060       }
00061       else
00062          usageSimpleInput();
00063    }
00064 }

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