ILogic

The interface of a single piece of game logic.  A piece of ILogic is not used on its own, but is incorporated into an IRule that requires logic to determine what course of action to take.  The ILogic class provides a generic means of implementing such a thing.  It has one function, Decide, which takes an input DataObject and fills in an output DataObject with its rendered decision.

All ILogic is originally created and stored in a RuleSet within a plugin object.  An ILogic within a RuleSet is stored in a string-based hash map.  All ILogic has a string that is the key used to execute it.  When that RuleSet is loaded into the game via the IPluginEngine, all ILogic (and IRules) within the RuleSet are transferred from their RuleSet hash map into the into the main RuleEngine hash map, which, in the end, holds the aggregation of all ILogic in all RuleSets for the game.

NOTE: An ILogic-derived class should be created and stored in a RuleSet through one of the <IMPLEMENT_LOGIC>, <IMPLEMENT_LOGIC_MIXIN>, or <IMPLEMENT_DEFAULT_BRANCH> macros in <RuleSetDatabase>.

Project

RulesCore

Include

ILogic.h

Summary
The interface of a single piece of game logic.
Decides based on logic.
The ILogic destructor.

Public

Summary
Decides based on logic.

Pure Virtual Functions

Decide

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

Decides based on logic.  Every piece of ILogic decides output based on the given input.

Parameters

inputThe DataObject with data that helps the ILogic to make its decision.
outputThe resulting DataObject containing the output of the ILogic.  It comes in as an empty object and must be created and filled by the ILogic.

Protected

Summary
The ILogic destructor.

Destructor

~ILogic

virtual ~ILogic()=0

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

virtual void Decide(const DataObject &input,
DataObject &output)=0
Decides based on logic.
virtual ~ILogic()=0
The ILogic destructor.
The interface of a single piece of game logic.
The interface for a single game rule.
A generic container for passing any kind of data around.
A repository of all things rules-related.
The interface of the plugin engine.
The default implementation of the IRuleEngine interface.
RulesCore is the HOSS of Cities3D.