#ifdef STATISTICS
/*
 * $Id$
 *
 * [ Description ]
 * 
 */

#include "Behavioural/Generic/Group/include/Statistics.h"
#include "Behavioural/src/Statistics_test_if_save.cpp"
#include "Behavioural/src/Statistics_save.cpp"
#include <sstream>
using namespace std;

namespace morpheo                    {
namespace behavioural                {
namespace generic                    {
namespace group                      {

  // Explicite instanciation
  template void behavioural::Statistics::test_if_save<behavioural::generic::group::Counters,
						      behavioural::generic::group::Parameters>
  (behavioural::generic::group::Counters ** &,
   behavioural::generic::group::Parameters);

  template void behavioural::Statistics::save        <behavioural::generic::group::Counters,
						      behavioural::generic::group::Parameters>
  (behavioural::generic::group::Counters ** &,
   behavioural::generic::group::Parameters);
        

  void Statistics::add (uint32_t nb_use)
  {
    test_if_save<Counters,Parameters>(_counters,_parameters);

    if (_nb_statistics>0)
      {
	int i = _nb_statistics-1;
	_counters[i]->_nb_use += nb_use;

	if (nb_use == 0)
	  _counters[i]->_nb_cycle_none_use   ++;
	else 
	  if (nb_use == _parameters._nb_elt)
	    _counters[i]->_nb_cycle_full_use   ++;
	  else
	    _counters[i]->_nb_cycle_normal_use ++;
      }
  };

}; // end namespace group 
}; // end namespace generic
}; // end namespace behavioural          
}; // end namespace morpheo              
#endif
