name function added to filters
[metaproxy-moved-to-github.git] / src / design_main.cpp
1
2 #include <iostream>
3 #include  "design.h"
4
5
6
7 int main(int argc, char **argv) {
8
9    // test filter set/get/exception
10   try {
11     std::cout << "\nTRY" << "\n";
12     yp2::Filter filter;
13     
14     filter.name("filter1");
15     std::cout << "filter: " << filter.name() << "\n";
16
17     filter.name() = "filter1 rename";
18     std::cout << "filter: " << filter.name() << "\n";
19
20     throw yp2::Filter_Exception("finished");
21   }
22   catch (std::exception &e) {
23     std::cout << e.what() << "\n";
24   }
25
26   
27   try {
28     std::cout << "\nTRY" << "\n";
29
30     yp2::Filter filter1;
31     filter1.name("filter1");
32     
33     yp2::Filter filter2;
34     filter2.name() = "filter2";
35
36     std::cout << "filter1 filter2" << "\n";
37     
38     yp2::Router router1;
39     router1.rule(filter1);
40     std::cout << "router1.rule(filter1)" << "\n";
41
42     yp2::Router router2;
43     router2.rule(filter2);
44     std::cout << "router2.rule(filter2)" << "\n";
45
46     yp2::Package pack_in;
47     pack_in.data(7).router(router1);
48     std::cout << "pack_in.data(7).router(router1)" << "\n";
49
50     pack_in.move();
51     std::cout << "pack_in.move()" << "\n";
52
53     pack_in.router(router2);
54     std::cout << "pack_in.router(router2)" << "\n";
55
56     pack_in.move();
57     std::cout << "pack_in.move()" << "\n";
58
59     throw  yp2::Router_Exception("finished");
60
61   }
62   catch (std::exception &e) {
63     std::cout << e.what() << "\n";
64   }
65
66
67
68 }
69