#ifdef STATISTICS

#ifndef morpheo_behavioural_Statistics_save_cpp
#define morpheo_behavioural_Statistics_save_cpp

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

#include "Behavioural/include/Statistics.h"

namespace morpheo              {
namespace behavioural          {

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

    // Allocation of a new slot -> take param a first count
    Counters ** counters_tmp;
    
    counters_tmp = new Counters * [_nb_statistics+1];
    
    // Copy
    for (uint32_t i = 0; i < _nb_statistics; i ++)
      counters_tmp [i] = counters [i];
    
    // New slot !
    counters_tmp [_nb_statistics] = new Counters (parameters);
    
    // update pointer
    counters = counters_tmp;
    _nb_statistics ++;

    log_printf(FUNC,Behavioural,FUNCTION,"End");
  };

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

#endif
#endif
