1 | /* |
---|
2 | * $Id: Generator_test.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Configuration/include/Generator.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | namespace configuration { |
---|
13 | |
---|
14 | #undef FUNCTION |
---|
15 | #define FUNCTION "Generator::test" |
---|
16 | void Generator::test (std::string param, std::string x) |
---|
17 | { |
---|
18 | log_begin(Configuration,FUNCTION); |
---|
19 | |
---|
20 | std::map<std::string, Parameter_definition *>::iterator it_param = _array_param->find(param); |
---|
21 | |
---|
22 | if (it_param == _array_param->end()) |
---|
23 | { |
---|
24 | throw (ERRORMORPHEO(FUNCTION,toString(_("Parameter \"%s\" is unknow.\n"),param.c_str()))); |
---|
25 | } |
---|
26 | else |
---|
27 | { |
---|
28 | it_param->second->test(x); |
---|
29 | } |
---|
30 | |
---|
31 | log_end(Configuration,FUNCTION); |
---|
32 | }; |
---|
33 | |
---|
34 | #undef FUNCTION |
---|
35 | #define FUNCTION "Generator::test" |
---|
36 | void Generator::test (std::string link, |
---|
37 | std::string father_name, |
---|
38 | bool father_is_src, |
---|
39 | bool father_is_dest) |
---|
40 | { |
---|
41 | log_begin(Configuration,FUNCTION); |
---|
42 | |
---|
43 | // Link ? |
---|
44 | std::map<std::string, Link_definition *>::iterator it_link = _array_link->find(link); |
---|
45 | |
---|
46 | if (it_link == _array_link->end()) |
---|
47 | { |
---|
48 | throw (ERRORMORPHEO(FUNCTION,toString(_("Link \"%s\" is unknow.\n"),link.c_str()))); |
---|
49 | } |
---|
50 | |
---|
51 | if ((father_is_src ) and |
---|
52 | (father_name != it_link->second->_src )) |
---|
53 | { |
---|
54 | throw (ERRORMORPHEO(FUNCTION,toString(_("Link \"%s\", must be instance as source in component \"%s\", but find in component \"%s\".\n"),link.c_str(),it_link->second->_src.c_str(),father_name.c_str()))); |
---|
55 | } |
---|
56 | |
---|
57 | if ((father_is_dest ) and |
---|
58 | (father_name != it_link->second->_dest )) |
---|
59 | { |
---|
60 | throw (ERRORMORPHEO(FUNCTION,toString(_("Link \"%s\", must be instance as destination in component \"%s\", but find in component \"%s\".\n"),link.c_str(),it_link->second->_dest.c_str(),father_name.c_str()))); |
---|
61 | } |
---|
62 | |
---|
63 | log_end(Configuration,FUNCTION); |
---|
64 | }; |
---|
65 | |
---|
66 | }; // end namespace configuration |
---|
67 | }; // end namespace behavioural |
---|
68 | }; // end namespace morpheo |
---|