$treeview $search $mathjax
00001 // STL 00002 #include <cassert> 00003 #include <string> 00004 #include <map> 00005 #include <iostream> 00006 #include <sstream> 00007 // TraDemGen 00008 #include <test/trademgen/EventStream.hpp> 00009 #include <test/trademgen/CategoricalAttribute.hpp> 00010 00011 // ///////////// M A I N ////////////////// 00012 int main (int argc, char* const argv[]) { 00013 // input: seed, rate 00014 unsigned long int seed = 2; 00015 00016 if (argc >= 2) { 00017 std::istringstream iStream (argv[1]); 00018 iStream >> seed; 00019 } 00020 00021 // create event stream 00022 TRADEMGEN::EventStream e (seed); 00023 e.setKey("hello"); 00024 e.setRate(2.0); 00025 00026 // get rate 00027 // const double r = e.getRate(); 00028 std::cout << "Seed: " << seed << std::endl << std::endl; 00029 00030 // create instances 00031 for (int i=0; i<10; i++) { 00032 e.generateNext(); 00033 } 00034 00035 // display events 00036 e.displayAllEvents(std::cout); 00037 00038 00039 // ///////////////////////////////////////////////////// 00040 // attributes 00041 std::map<int, float> M; 00042 M[1] = 0.1; 00043 M[17] = 0.7; 00044 M[77] = 0.2; 00045 TRADEMGEN::CategoricalAttribute C (M); 00046 00047 return 0; 00048 }