//=-- MSEngine.h - Main MagicStats engine --------------------------*- C++ -*-=
//
//   This is the main engine class for MagicStats.  MagicStats is capable of
//   having multiple engines, but this plugin defines the most common/only one.
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-1999 Chris Lattner
//=---------------------------------------------------------------------------=

#ifndef MSENGINE_H
#define MSENGINE_H

#include "EnginePlugin.h"
#include "AccessLogManager.h"
#include "AccessFormatPlugin.h"
#include "PluginManager.h"
#include "OutputManager.h"
#include "Date.h"

class MSEngine : public PluginTemplate<EnginePlugin,MSEngine> {
public:
  inline static unsigned int GetCurrentVersion() {
    return 200;                       // Version 2.00
  }

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

  MSEngine(int &CE);
  virtual ~MSEngine() {}

  virtual void LoadState(Serialize &I);
  virtual void SaveState(Serialize &O);

  virtual int RunEngine();

private:
  // AccessLogManager must be created after PluginManager for destructor to work
  AccessLogManager AccLogMgr;
  OutputManager    OutputMgr;

  // Used for detecting Day/Week/Month/Year rollover...
  Date LastAccessDate;
  int FirstRun;
};

#endif
