// Vorosweep - Copyright (C) 2010-2014 T. Mouton
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <thibaud.mouton@gmail.com>.

#include <map>
#include "common.h"
#include "sweepobject.h"
#include "event.h"

#ifndef _STATISTIC_INCLUDE
#define _STATISTIC_INCLUDE

namespace vorosweep
{

class Statistic
{
  public:
    static const char *entityname[];
  public:
    enum entity {ACTIVE_GENERATOR, INACTIVE_GENERATOR, POLYGON, EDGE, FACET};
  private:
    std::map<entity, int> entity_count;
    std::map<Event::eventtype, int> event_count;
    int processed_events;
//     bool init;
  public:
    Statistic()
    {
    }
    void init_events();
    void init_entities();
/*    void clear()
    {
      if ( entity_count.size() )
        entity_count.clear();
      if ( event_count.size() )
        event_count.clear();
    } */   
    void add_entity ( entity ent, int nb )
    {
//       printf("inserting %d entity %d %s\n", nb, ent, entityname[ent]);
//       printf("entity size --> %d\n", (int)entity_count.size());
      std::map<entity, int>::iterator it = entity_count.find ( ent );
      it->second += nb;
//       printf("entity size --> %d\n", (int)entity_count.size());
    }
    void add_event ( Event::eventtype ev )
    {
      std::map<Event::eventtype, int>::iterator it = event_count.find ( ev );
      it->second++;
    }
    void add_processed_event ( )
    {
      processed_events++;
    }
    int get_processed_events ( )
    {
      return processed_events;
    }
    void report();
};

};

#endif

