TraDemGen Logo  1.00.8
C++ Simulated Travel Demand Generation Library
Loading...
Searching...
No Matches
generateEvents.cpp
Go to the documentation of this file.
1// STL
2#include <cassert>
3#include <string>
4#include <map>
5#include <iostream>
6#include <sstream>
7// TraDemGen
8#include <test/trademgen/EventStream.hpp>
9#include <test/trademgen/CategoricalAttribute.hpp>
10
11// ///////////// M A I N //////////////////
12int main (int argc, char* const argv[]) {
13 // input: seed, rate
14 unsigned long int seed = 2;
15
16 if (argc >= 2) {
17 std::istringstream iStream (argv[1]);
18 iStream >> seed;
19 }
20
21 // create event stream
22 TRADEMGEN::EventStream e (seed);
23 e.setKey("hello");
24 e.setRate(2.0);
25
26 // get rate
27 // const double r = e.getRate();
28 std::cout << "Seed: " << seed << std::endl << std::endl;
29
30 // create instances
31 for (int i=0; i<10; i++) {
32 e.generateNext();
33 }
34
35 // display events
36 e.displayAllEvents(std::cout);
37
38
39 // /////////////////////////////////////////////////////
40 // attributes
41 std::map<int, float> M;
42 M[1] = 0.1;
43 M[17] = 0.7;
44 M[77] = 0.2;
45 TRADEMGEN::CategoricalAttribute C (M);
46
47 return 0;
48}
int main(int argc, char *const argv[])