/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/Component.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Component::set_component"
  void Component::set_component (Component * component
#ifdef POSITION
				 ,uint32_t   pos_x  
				 ,uint32_t   pos_y  
				 ,uint32_t   size_x 
				 ,uint32_t   size_y 
#endif
				 ,Tinstance_t instance
				 )
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    Entity * entity = component->_entity;

    Tcomponent_t * entry = new Tcomponent_t;
    
//     entry->_component= component;
    entry->_instance = instance;
    entry->_entity   = entity;

    _list_component->push_back(entry);

#ifdef POSITION
    if (instance & INSTANCE_POSITION)
      entity->mapping( pos_x, pos_y, size_x, size_y);
#endif

    log_printf(FUNC,Behavioural,FUNCTION,"End");
  };

}; // end namespace behavioural          
}; // end namespace morpheo              
