WSF
WsfBehaviorTree.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFBEHAVIORTREE_HPP
13#define WSFBEHAVIORTREE_HPP
14
15#include <string>
16#include <vector>
17
18class UtInput;
22#include "wsf_export.h"
23
24#include "WsfObject.hpp"
25class WsfScenario;
28class WsfSimulation;
29
31{
32public:
33 WsfBehaviorTree(const WsfScenario& aScenario);
36 WsfBehaviorTree* Clone() const override;
37 ~WsfBehaviorTree() override;
38
39 // clones a node from its type definition, records it in map,
40 // returns it for insertion into tree structure
41 WsfBehaviorTreeNode* CreateNode(UtInput& aInput);
42
43 bool ProcessInput(UtInput& aInput) override;
44
45 bool Execute(double simTime);
46
47 bool Initialize(double aSimTime, WsfScriptProcessor* aParentPtr, WsfScriptContext* aParentContextPtr = nullptr);
48
49 WsfBehaviorTreeParallelNode* RootNode() const { return mRootNodePtr; }
50
51 WsfScriptProcessor* ParentProcessor() { return mParentPtr; }
52
53 WsfBehaviorTreeNode* FindNode(const std::string& aNodeName) const; // from whole tree
54
57 void FindLastExecuted(std::vector<WsfBehaviorTreeNode*>& aLastExecuted) const; // from whole tree
58
59 size_t NodeCount() const; // only counting leaf "behavior" nodes
60 WsfBehaviorTreeLeafNode* NodeEntry(size_t aIndex) const; // only counting leaf "behavior" nodes
61
62 void RegisterBehaviorNode(WsfBehaviorTreeLeafNode* aNodePtr);
63
64 WsfSimulation* GetSimulation();
65
66private:
67 WsfBehaviorTreeParallelNode* mRootNodePtr;
68 WsfScriptProcessor* mParentPtr;
69 std::vector<WsfBehaviorTreeLeafNode*> mBehaviorNodes;
70};
71
72#endif
double simTime
Definition WsfScriptTrackClass.cpp:1880
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfBehaviorTreeNode.hpp:174
Definition WsfBehaviorTreeNode.hpp:38
Definition WsfBehaviorTreeNode.hpp:248
WsfBehaviorTreeNode * CreateNode(UtInput &aInput)
Definition WsfBehaviorTree.cpp:62
WsfBehaviorTreeParallelNode * RootNode() const
Definition WsfBehaviorTree.hpp:49
bool Initialize(double aSimTime, WsfScriptProcessor *aParentPtr, WsfScriptContext *aParentContextPtr=nullptr)
Definition WsfBehaviorTree.cpp:189
WsfBehaviorTree(const WsfScenario &aScenario)
Definition WsfBehaviorTree.cpp:24
WsfScriptProcessor * ParentProcessor()
Definition WsfBehaviorTree.hpp:51
bool Execute(double simTime)
Definition WsfBehaviorTree.cpp:179
WsfObject()
This is the constructor for the WsfObject class.
Definition WsfObject.cpp:88
virtual WsfObject * Clone() const =0
WsfObject & operator=(const WsfObject &aRhs)
Assignment operator.
Definition WsfObject.cpp:258
virtual bool ProcessInput(UtInput &aInput)
Definition WsfObject.cpp:140
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfScriptContext.hpp:71
Definition WsfScriptProcessor.hpp:43
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Copyrights Multiple, All Rights Reserved