The Nebula Device 3: Conditions::FSMCondition Class Reference

The Nebula Device 3

Conditions::FSMCondition Class Reference

#include <fsmcondition.h>

Inheritance diagram for Conditions::FSMCondition:

Conditions::Condition Messaging::Message Core::RefCounted

Detailed Description

A specialized condition for the finite state machine system which is activated when its state becomes active and which gets notified about messages to the parent entity. This enabled the condition to be triggered by incoming messages instead of a polling mechanism.

(C) 2006 Radon Labs GmbH

Public Member Functions

virtual void Notify (const Ptr< Messaging::Message > &msg)
 notify about incoming message
virtual void OnActivate ()
 called on state activation
virtual void OnDeactivate ()
 called on state deactivation
virtual void Assert ()
 assert correct initialisation
virtual bool Assert (const Ptr< Script::InfoLog > &infoLog)
 like Assert() but adds errors to the info log object instead of closing the application
virtual void ParseArgs (const Util::CommandLineArgs &args)
 parse arguments from command line args object
virtual bool Evaluate ()
 internal evaluation
virtual void SetEntity (const Ptr< Game::Entity > &v)
 Set optional entity to `v'.
const Ptr< Game::Entity > & GetEntity () const
 Get optional target entity if exists.
bool HasEntity () const
 Does this contain a target entity?
void SetResult (bool b)
 set the condition's result, set by msg handler which may handle this
bool GetResult () const
 get the set result, may be called by subclasses only
virtual void Write (const Ptr< Script::ActionReader > &actionReader)
 write to action reader
virtual void Read (const Ptr< Script::ActionReader > &actionReader)
 read from action reader
bool CheckId (const Messaging::Id &id) const
 return true if message is of the given id
virtual void Encode (const Ptr< IO::BinaryWriter > &writer)
 encode message into a stream
virtual void Decode (const Ptr< IO::BinaryReader > &reader)
 decode message from a stream
void SetHandled (bool b)
 set the handled flag
bool Handled () const
 return true if the message has been handled
void SetDeferred (bool b)
 set deferred flag
bool IsDeferred () const
 get deferred flag
void SetDeferredHandled (bool b)
 set the deferred handled flag
bool DeferredHandled () const
 get the deferred handled flag
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Static Public Member Functions

static Ptr< ConditionCreateConditionFromString (const Util::String &cmd)
 create a complete condition object from a string
static Util::Array< Ptr< Condition > > CreateConditionsFromString (const Util::String &cmd)
 create several conditions from semicolon-separated string
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

Member Function Documentation

Ptr< Condition > Conditions::Condition::CreateConditionFromString ( const Util::String cmd  )  [static, inherited]

create a complete condition object from a string

Static method which creates any condition object from a command string of the form:

cmd key0=value0 key1=value1 key2=value2

Util::Array< Ptr< Condition > > Conditions::Condition::CreateConditionsFromString ( const Util::String cmd  )  [static, inherited]

create several conditions from semicolon-separated string

Static method which creates many action from a string of the form accepted by CreateConditionFromString() where several conditions are separated by a semicolon.

void Conditions::Condition::Assert (  )  [virtual, inherited]

assert correct initialisation

This method asserts that all data required by the conditions actually exists. Override in subclass!

Reimplemented in Conditions::And, Conditions::Not, and Conditions::Or.

bool Conditions::Condition::Assert ( const Ptr< Script::InfoLog > &  infoLog  )  [virtual, inherited]

like Assert() but adds errors to the info log object instead of closing the application

This method asserts that all data actually required by the conditions exist. In subclasses errors can be added to the info log object and in case of errors false can be returned instead of closing the application.

Override in subclass! (infoLog in this class is ignored; Assert() will be called; returns always true)

Reimplemented in Conditions::And, Conditions::Not, and Conditions::Or.

void Conditions::Condition::ParseArgs ( const Util::CommandLineArgs args  )  [virtual, inherited]

parse arguments from command line args object

This method should initialize the Condition object from a CmdLineArgs object. Override in subclass.

bool Conditions::Condition::Evaluate (  )  [virtual, inherited]

internal evaluation

This method evaluates whether the condition is true, Negates result if not flag is set.

Reimplemented in Conditions::And, Conditions::Not, and Conditions::Or.

int Core::RefCounted::GetRefCount (  )  const [inline, inherited]

get the current refcount

Return the current refcount of the object.

void Core::RefCounted::AddRef (  )  [inline, inherited]

increment refcount by one

Increment the refcount of the object.

void Core::RefCounted::Release (  )  [inline, inherited]

decrement refcount and destroy object if refcount is zero

Decrement the refcount and destroy object if refcount is zero.

const Util::String & Core::RefCounted::GetClassName (  )  const [inline, inherited]

get the class name

Get the class name of the object.

Util::FourCC Core::RefCounted::GetClassFourCC (  )  const [inline, inherited]

get the class FourCC code

Get the class FourCC of the object.

void Core::RefCounted::DumpRefCountingLeaks (  )  [static, inherited]

dump refcounting leaks, call at end of application (NEBULA3_DEBUG builds only!)

This method should be called as the very last before an application exits.