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

#include "Behavioural/include/Interfaces.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Interfaces::find_signal"
  Signal * Interfaces::find_signal (string name)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    Signal * _return = NULL;
    if (_list_interface->empty()== false)
      {
	list<Interface_fifo*>::iterator i = _list_interface->begin();

	while (i != _list_interface->end())
	  {
	    Signal * signal = (*i)->find_signal(name);

	    // Warning : Name of signal is uniq
	    if (signal != NULL)
	      {
		_return = signal;
		break;
	      }

	    ++i;
	  }
      }
     
    log_printf(FUNC,Behavioural,FUNCTION,"End");
    return _return;
  };

#undef  FUNCTION
#define FUNCTION "Interfaces::find_signal"
  bool Interfaces::find_signal (Signal * signal)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    bool _return = false;

    if (_list_interface->empty()== false)
      {
	list<Interface_fifo*>::iterator i = _list_interface->begin();

	while (i != _list_interface->end())
	  {
	    if ((*i)->find_signal(signal) == true)
	      {
		_return = true;
		break;
	      }

	    ++i;
	  }
      }
  
    log_printf(FUNC,Behavioural,FUNCTION,"End");   
    return _return;
  };

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