[31] | 1 | #ifdef POSITION |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/include/Position.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
| 14 | void Position::port_map (string component1, |
---|
| 15 | string signal1 , |
---|
| 16 | string component2, |
---|
| 17 | string signal2 ) |
---|
| 18 | { |
---|
| 19 | Entity * entity1 = find_entity(component1); |
---|
| 20 | |
---|
| 21 | if (entity1 == NULL) |
---|
| 22 | throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with unknow component \""+component1+"\".")); |
---|
| 23 | |
---|
| 24 | bool is_top_level1 = _entity->_name == component1; |
---|
| 25 | |
---|
| 26 | Interface * interface1 = find_interface (signal1, entity1); |
---|
| 27 | |
---|
| 28 | if (interface1 == NULL) |
---|
| 29 | throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with component \""+component1+"\" and a unknow port \""+signal1+"\".")); |
---|
| 30 | |
---|
| 31 | Entity * entity2 = find_entity(component2); |
---|
| 32 | |
---|
| 33 | if (entity2 == NULL) |
---|
| 34 | throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with unknow component \""+component2+"\".")); |
---|
| 35 | |
---|
| 36 | bool is_top_level2 = _entity->_name == component2; |
---|
| 37 | |
---|
| 38 | Interface * interface2 = find_interface (signal2, entity2); |
---|
| 39 | |
---|
| 40 | if (interface2 == NULL) |
---|
| 41 | throw (ErrorMorpheo ("Position \""+_entity->_name+"\", port map with component \""+component2+"\" and a unknow port \""+signal2+"\".")); |
---|
| 42 | |
---|
| 43 | // all is ok |
---|
| 44 | if (is_top_level1 == false) |
---|
| 45 | interface1->port_map(static_cast<void *>(entity2 ), |
---|
| 46 | static_cast<void *>(interface2)); |
---|
| 47 | |
---|
| 48 | if (is_top_level2 == false) |
---|
| 49 | interface2->port_map(static_cast<void *>(entity1 ), |
---|
| 50 | static_cast<void *>(interface1)); |
---|
| 51 | |
---|
| 52 | }; |
---|
| 53 | |
---|
| 54 | }; // end namespace behavioural |
---|
| 55 | }; // end namespace morpheo |
---|
| 56 | #endif |
---|