#ifdef POSITION
/*
 * $Id: Component_toXML.cpp 81 2008-04-15 18:40:01Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/Component.h"
#include "Behavioural/include/Version.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Component::toXML"

  XML Component::toXML (void)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    XML xml (_entity->get_name());
    
    xml.balise_open_begin   ("description");
    xml.  attribut("morpheo_version",MORPHEO_VERSION);
    xml.balise_open_end();
    xml.  insert_XML        (_entity->toXML());
    xml.  balise_open       ("architecture");

    if (_list_component->empty()== false)
      {
	std::list<Tcomponent_t *>::iterator i = _list_component->begin();

	while (i != _list_component->end())
	  {
	    xml.insert_XML ((*i)->_entity->toXML_mapping());
	    ++i;
	  }
      }
	
    xml.  balise_close      ();
    xml.balise_close        ();
  
    log_printf(FUNC,Behavioural,FUNCTION,"End");
  
    return xml;
  };

}; // end namespace behavioural          
}; // end namespace morpheo              
#endif
