IRuleEngine

The interface for the rule engine.  The IRuleEngine manages the database of IRule and ILogic and provides functions for executing IRules or ILogic.  All of the data is stored in string-based hash maps so that an IRule or piece of ILogic is executed just by calling Execute or Decide with the name of the IRule or ILogic.  IRuleEngine also provides functions for dealing with IRules that can be undone.  If the last rule executed is undoable, the CanUndo function returns true.  To actually undo the last action, the Undo function is provided.  The IRuleEngine is accessible through the GameEngine.

Project

RulesCore

Include

IRuleEngine.h

Summary
The interface for the rule engine.
Executes the given rule with the given DataObject.
Calls the given logic with the given DataObjects.
Returns whether there is anything on the undo stack that can be undone.
Undoes the last action.
The IRuleEngine destructor.

Public

Summary
Executes the given rule with the given DataObject.
Calls the given logic with the given DataObjects.
Returns whether there is anything on the undo stack that can be undone.
Undoes the last action.

Pure Virtual Functions

Execute

virtual void Execute(const wxString &rule,
const DataObject &object)=0

Executes the given rule with the given DataObject.

Parameters

ruleThe name of the IRule to execute.
objectThe DataObject to pass to the IRule.

Decide

virtual void Decide(const wxString &logic,
const DataObject &input,
DataObject &output)=0

Calls the given logic with the given DataObjects.

Parameters

logicThe name of the ILogic to call.
inputThe input DataObject.
outputThe output DataObject.  Must be NULL.

CanUndo

virtual bool CanUndo() const=0

Returns whether there is anything on the undo stack that can be undone.

Returns

A bool giving whether the last action can be undone.  The value is true if the action is undoable, false if not.

Undo

virtual void Undo()=0

Undoes the last action.

Protected

Summary
The IRuleEngine destructor.

Destructor

~IRuleEngine

virtual ~IRuleEngine()=0

The IRuleEngine destructor.  It is pure virtual because this class must be derived from in order to be used.

virtual void Execute(const wxString &rule,
const DataObject &object)=0
Executes the given rule with the given DataObject.
A generic container for passing any kind of data around.
virtual void Decide(const wxString &logic,
const DataObject &input,
DataObject &output)=0
Calls the given logic with the given DataObjects.
virtual bool CanUndo() const=0
Returns whether there is anything on the undo stack that can be undone.
virtual void Undo()=0
Undoes the last action.
virtual ~IRuleEngine()=0
The IRuleEngine destructor.
The interface for a single game rule.
The interface of a single piece of game logic.
The engine that drives the game.
RulesCore is the HOSS of Cities3D.