/*
 * $Id: Priority_transition_load_balancing_balance.cpp 88 2008-12-10 18:31:39Z rosiere $
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Generic/Priority/include/Priority.h"

namespace morpheo                    {
namespace behavioural {
namespace generic {
namespace priority {
  
#undef  FUNCTION
#define FUNCTION "Priority::transition_load_balancing_balance"
  void Priority::transition_load_balancing_balance (void)
  {
    log_begin(Priority,FUNCTION);

    for (uint32_t j=0; j<_max_nb_elt; j++)
      for (uint32_t i=0; i<_nb_grp_select; i++)
	{
	  uint32_t x=(reg_GRP_PRIORITY+i)%_nb_grp;
	  
	  // Test valid elt
	  if (j < _nb_elt[x])
	    _select.push_back(select_t(x,j));
	}
    
    log_end(Priority,FUNCTION);
  };

}; // end namespace priority
}; // end namespace generic
}; // end namespace behavioural
}; // end namespace morpheo              
