|
WSF
|
#include <WsfBehaviorTreeNode.hpp>


Public Types | |
| enum | RunType { Repeat , ForTime , UntilDone } |
| enum | SelectType { Continous , Finite } |
| Public Types inherited from WsfObject | |
| typedef std::vector< WsfStringId > | TypeList |
| The list of types returned by GetTypeList. | |
Public Member Functions | |
| WsfBehaviorTreeNode (const WsfScenario &aScenario) | |
| WsfBehaviorTreeNode (const WsfBehaviorTreeNode &aSrc) | |
| WsfBehaviorTreeNode & | operator= (const WsfBehaviorTreeNode &)=delete |
| ~WsfBehaviorTreeNode () override | |
| WsfObject * | Clone () 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 |
| WsfBehaviorTreeNode * | ChildEntry (int aIndex) |
| void | SetParent (WsfBehaviorTreeNode *aNodePtr) |
| WsfBehaviorTreeNode * | Parent () |
| virtual bool | Initialize (double aSimTime, WsfScriptContext *aParentContext) |
| WsfScriptContext & | GetScriptContext () |
| 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) |
| WsfBehaviorTree * | OwningTree () |
| virtual void | SetTree (WsfBehaviorTree *aTreePtr) |
| WsfScriptProcessor * | OwningProcessor () |
| WsfPlatform * | OwningPlatform () |
| WsfSimulation * | GetSimulation () |
| 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) |
| WsfBehaviorTreeNode * | FindNode (const std::string &aNodeName) |
| void | FindLastExecuted (std::vector< WsfBehaviorTreeNode * > &aLastExecuted) |
| const char * | GetScriptClassName () const override |
| UtScriptContext * | GetScriptAccessibleContext () const override |
| const WsfScenario & | GetScenario () 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 TypeList & | GetTypeList () const |
| bool | IsA_TypeOf (WsfStringId aType) const |
| WsfObject & | operator= (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 WsfScenario & | mScenario |
| bool | mInitialized |
| bool | mTurnedOn |
| WsfBehaviorTree * | mParentTreePtr |
| WsfBehaviorTreeNode * | mParentPtr |
| std::vector< WsfBehaviorTreeNode * > | mChildren |
| WsfScriptContext * | mContextPtr |
| 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 |
| WsfBehaviorTreeNode * | mLastNodeSelectedPtr |
| int | mRepeatsLeft |
| double | mRunStartTime |
| SelectType | mSelectType |
| int | mSelectLimit |
| int | mSelectCount |
| WsfScriptStateMachine * | mFiniteStateMachinePtr |
| int | mStateIndex |
| WsfScriptMessageHandler * | mMessageHandlerPtr |
| 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()). | |
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"
| WsfBehaviorTreeNode::WsfBehaviorTreeNode | ( | const WsfScenario & | aScenario | ) |
References Continous, GetScriptContext(), GetUniqueNodeId(), mContextPtr, mDebug, mFailureReason, mFailureTime, mFiniteStateMachinePtr, mId, mInitialized, mLastExecute, mLastNodeSelectedPtr, mMessageHandlerPtr, mNewExecuteScriptPtr, mNewFailScriptPtr, mParentPtr, mParentTreePtr, mPreconditionScriptPtr, mRepeats, mRepeatsLeft, mRunDuration, mRunStartTime, mRunType, mScenario, mSelectCount, mSelectLimit, mSelectType, mStateIndex, mTurnedOn, Repeat, WsfObject::SetName(), and WsfObject::SetType().
Referenced by AddChild(), ChildEntry(), FindNode(), WsfBehaviorTreePrioritySelectorNode::LocalExecute(), WsfBehaviorTreeWeightedRandomNode::LocalExecute(), operator=(), Parent(), WsfBehaviorTreeLeafNode::ProcessInput(), SetParent(), WsfBehaviorTreeLeafNode::WsfBehaviorTreeLeafNode(), WsfBehaviorTreeLeafNode::WsfBehaviorTreeLeafNode(), WsfBehaviorTreeNode(), WsfBehaviorTreeParallelNode::WsfBehaviorTreeParallelNode(), WsfBehaviorTreePrioritySelectorNode::WsfBehaviorTreePrioritySelectorNode(), WsfBehaviorTreeSelectorNode::WsfBehaviorTreeSelectorNode(), WsfBehaviorTreeSequenceNode::WsfBehaviorTreeSequenceNode(), WsfBehaviorTreeWeightedRandomNode::WsfBehaviorTreeWeightedRandomNode(), and ~WsfBehaviorTreeNode().
| WsfBehaviorTreeNode::WsfBehaviorTreeNode | ( | const WsfBehaviorTreeNode & | aSrc | ) |
References AddChild(), Clone(), GetUniqueNodeId(), mChildren, mContextPtr, mDebug, mFailureReason, mFailureTime, mFileLastModTime, mFiniteStateMachinePtr, mFullPathFileName, mId, mInitialized, mLastExecute, mLastNodeSelectedPtr, mMessageHandlerPtr, mNewExecuteScriptPtr, mNewFailScriptPtr, mParentPtr, mParentTreePtr, mPreconditionScriptPtr, mRepeats, mRepeatsLeft, mRunDuration, mRunStartTime, mRunType, mScenario, mSelectCount, mSelectLimit, mSelectType, mStateIndex, mTurnedOn, WsfBehaviorTreeNode(), and WsfObject::WsfObject().
|
override |
References mChildren, mContextPtr, mFiniteStateMachinePtr, mMessageHandlerPtr, and WsfBehaviorTreeNode().
| void WsfBehaviorTreeNode::AddChild | ( | WsfBehaviorTreeNode * | aNodePtr | ) |
References mChildren, SetParent(), and WsfBehaviorTreeNode().
Referenced by WsfBehaviorTree::CreateNode(), WsfBehaviorTreeLeafNode::ProcessInput(), and WsfBehaviorTreeNode().
|
inline |
References mChildren.
Referenced by FindLastExecuted().
| WsfBehaviorTreeNode * WsfBehaviorTreeNode::ChildEntry | ( | int | aIndex | ) |
References mChildren, and WsfBehaviorTreeNode().
Referenced by UT_DEFINE_SCRIPT_METHOD().
|
inline |
References mChildren.
|
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().
| bool WsfBehaviorTreeNode::Execute | ( | double | aSimTime, |
| bool | aSkipCheck = false ) |
References ExecutedLastRun(), LocalExecute(), mFailureReason, mFailureTime, mFiniteStateMachinePtr, mStateIndex, mTurnedOn, PreconditionsMet(), SetExecutedLastRun(), SetExecutedLastRunRecursive(), ShouldRunNext(), and TryRunLast().
Referenced by WsfBehaviorTreePrioritySelectorNode::LocalExecute(), and WsfBehaviorTreeWeightedRandomNode::LocalExecute().
|
inline |
References mLastExecute.
Referenced by Execute(), and FindLastExecuted().
|
inline |
References mFailureReason.
|
inline |
References mFileLastModTime.
|
inline |
References mFullPathFileName.
| void WsfBehaviorTreeNode::FindLastExecuted | ( | std::vector< WsfBehaviorTreeNode * > & | aLastExecuted | ) |
References ChildCount(), ExecutedLastRun(), and mChildren.
Referenced by WsfBehaviorTree::FindLastExecuted().
| WsfBehaviorTreeNode * WsfBehaviorTreeNode::FindNode | ( | const std::string & | aNodeName | ) |
References FindNode(), WsfObject::GetType(), mChildren, and WsfBehaviorTreeNode().
Referenced by WsfBehaviorTree::FindNode(), and FindNode().
|
inline |
References mScenario.
Referenced by WsfBehaviorTreeLeafNode::ProcessInput().
|
override |
References mContextPtr.
|
override |
|
inline |
References mContextPtr.
Referenced by WsfScriptBehaviorTreeNodeClass::GetContext(), and WsfBehaviorTreeNode().
| WsfSimulation * WsfBehaviorTreeNode::GetSimulation | ( | ) |
References mContextPtr, OwningPlatform(), and platformPtr.
Referenced by WsfBehaviorTreeWeightedRandomNode::LocalExecute(), LogNodeStructure(), SetExecutedLastRun(), and SetFailureReason().
|
inlinestatic |
Referenced by WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
inline |
References mId.
Referenced by WsfBehaviorTreePrioritySelectorNode::LocalExecute(), and WsfBehaviorTreeWeightedRandomNode::LocalExecute().
|
virtual |
Reimplemented in WsfBehaviorTreeLeafNode.
References mChildren, mContextPtr, mFiniteStateMachinePtr, mInitialized, mMessageHandlerPtr, mStateIndex, OwningPlatform(), and OwningProcessor().
|
pure virtual |
Implemented in WsfBehaviorTreeLeafNode, WsfBehaviorTreeParallelNode, WsfBehaviorTreePrioritySelectorNode, WsfBehaviorTreeSelectorNode, WsfBehaviorTreeSequenceNode, and WsfBehaviorTreeWeightedRandomNode.
Referenced by Execute().
| void WsfBehaviorTreeNode::LogNodeStructure | ( | double | aSimTime, |
| bool | aRecurse ) |
|
delete |
References WsfBehaviorTreeNode().
| WsfPlatform * WsfBehaviorTreeNode::OwningPlatform | ( | ) |
References WsfPlatformPart::GetPlatform(), and OwningProcessor().
Referenced by GetSimulation(), WsfBehaviorTreeLeafNode::Initialize(), and Initialize().
| WsfScriptProcessor * WsfBehaviorTreeNode::OwningProcessor | ( | ) |
References OwningTree(), and WsfBehaviorTree::ParentProcessor().
Referenced by WsfBehaviorTreeLeafNode::Initialize(), Initialize(), and OwningPlatform().
| WsfBehaviorTree * WsfBehaviorTreeNode::OwningTree | ( | ) |
References mParentTreePtr.
Referenced by OwningProcessor().
|
inline |
References mParentPtr, and WsfBehaviorTreeNode().
Referenced by UT_DEFINE_SCRIPT_METHOD().
| bool WsfBehaviorTreeNode::PreconditionsMet | ( | ) |
References mContextPtr, and mPreconditionScriptPtr.
Referenced by Execute().
| double WsfBehaviorTreeNode::PreconditionValue | ( | ) |
References mContextPtr, and mPreconditionScriptPtr.
|
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'.
| aInput | a reference to a UtInput object. |
| UtInput::ExceptionBase | (or an object derived from it) if the command was recognized but contains some sort of error. |
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().
|
virtual |
References mMessageHandlerPtr.
Referenced by WsfScriptProcessor::ProcessMessage().
|
inlinevirtual |
Reimplemented in WsfBehaviorTreeLeafNode.
|
inlinestatic |
| void WsfBehaviorTreeNode::SetExecutedLastRun | ( | bool | aVal | ) |
| void WsfBehaviorTreeNode::SetExecutedLastRun | ( | bool | aVal, |
| const std::string & | aReason ) |
References SetExecutedLastRun(), and SetFailureReason().
| void WsfBehaviorTreeNode::SetExecutedLastRunRecursive | ( | bool | aVal | ) |
References mChildren, and SetExecutedLastRun().
Referenced by Execute().
| void WsfBehaviorTreeNode::SetExecutedLastRunRecursive | ( | bool | aVal, |
| const std::string & | aReason ) |
References mChildren, and SetExecutedLastRun().
| void WsfBehaviorTreeNode::SetFailureReason | ( | const std::string & | aReason, |
| bool | aSendEvent = false ) |
References WsfObserver::BehaviorTreeNodeExec(), GetSimulation(), mContextPtr, mFailureReason, mFailureTime, and simTime.
Referenced by WsfBehaviorTreeParallelNode::LocalExecute(), WsfBehaviorTreePrioritySelectorNode::LocalExecute(), WsfBehaviorTreeSelectorNode::LocalExecute(), WsfBehaviorTreeSequenceNode::LocalExecute(), WsfBehaviorTreeWeightedRandomNode::LocalExecute(), SetExecutedLastRun(), ShouldRunNext(), and UT_DEFINE_SCRIPT_METHOD().
| void WsfBehaviorTreeNode::SetFileInfo | ( | const std::string & | aPath, |
| time_t | aModTime ) |
References mFileLastModTime, and mFullPathFileName.
Referenced by SetFilePath().
| void WsfBehaviorTreeNode::SetFilePath | ( | const std::string & | aPath | ) |
References SetFileInfo().
Referenced by WsfBehaviorTree::CreateNode(), WsfBehaviorTree::ProcessInput(), and WsfBehaviorTreeLeafNode::RegisterInput().
|
inline |
References mParentPtr, and WsfBehaviorTreeNode().
Referenced by AddChild().
|
virtual |
Reimplemented in WsfBehaviorTreeLeafNode.
References mChildren, and mParentTreePtr.
Referenced by WsfBehaviorTree::CreateNode(), WsfBehaviorTree::operator=(), and WsfBehaviorTree::WsfBehaviorTree().
| bool WsfBehaviorTreeNode::ShouldRunNext | ( | double | aSimTime | ) |
References Finite, mChildren, mRepeats, mRepeatsLeft, mSelectCount, mSelectLimit, mSelectType, and SetFailureReason().
Referenced by Execute().
| bool WsfBehaviorTreeNode::TryRunLast | ( | double | aSimTime | ) |
References ForTime, mLastNodeSelectedPtr, mRepeatsLeft, mRunDuration, mRunStartTime, mRunType, Repeat, and UntilDone.
Referenced by Execute().
|
inline |
References mTurnedOn.
Referenced by UT_DEFINE_SCRIPT_METHOD().
|
inline |
References mTurnedOn.
|
friend |
References WsfBehaviorTreeLeafNode.
Referenced by WsfBehaviorTreeLeafNode::Clone(), and WsfBehaviorTreeLeafNode.
|
friend |
References WsfBehaviorTreeParallelNode.
Referenced by WsfBehaviorTreeParallelNode::Clone(), and WsfBehaviorTreeParallelNode.
|
friend |
References WsfBehaviorTreePrioritySelectorNode.
Referenced by WsfBehaviorTreePrioritySelectorNode::Clone(), and WsfBehaviorTreePrioritySelectorNode.
|
friend |
References WsfBehaviorTreeSelectorNode.
Referenced by WsfBehaviorTreeSelectorNode::Clone(), and WsfBehaviorTreeSelectorNode.
|
friend |
References WsfBehaviorTreeSequenceNode.
Referenced by WsfBehaviorTreeSequenceNode::Clone(), and WsfBehaviorTreeSequenceNode.
|
friend |
References WsfBehaviorTreeWeightedRandomNode.
Referenced by WsfBehaviorTreeWeightedRandomNode::Clone(), and WsfBehaviorTreeWeightedRandomNode.
|
protected |
Referenced by AddChild(), ChildCount(), ChildEntry(), Children(), FindLastExecuted(), FindNode(), WsfBehaviorTreeLeafNode::Initialize(), Initialize(), WsfBehaviorTreeLeafNode::LocalExecute(), WsfBehaviorTreeParallelNode::LocalExecute(), WsfBehaviorTreePrioritySelectorNode::LocalExecute(), WsfBehaviorTreeSelectorNode::LocalExecute(), WsfBehaviorTreeSequenceNode::LocalExecute(), WsfBehaviorTreeWeightedRandomNode::LocalExecute(), LogNodeStructure(), SetExecutedLastRunRecursive(), SetExecutedLastRunRecursive(), SetTree(), ShouldRunNext(), WsfBehaviorTreeNode(), and ~WsfBehaviorTreeNode().
|
protected |
Referenced by GetScriptAccessibleContext(), GetScriptContext(), GetSimulation(), WsfBehaviorTreeLeafNode::Initialize(), Initialize(), WsfBehaviorTreeLeafNode::LocalExecute(), PreconditionsMet(), PreconditionValue(), WsfBehaviorTreeLeafNode::ProcessInput(), ProcessInput(), WsfBehaviorTreeLeafNode::RegisterExternVariable(), SetExecutedLastRun(), SetFailureReason(), WsfBehaviorTreeLeafNode::WsfBehaviorTreeLeafNode(), WsfBehaviorTreeNode(), WsfBehaviorTreeNode(), and ~WsfBehaviorTreeNode().
|
protected |
|
protected |
Referenced by Execute(), FailureReason(), SetFailureReason(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Execute(), SetFailureReason(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by FileLastModTime(), SetFileInfo(), and WsfBehaviorTreeNode().
|
protected |
|
protected |
Referenced by FilePath(), SetFileInfo(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Id(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Initialize(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by ExecutedLastRun(), SetExecutedLastRun(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
|
protected |
|
protected |
Referenced by ProcessInput(), SetExecutedLastRun(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by ProcessInput(), SetExecutedLastRun(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Parent(), SetParent(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
|
protected |
Referenced by PreconditionsMet(), PreconditionValue(), ProcessInput(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
|
protected |
|
protected |
Referenced by ProcessInput(), TryRunLast(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
|
protected |
Referenced by ProcessInput(), TryRunLast(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by GetScenario(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by ShouldRunNext(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by ProcessInput(), ShouldRunNext(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by ProcessInput(), ShouldRunNext(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Execute(), WsfBehaviorTreeLeafNode::Initialize(), Initialize(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().
|
protected |
Referenced by Execute(), TurnOff(), TurnOn(), WsfBehaviorTreeNode(), and WsfBehaviorTreeNode().