WSF
WsfBehaviorTreeNode Class Referenceabstract

#include <WsfBehaviorTreeNode.hpp>

Inheritance diagram for WsfBehaviorTreeNode:
Collaboration diagram for WsfBehaviorTreeNode:

Public Types

enum  RunType { Repeat , ForTime , UntilDone }
enum  SelectType { Continous , Finite }
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Public Member Functions

 WsfBehaviorTreeNode (const WsfScenario &aScenario)
 WsfBehaviorTreeNode (const WsfBehaviorTreeNode &aSrc)
WsfBehaviorTreeNodeoperator= (const WsfBehaviorTreeNode &)=delete
 ~WsfBehaviorTreeNode () override
WsfObjectClone () const override=0
bool ProcessInput (UtInput &aInput) override
virtual void RegisterInput (UtInput &aInput)
bool PreconditionsMet ()
double PreconditionValue ()
void AddChild (WsfBehaviorTreeNode *aNodePtr)
std::vector< WsfBehaviorTreeNode * > & Children ()
int ChildCount () const
WsfBehaviorTreeNodeChildEntry (int aIndex)
void SetParent (WsfBehaviorTreeNode *aNodePtr)
WsfBehaviorTreeNodeParent ()
virtual bool Initialize (double aSimTime, WsfScriptContext *aParentContext)
WsfScriptContextGetScriptContext ()
bool Execute (double aSimTime, bool aSkipCheck=false)
void TurnOn ()
void TurnOff ()
void SetFailureReason (const std::string &aReason, bool aSendEvent=false)
std::string FailureReason () const
bool ExecutedLastRun ()
void SetExecutedLastRun (bool aVal)
void SetExecutedLastRunRecursive (bool aVal)
void SetExecutedLastRun (bool aVal, const std::string &aReason)
void SetExecutedLastRunRecursive (bool aVal, const std::string &aReason)
WsfBehaviorTreeOwningTree ()
virtual void SetTree (WsfBehaviorTree *aTreePtr)
WsfScriptProcessorOwningProcessor ()
WsfPlatformOwningPlatform ()
WsfSimulationGetSimulation ()
bool TryRunLast (double aSimTime)
bool ShouldRunNext (double aSimTime)
virtual bool LocalExecute (double aSimTime)=0
unsigned int Id () const
void LogNodeStructure (double aSimTime, bool aRecurse)
std::string FilePath () const
time_t FileLastModTime () const
void SetFilePath (const std::string &aPath)
void SetFileInfo (const std::string &aPath, time_t aModTime)
WsfBehaviorTreeNodeFindNode (const std::string &aNodeName)
void FindLastExecuted (std::vector< WsfBehaviorTreeNode * > &aLastExecuted)
const char * GetScriptClassName () const override
UtScriptContext * GetScriptAccessibleContext () const override
const WsfScenarioGetScenario () const
virtual bool ProcessMessage (double aSimTime, const WsfMessage &aMessage)
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)

Static Public Member Functions

static unsigned int GetUniqueNodeId (void)
static void Reset ()

Protected Attributes

const WsfScenariomScenario
bool mInitialized
bool mTurnedOn
WsfBehaviorTreemParentTreePtr
WsfBehaviorTreeNodemParentPtr
std::vector< WsfBehaviorTreeNode * > mChildren
WsfScriptContextmContextPtr
UtScript * mPreconditionScriptPtr
UtScript * mNewExecuteScriptPtr
UtScript * mNewFailScriptPtr
std::string mFailureReason
double mFailureTime
bool mLastExecute
unsigned int mId
std::string mFullPathFileName
time_t mFileLastModTime
RunType mRunType
int mRepeats
double mRunDuration
WsfBehaviorTreeNodemLastNodeSelectedPtr
int mRepeatsLeft
double mRunStartTime
SelectType mSelectType
int mSelectLimit
int mSelectCount
WsfScriptStateMachinemFiniteStateMachinePtr
int mStateIndex
WsfScriptMessageHandlermMessageHandlerPtr
bool mDebug

Friends

class WsfBehaviorTreeLeafNode
class WsfBehaviorTreeSequenceNode
class WsfBehaviorTreeSelectorNode
class WsfBehaviorTreeParallelNode
class WsfBehaviorTreePrioritySelectorNode
class WsfBehaviorTreeWeightedRandomNode

Additional Inherited Members

 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Detailed Description

WsfBehaviorTreeNode is the base class for all nodes in a WsfBehaviorTree, including connector nodes and leaf nodes behavior names are WsfObject types; behavior types are WsfObject names because behavior names are all unique, and types are all "behavior"

Member Enumeration Documentation

◆ RunType

Enumerator
Repeat 
ForTime 
UntilDone 

◆ SelectType

Enumerator
Continous 
Finite 

Constructor & Destructor Documentation

◆ WsfBehaviorTreeNode() [1/2]

◆ WsfBehaviorTreeNode() [2/2]

◆ ~WsfBehaviorTreeNode()

WsfBehaviorTreeNode::~WsfBehaviorTreeNode ( )
override

Member Function Documentation

◆ AddChild()

◆ ChildCount()

int WsfBehaviorTreeNode::ChildCount ( ) const
inline

References mChildren.

Referenced by FindLastExecuted().

◆ ChildEntry()

WsfBehaviorTreeNode * WsfBehaviorTreeNode::ChildEntry ( int aIndex)

◆ Children()

std::vector< WsfBehaviorTreeNode * > & WsfBehaviorTreeNode::Children ( )
inline

References mChildren.

◆ Clone()

WsfObject * WsfBehaviorTreeNode::Clone ( ) const
overridepure virtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements WsfObject.

Implemented in WsfBehaviorTreeLeafNode, WsfBehaviorTreeParallelNode, WsfBehaviorTreePrioritySelectorNode, WsfBehaviorTreeSelectorNode, WsfBehaviorTreeSequenceNode, and WsfBehaviorTreeWeightedRandomNode.

References WsfObject::WsfObject().

Referenced by WsfBehaviorTreeNode().

◆ Execute()

◆ ExecutedLastRun()

bool WsfBehaviorTreeNode::ExecutedLastRun ( )
inline

References mLastExecute.

Referenced by Execute(), and FindLastExecuted().

◆ FailureReason()

std::string WsfBehaviorTreeNode::FailureReason ( ) const
inline

References mFailureReason.

◆ FileLastModTime()

time_t WsfBehaviorTreeNode::FileLastModTime ( ) const
inline

References mFileLastModTime.

◆ FilePath()

std::string WsfBehaviorTreeNode::FilePath ( ) const
inline

References mFullPathFileName.

◆ FindLastExecuted()

void WsfBehaviorTreeNode::FindLastExecuted ( std::vector< WsfBehaviorTreeNode * > & aLastExecuted)

◆ FindNode()

WsfBehaviorTreeNode * WsfBehaviorTreeNode::FindNode ( const std::string & aNodeName)

◆ GetScenario()

const WsfScenario & WsfBehaviorTreeNode::GetScenario ( ) const
inline

◆ GetScriptAccessibleContext()

UtScriptContext * WsfBehaviorTreeNode::GetScriptAccessibleContext ( ) const
override

References mContextPtr.

◆ GetScriptClassName()

const char * WsfBehaviorTreeNode::GetScriptClassName ( ) const
override

◆ GetScriptContext()

WsfScriptContext & WsfBehaviorTreeNode::GetScriptContext ( )
inline

◆ GetSimulation()

◆ GetUniqueNodeId()

unsigned int WsfBehaviorTreeNode::GetUniqueNodeId ( void )
inlinestatic

◆ Id()

unsigned int WsfBehaviorTreeNode::Id ( ) const
inline

◆ Initialize()

bool WsfBehaviorTreeNode::Initialize ( double aSimTime,
WsfScriptContext * aParentContext )
virtual

◆ LocalExecute()

virtual bool WsfBehaviorTreeNode::LocalExecute ( double aSimTime)
pure virtual

◆ LogNodeStructure()

void WsfBehaviorTreeNode::LogNodeStructure ( double aSimTime,
bool aRecurse )

◆ operator=()

WsfBehaviorTreeNode & WsfBehaviorTreeNode::operator= ( const WsfBehaviorTreeNode & )
delete

References WsfBehaviorTreeNode().

◆ OwningPlatform()

WsfPlatform * WsfBehaviorTreeNode::OwningPlatform ( )

◆ OwningProcessor()

WsfScriptProcessor * WsfBehaviorTreeNode::OwningProcessor ( )

◆ OwningTree()

WsfBehaviorTree * WsfBehaviorTreeNode::OwningTree ( )

References mParentTreePtr.

Referenced by OwningProcessor().

◆ Parent()

WsfBehaviorTreeNode * WsfBehaviorTreeNode::Parent ( )
inline

◆ PreconditionsMet()

bool WsfBehaviorTreeNode::PreconditionsMet ( )

References mContextPtr, and mPreconditionScriptPtr.

Referenced by Execute().

◆ PreconditionValue()

double WsfBehaviorTreeNode::PreconditionValue ( )

◆ ProcessInput()

bool WsfBehaviorTreeNode::ProcessInput ( UtInput & aInput)
overridevirtual

Process input from a generic source.

Examine the current input command. If it is NOT one of the commands recognized by this class then it simply returns 'false'. If it is one of the commands recognized by this class then it processes the command and returns 'true'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the class or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.
Note
If a derived class does not recognize the command (i.e.: the return value is false) then it should call the base class ProcessInput method. This chain should continue until either the command is recognized or the top-level base class is encountered.

Reimplemented from WsfObject.

References Continous, Finite, ForTime, mContextPtr, mDebug, mFiniteStateMachinePtr, mMessageHandlerPtr, mNewExecuteScriptPtr, mNewFailScriptPtr, mPreconditionScriptPtr, mRepeats, mRunDuration, mRunType, mSelectLimit, mSelectType, Repeat, and UntilDone.

Referenced by WsfBehaviorTree::CreateNode(), and WsfBehaviorTreeLeafNode::ProcessInput().

◆ ProcessMessage()

bool WsfBehaviorTreeNode::ProcessMessage ( double aSimTime,
const WsfMessage & aMessage )
virtual

◆ RegisterInput()

virtual void WsfBehaviorTreeNode::RegisterInput ( UtInput & aInput)
inlinevirtual

Reimplemented in WsfBehaviorTreeLeafNode.

◆ Reset()

void WsfBehaviorTreeNode::Reset ( )
inlinestatic

◆ SetExecutedLastRun() [1/2]

◆ SetExecutedLastRun() [2/2]

void WsfBehaviorTreeNode::SetExecutedLastRun ( bool aVal,
const std::string & aReason )

◆ SetExecutedLastRunRecursive() [1/2]

void WsfBehaviorTreeNode::SetExecutedLastRunRecursive ( bool aVal)

References mChildren, and SetExecutedLastRun().

Referenced by Execute().

◆ SetExecutedLastRunRecursive() [2/2]

void WsfBehaviorTreeNode::SetExecutedLastRunRecursive ( bool aVal,
const std::string & aReason )

References mChildren, and SetExecutedLastRun().

◆ SetFailureReason()

◆ SetFileInfo()

void WsfBehaviorTreeNode::SetFileInfo ( const std::string & aPath,
time_t aModTime )

References mFileLastModTime, and mFullPathFileName.

Referenced by SetFilePath().

◆ SetFilePath()

void WsfBehaviorTreeNode::SetFilePath ( const std::string & aPath)

◆ SetParent()

void WsfBehaviorTreeNode::SetParent ( WsfBehaviorTreeNode * aNodePtr)
inline

References mParentPtr, and WsfBehaviorTreeNode().

Referenced by AddChild().

◆ SetTree()

void WsfBehaviorTreeNode::SetTree ( WsfBehaviorTree * aTreePtr)
virtual

◆ ShouldRunNext()

bool WsfBehaviorTreeNode::ShouldRunNext ( double aSimTime)

◆ TryRunLast()

bool WsfBehaviorTreeNode::TryRunLast ( double aSimTime)

◆ TurnOff()

void WsfBehaviorTreeNode::TurnOff ( )
inline

References mTurnedOn.

Referenced by UT_DEFINE_SCRIPT_METHOD().

◆ TurnOn()

void WsfBehaviorTreeNode::TurnOn ( )
inline

References mTurnedOn.

◆ WsfBehaviorTreeLeafNode

◆ WsfBehaviorTreeParallelNode

◆ WsfBehaviorTreePrioritySelectorNode

◆ WsfBehaviorTreeSelectorNode

◆ WsfBehaviorTreeSequenceNode

◆ WsfBehaviorTreeWeightedRandomNode

Member Data Documentation

◆ mChildren

◆ mContextPtr

◆ mDebug

◆ mFailureReason

std::string WsfBehaviorTreeNode::mFailureReason
protected

◆ mFailureTime

double WsfBehaviorTreeNode::mFailureTime
protected

◆ mFileLastModTime

time_t WsfBehaviorTreeNode::mFileLastModTime
protected

◆ mFiniteStateMachinePtr

◆ mFullPathFileName

std::string WsfBehaviorTreeNode::mFullPathFileName
protected

◆ mId

unsigned int WsfBehaviorTreeNode::mId
protected

◆ mInitialized

bool WsfBehaviorTreeNode::mInitialized
protected

◆ mLastExecute

bool WsfBehaviorTreeNode::mLastExecute
protected

◆ mLastNodeSelectedPtr

◆ mMessageHandlerPtr

◆ mNewExecuteScriptPtr

UtScript* WsfBehaviorTreeNode::mNewExecuteScriptPtr
protected

◆ mNewFailScriptPtr

UtScript* WsfBehaviorTreeNode::mNewFailScriptPtr
protected

◆ mParentPtr

WsfBehaviorTreeNode* WsfBehaviorTreeNode::mParentPtr
protected

◆ mParentTreePtr

◆ mPreconditionScriptPtr

UtScript* WsfBehaviorTreeNode::mPreconditionScriptPtr
protected

◆ mRepeats

◆ mRepeatsLeft

◆ mRunDuration

double WsfBehaviorTreeNode::mRunDuration
protected

◆ mRunStartTime

◆ mRunType

RunType WsfBehaviorTreeNode::mRunType
protected

◆ mScenario

const WsfScenario& WsfBehaviorTreeNode::mScenario
protected

◆ mSelectCount

int WsfBehaviorTreeNode::mSelectCount
protected

◆ mSelectLimit

int WsfBehaviorTreeNode::mSelectLimit
protected

◆ mSelectType

SelectType WsfBehaviorTreeNode::mSelectType
protected

◆ mStateIndex

int WsfBehaviorTreeNode::mStateIndex
protected

◆ mTurnedOn

bool WsfBehaviorTreeNode::mTurnedOn
protected

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved