[62] | 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" |
---|
[78] | 15 | bool Component::test_map (bool recursive) |
---|
[62] | 16 | { |
---|
[78] | 17 | return test_map (0, recursive); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | bool Component::test_map (uint32_t depth, bool recursive) |
---|
| 21 | { |
---|
[62] | 22 | log_printf(FUNC,Behavioural,FUNCTION,"Begin"); |
---|
| 23 | |
---|
[78] | 24 | std::string tab = std::string(depth,'\t'); |
---|
[75] | 25 | std::string name = _entity->get_name(); |
---|
[62] | 26 | bool test_ok = true; |
---|
[78] | 27 | |
---|
[62] | 28 | if (_list_component->empty () == true) |
---|
[78] | 29 | { |
---|
| 30 | log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a behavioural description",tab.c_str(),name.c_str()); |
---|
| 31 | } |
---|
[62] | 32 | else |
---|
| 33 | { |
---|
[78] | 34 | log_printf(NONE,Behavioural,FUNCTION, "%s* Component \"%s\" is a structural description",tab.c_str(),name.c_str()); |
---|
[62] | 35 | |
---|
[78] | 36 | log_printf(INFO,Behavioural,FUNCTION, "%s* Test port I/O",tab.c_str()); |
---|
[62] | 37 | |
---|
[78] | 38 | test_ok &= _entity->test_map(1,true); |
---|
[62] | 39 | |
---|
[78] | 40 | log_printf(INFO,Behavioural,FUNCTION, "%s* Test all internal component",tab.c_str()); |
---|
[62] | 41 | |
---|
[75] | 42 | for (std::list<Tcomponent_t *>::iterator i= _list_component->begin(); |
---|
[62] | 43 | i != _list_component->end(); |
---|
| 44 | ++i) |
---|
[78] | 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); |
---|
[62] | 52 | } |
---|
| 53 | |
---|
| 54 | log_printf(FUNC,Behavioural,FUNCTION,"End"); |
---|
| 55 | |
---|
| 56 | if (test_ok == false) |
---|
[78] | 57 | throw (ERRORMORPHEO (FUNCTION,"A lot of port is not connected.")); |
---|
[62] | 58 | |
---|
| 59 | return test_ok; |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | }; // end namespace behavioural |
---|
| 64 | }; // end namespace morpheo |
---|