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

#include "Behavioural/include/Interface.h"


namespace morpheo              {
namespace behavioural          {

  Signal * Interface::find_signal (std::string name)
  {
    log_printf(FUNC,Behavioural,"find_signal","Begin");

    LowerCase(name);

    std::list<Signal*>::iterator i   = _list_signal->begin();
    Signal *                sig = NULL;
    if (_list_signal->empty() == false)
      {
	while (i != _list_signal->end())
	  {
	    if ((*i)->get_name() == name)
	      {
		sig = (*i);
		break;
	      }
	    ++i;
	  }
      }

    log_printf(FUNC,Behavioural,"find_signal","End");

    return sig;
  };

  bool Interface::find_signal (Signal * signal)
  {
    log_printf(FUNC,Behavioural,"find_signal","Begin");

    bool find = false;
    std::list<Signal*>::iterator i = _list_signal->begin();
    if (_list_signal->empty() == false)
      {
	while (i != _list_signal->end())
	  {
	    if ( (*i) == signal)
	      {
		find = true;
		break;
	      }
	    ++i;
	  }
      }

    log_printf(FUNC,Behavioural,"find_signal","End");

    return find;
  };

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