[42] | 1 | #ifdef POSITION |
---|
[29] | 2 | /* |
---|
| 3 | * $Id: Interface_toXML.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/include/Interface.h" |
---|
[31] | 10 | #include "Behavioural/include/Entity.h" |
---|
[29] | 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | |
---|
| 15 | XML Interface::toXML (void) |
---|
| 16 | { |
---|
[38] | 17 | log_printf(FUNC,Behavioural,"toXML","Begin"); |
---|
| 18 | |
---|
[29] | 19 | XML xml ("interface"); |
---|
| 20 | |
---|
[31] | 21 | xml.balise_open_begin ("port"); |
---|
[29] | 22 | xml. attribut ("name" ,_name ); |
---|
| 23 | xml. attribut ("direction" ,toString(_direction )); |
---|
| 24 | xml. attribut ("localisation",toString(_localisation)); |
---|
| 25 | xml.balise_open_end (); |
---|
| 26 | xml. text (get_comment()); |
---|
| 27 | |
---|
[31] | 28 | if (_list_signal->empty()== false) |
---|
[29] | 29 | { |
---|
[75] | 30 | std::list<Signal*>::iterator i = _list_signal->begin(); |
---|
[29] | 31 | |
---|
[31] | 32 | while (i != _list_signal->end()) |
---|
[29] | 33 | { |
---|
[38] | 34 | xml. insert_XML ((*i)->toXML()); |
---|
[29] | 35 | ++i; |
---|
| 36 | } |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | xml.balise_close (); |
---|
[38] | 40 | |
---|
| 41 | log_printf(FUNC,Behavioural,"toXML","End"); |
---|
| 42 | |
---|
[29] | 43 | return xml; |
---|
| 44 | }; |
---|
| 45 | |
---|
[31] | 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 ); |
---|
[42] | 57 | xml. attribut ("component",(static_cast<Entity *>(_entity_map ))->get_name()); |
---|
| 58 | xml. attribut ("port" ,(static_cast<Interface *>(_interface_map))->get_name()); |
---|
[31] | 59 | xml.singleton_end (); |
---|
[38] | 60 | |
---|
| 61 | log_printf(FUNC,Behavioural,"toXML_mapping","End"); |
---|
[31] | 62 | |
---|
| 63 | return xml; |
---|
| 64 | }; |
---|
[29] | 65 | }; // end namespace behavioural |
---|
| 66 | }; // end namespace morpheo |
---|
[42] | 67 | #endif |
---|