[29] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/include/Interface.h" |
---|
[31] | 9 | #include "Behavioural/include/Entity.h" |
---|
[29] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | |
---|
| 14 | XML Interface::toXML (void) |
---|
| 15 | { |
---|
[38] | 16 | log_printf(FUNC,Behavioural,"toXML","Begin"); |
---|
| 17 | |
---|
[29] | 18 | XML xml ("interface"); |
---|
| 19 | |
---|
[31] | 20 | xml.balise_open_begin ("port"); |
---|
[29] | 21 | xml. attribut ("name" ,_name ); |
---|
| 22 | xml. attribut ("direction" ,toString(_direction )); |
---|
| 23 | xml. attribut ("localisation",toString(_localisation)); |
---|
| 24 | xml.balise_open_end (); |
---|
| 25 | xml. text (get_comment()); |
---|
| 26 | |
---|
[31] | 27 | if (_list_signal->empty()== false) |
---|
[29] | 28 | { |
---|
[38] | 29 | list<Signal*>::iterator i = _list_signal->begin(); |
---|
[29] | 30 | |
---|
[31] | 31 | while (i != _list_signal->end()) |
---|
[29] | 32 | { |
---|
[38] | 33 | xml. insert_XML ((*i)->toXML()); |
---|
[29] | 34 | ++i; |
---|
| 35 | } |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | xml.balise_close (); |
---|
[38] | 39 | |
---|
| 40 | log_printf(FUNC,Behavioural,"toXML","End"); |
---|
| 41 | |
---|
[29] | 42 | return xml; |
---|
| 43 | }; |
---|
| 44 | |
---|
[31] | 45 | #ifdef POSITION |
---|
| 46 | XML Interface::toXML_mapping (void) |
---|
| 47 | { |
---|
[38] | 48 | log_printf(FUNC,Behavioural,"toXML_mapping","Begin"); |
---|
| 49 | |
---|
[31] | 50 | if (_is_map != true) |
---|
| 51 | throw (ErrorMorpheo ("Interface \""+_name+"\" is never mapped")); |
---|
| 52 | |
---|
| 53 | XML xml ("interface"); |
---|
| 54 | |
---|
| 55 | xml.singleton_begin ("port_map"); |
---|
| 56 | xml. attribut ("name" ,_name ); |
---|
| 57 | xml. attribut ("component",(static_cast<Entity *>(_entity_map ))->_name); |
---|
| 58 | xml. attribut ("port" ,(static_cast<Interface *>(_interface_map))->_name); |
---|
| 59 | xml.singleton_end (); |
---|
[38] | 60 | |
---|
| 61 | log_printf(FUNC,Behavioural,"toXML_mapping","End"); |
---|
[31] | 62 | |
---|
| 63 | return xml; |
---|
| 64 | }; |
---|
| 65 | #endif |
---|
[29] | 66 | }; // end namespace behavioural |
---|
| 67 | }; // end namespace morpheo |
---|