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

#include "Behavioural/include/Component.h"

namespace morpheo              {
namespace behavioural          {

  Entity * Component::find_entity (string name)
  {
    log_printf(FUNC,Behavioural,"Component::find_entity", "Begin");

    Entity * _return = NULL;

    if (_entity->get_name() == name)
      _return = _entity;
    else
      if (_list_component->empty()== false)
	{
	  list<Entity *>::iterator i = _list_component->begin();
	  
	  while (i != _list_component->end())
	    {
	      if ((*i)->get_name() == name)
		{
		  _return = *i;
		  break;
		}
	      ++i;
	    }
	}

    log_printf(FUNC,Behavioural,"Component::find_entity", "End");

    return _return;
  };

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