//=-- EnginePlugin.h - Interface for the main MagicStats engine plugins ------=
//
//   MagicStats uses a flexible architecture for it's engine... part of this
//   is through the liberal use of plugins in the structure of the program.
//
//   The EnginePlugin class defines the interface a plugin must declare to 
//   qualify as an engine plugin - that which is capable of running the show.
//
//=---------------------------------------------------------------------------=
//  This file is copyright (c) 1997-1999 Chris Lattner
//=---------------------------------------------------------------------------=

#ifndef ENGINEPLUGIN_H
#define ENGINEPLUGIN_H

#include "Plugin.h"

class MSAPI EnginePlugin : public Plugin {
public :

  // Constructor is called before data is loaded into the plugins, so if any
  // plugins are neccesary to the engine, they should be created in the ctor.
  EnginePlugin(const String &name) : Plugin(name) {}

  // Destructor is destroyed AFTER the data is saved from the plugins.  This
  // means that any changes in the plugins' state, after the RunEngine
  // method exits, are lost.
  virtual ~EnginePlugin() { }

  // Bookkeeping
  inline static PluginType GetPluginType() { return Plugin::ENGINE_PLUGIN; }

  // Provide a convenient way to create EnginePlugin objects...
  static EnginePlugin *CreatePlugin(const String &Name) {
    return (EnginePlugin *)Plugin::CreatePlugin(GetPluginType(), Name);
  }

  // Start the engine running... the return value of this function is set as
  // the exit status of the program.
  virtual int RunEngine() = 0;
};

#endif
