1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/include/Component.h" |
---|
9 | |
---|
10 | namespace morpheo { |
---|
11 | namespace behavioural { |
---|
12 | |
---|
13 | #undef FUNCTION |
---|
14 | #define FUNCTION "Component::test_map" |
---|
15 | bool Component::test_map (bool recursive) |
---|
16 | { |
---|
17 | return test_map (0, recursive); |
---|
18 | } |
---|
19 | |
---|
20 | bool Component::test_map (uint32_t depth, bool recursive) |
---|
21 | { |
---|
22 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
23 | |
---|
24 | std::string tab = std::string(depth,'\t'); |
---|
25 | std::string name = _entity->get_name(); |
---|
26 | bool test_ok = true; |
---|
27 | |
---|
28 | if (_list_component->empty () == true) |
---|
29 | { |
---|
30 | log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str()); |
---|
31 | } |
---|
32 | else |
---|
33 | { |
---|
34 | log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str()); |
---|
35 | |
---|
36 | log_printf(INFO,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str()); |
---|
37 | |
---|
38 | test_ok &= _entity->test_map(1,true); |
---|
39 | |
---|
40 | log_printf(INFO,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str()); |
---|
41 | |
---|
42 | for (std::list<Tcomponent_t *>::iterator i= _list_component->begin(); |
---|
43 | i != _list_component->end(); |
---|
44 | ++i) |
---|
45 | test_ok &= (*i)->_entity->test_map(1,false); |
---|
46 | |
---|
47 | // if (recursive) |
---|
48 | // for (std::list<Tcomponent_t *>::iterator i= _list_component->begin(); |
---|
49 | // i != _list_component->end(); |
---|
50 | // ++i) |
---|
51 | // test_ok &= (*i)->_component->test_map(1,recursive); |
---|
52 | } |
---|
53 | |
---|
54 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
55 | |
---|
56 | if (test_ok == false) |
---|
57 | throw (ERRORMORPHEO (FUNCTION,"A lot of port is not connected.")); |
---|
58 | |
---|
59 | return test_ok; |
---|
60 | }; |
---|
61 | |
---|
62 | |
---|
63 | }; // end namespace behavioural |
---|
64 | }; // end namespace morpheo |
---|