/*
 * $Id: Component_set_entity.cpp 113 2009-04-14 18:39:12Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/Component.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Component::set_entity"
  Entity * Component::set_entity (std::string  name
				  ,std::string type
#ifdef POSITION
				  ,schema_t    schema
#endif
				  )
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    if (_entity != NULL)
      throw ERRORMORPHEO(FUNCTION,_("Entity is already allocated.\n"));
    
    Entity * entity = new Entity (name   
				  ,type   
#ifdef POSITION
				  ,schema 
#endif
				  ,_usage
				  );

    _entity = entity;
    
    log_printf(FUNC,Behavioural,FUNCTION,"End");

    return entity;
  };

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