/*
 * $Id: Interfaces_get_interface.cpp 94 2008-12-15 11:04:03Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/include/Interfaces.h"
#include "Common/include/Tabulation.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Interfaces::get_interface"
  std::string Interfaces::get_interface (void)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    uint32_t               depth          = 0;
    std::string                 separator      = "\n";
    bool                   last_separator = false;

    std::list<Interface_fifo*>::iterator i  = _list_interface->begin();
    bool                   empty = _list_interface->empty();

    std::string                 tab   = morpheo::tab(depth);
    std::ostringstream          text;

    if (not empty)
      {
	// First
	if (i != _list_interface->end())
	  {
	    text << tab << **i;
	    ++i;
	  }
	
	while (i != _list_interface->end())
	  {
	    text << separator;
	    text << tab << **i;
	    ++i;
	  }
	
	if (last_separator)
	  text << separator;
      }

    log_printf(FUNC,Behavioural,FUNCTION,"End");
    
    return text.str();
  };

#undef  FUNCTION
#define FUNCTION "Interfaces::get_interface_list"
  std::list<Interface_fifo*>* Interfaces::get_interface_list (void)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    std::list<Interface_fifo*>* _return =  _list_interface;
    log_printf(FUNC,Behavioural,FUNCTION,"End");

    return _return;
  };

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