#ifdef STATISTICS

#ifndef morpheo_behavioural_Statistics_test_if_save_cpp
#define morpheo_behavioural_Statistics_test_if_save_cpp

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

#include "Behavioural/include/Statistics.h"

namespace morpheo              {
namespace behavioural          {

#undef  FUNCTION
#define FUNCTION "Statistics::test_if_save"
  template <class Counters, class Parameters_Counters>
  void Statistics::test_if_save(Counters ** & counters, Parameters_Counters parameters)
  {
    log_printf(FUNC,Behavioural,FUNCTION,"Begin");

    _period_current ++;

    // Test if allors a new counters ...
    if ( ((_nb_statistics == 0) && (_period_current >= _parameters_statistics._nb_cycle_before_begin)) ||
	 ((_nb_statistics >  0) && (_period_current >= _parameters_statistics._period_save          )) )
      {
	save<Counters,Parameters_Counters>(counters,parameters);
	_period_current = 0;
      }

    log_printf(FUNC,Behavioural,FUNCTION,"End");
  };
  
}; // end namespace behavioural          
}; // end namespace morpheo              

#endif
#endif
