File statscounter-bones.hpp¶
File List > barry > statscounter-bones.hpp
Go to the documentation of this file
#ifndef BARRY_STATSCOUNTER_BONES_HPP
#define BARRY_STATSCOUNTER_BONES_HPP 1
class NetworkDense;
class NetCounterData;
template <typename Array_Type, typename Data_Type>
class StatsCounter {
private:
// Should receive an array
const Array_Type * Array;
Array_Type EmptyArray;
std::vector< double > current_stats;
// We will save the data here
Counters<Array_Type,Data_Type> * counters;
bool counter_deleted = false;
std::vector< double > count_all_dense();
std::vector< double > count_all_sparse();
public:
StatsCounter(const Array_Type * Array_) :
Array(Array_), EmptyArray(*Array_),
counters(new Counters<Array_Type,Data_Type>()) {
// We are removing the entries without freeing the memory. This should
// make the insertion faster.
EmptyArray.clear(false);
return;
}
StatsCounter(const StatsCounter<Array_Type,Data_Type> & counter);
StatsCounter() : Array(nullptr), EmptyArray(0u,0u),
counters(new Counters<Array_Type,Data_Type>()) {};
~StatsCounter();
void reset_array(const Array_Type * Array_);
void add_counter(Counter<Array_Type,Data_Type> f_);
void set_counters(Counters<Array_Type,Data_Type> * counters_);
void count_init(size_t i, size_t j);
void count_current(size_t i, size_t j);
std::vector< double > count_all();
Counters<Array_Type,Data_Type> * get_counters();
std::vector< std::string > get_names() const;
std::vector< std::string > get_descriptions() const;
size_t size() const {return counters->size();};
};
#endif