//=-- CountPlugin.h - Implements the Count plugin ------------------*- C++ -*-=
//
//  This class is used to implement the "most frequent" tables and graphs.  It
//  can be parameterized to display the most frequent anything: hosts, pages,
//  referrers, whatever!
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-2000 Chris Lattner
//=---------------------------------------------------------------------------=

#include "PagePlugin.h"
#include "AccessFormatPlugin.h"
#include "Table.h"
#include "VarTable.h"

class CountPlugin : public PluginTemplate<PagePlugin,CountPlugin> {
public:
  inline static unsigned int GetCurrentVersion() {
    return 100;                       // Version 1.00
  }

  inline static const char *GetPluginName() {
    return "Count";
  }

  CountPlugin(int &CE);
  void LoadSettings(VarTable *Params);
  void ProcessAccess(AccessFormatPlugin &);
  void ResetState();
  void OutputHTML(ostream &, VarTable &);

  void LoadState(Serialize &);  // Save and restore state across program 
  void SaveState(Serialize &);  // runs...

  void GetFullName(VarTable &Params, String &FullName, int UpdateFreq);

protected :
  int FieldToCount; // The AccessFormatPlugin field to keep track of
private :
  Table<String, int> CountTable;
};

