WSF
WsfBattleManager.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// The use, dissemination or disclosure of data in this file is subject to
7// limitation or restriction. See accompanying README and LICENSE for details.
8// ****************************************************************************
9/*******************************************************************************
10*
11* File: WsfBattleManager.hpp
12*
13* Classification: UNCLASSIFIED
14*
15* Details:
16*
17* Contract Number:
18* Contractor Name: Radiance Technologies
19* Address: 350 Wynn Drive
20* Huntsville, AL 35805
21*
22* Abstract: This is an afsim base class for all battle manager
23* implementation classes to inherit from. It provides necessary common functionality.
24* It's not pure abstract in the sense that we actually instantiate an object of this
25* type purely for type registration purposes with the sole intent of giving AFSIM
26* scripts the ability to up/down cast to and from the inherited types.
27*
28*******************************************************************************/
29
30#ifndef WSF_BATTLE_MANAGER_HPP
31#define WSF_BATTLE_MANAGER_HPP
32
33namespace il
34{
35 class BattleManagerInterface;
36 class AssetManagerInterface;
37}
38
39#include <map>
40#include <memory>
41
44#include <UtCallbackHolder.hpp>
45
49#include "WsfBMCommon.hpp"
50#include "WsfBMAssetRecord.hpp"
51#include "WsfAssetMap.hpp"
52#include <WsfTrack.hpp>
54#include <WsfInterceptCalc.hpp>
57
58WsfProcessor* UninitializedWsfBattleManager(WsfScenario& aScenario, const std::string& calling_context);
59
61{
62 public:
63
65 const std::string& aPartClass = WsfScriptBattleManagerClass::SCRIPT_CLASS_NAME,
66 const std::string& aPartVarName = "PROCESSOR",
67 const std::shared_ptr<il::BattleManagerInterface>& bm_component = std::make_shared<il::BattleManagerInterface>());
68
69 virtual ~WsfBattleManager();
70
71 virtual bool SetSimulation(WsfSimulation* sim_ptr);
72
73 WsfProcessor* Clone() const override;
74
75 // Plugin Interface
76 static void RegisterScriptTypes(WsfApplication* aApplicationPtr);
77 static WsfProcessor* Create(WsfScenario& aScenario);
78 static std::unique_ptr<WsfBattleManager> CreateUnique(WsfScenario& aScenario);
79 // End Plugin Interface
80
81 bool ProcessInput(UtInput& aInput) override;
82
83 const char* GetScriptClassName() const override;
84 virtual const char* GetBaseClassName();
85
86 // Ownership goes to caller - responsible for destroying
87 virtual WsfAssetMap* GetAssetMapPtr();
88
89 // Don't replicate all of the set interfaces, this can be handled outside of here when we deal directly with the asset map itself.
90
91 bool Initialize(double aSimTime) override;
92 bool Initialize2(double aSimTime) override;
93
94 void Update(double aSimTime) override;
95 void Run(const double aSimTime) override; // HELIOS C2 component interface for invoking processor periodic updates
96
97 bool ProcessMessage(double aSimTime, const WsfMessage& aMessage) override;
98 bool ReceiveMessage(double aSimTime, const WsfMessage& aMessage) override;
99
100 protected:
102 std::shared_ptr<WsfBMTerrainInterface> m_terrain_engine;
103 std::shared_ptr<WsfInterceptCalculator> m_intercept_calculator;
104
105 // Note: Copying the battle manager doesn't make sense because it needs to be initialized
106 // and that initialization is tied to a specific platform, processor, etc. However,
107 // the copy constructor is required because Clone() needs it in order to properly clone the
108 // object (albeit with no initialization tied to it). so we'll basically use it to get a
109 // copy of a cloned object that is yet to be initialized in order for the prototypical
110 // inheritance to work.
112
113 virtual void SetupPointerCrossReferences();
114
115 virtual bool ProcessAssetManagementInput(UtInput& aInput);
116 virtual bool ProcessIFFSettings(UtInput& aInput);
117 virtual bool ProcessBattleManagementInput(UtInput& aInput);
118 virtual bool ProcessTargetProjectionInput(UtInput& aInput);
119
120 private:
121 WsfBattleManager& operator=(const WsfBattleManager& rhs) = delete;;
122};
123
124#endif
WsfProcessor * UninitializedWsfBattleManager(WsfScenario &aScenario, const std::string &calling_context)
Definition WsfBattleManager.cpp:53
Definition WsfApplication.hpp:45
Definition WsfAssetMap.hpp:23
WsfDefaultBattleManagerImpl m_default_bm_impl
Definition WsfBattleManager.hpp:101
virtual bool ProcessAssetManagementInput(UtInput &aInput)
Definition WsfBattleManager.cpp:250
WsfBattleManager(WsfScenario &aScenario, const std::string &aPartClass=WsfScriptBattleManagerClass::SCRIPT_CLASS_NAME, const std::string &aPartVarName="PROCESSOR", const std::shared_ptr< il::BattleManagerInterface > &bm_component=std::make_shared< il::BattleManagerInterface >())
Definition WsfBattleManager.cpp:64
std::shared_ptr< WsfInterceptCalculator > m_intercept_calculator
Definition WsfBattleManager.hpp:103
std::shared_ptr< WsfBMTerrainInterface > m_terrain_engine
Definition WsfBattleManager.hpp:102
virtual bool ProcessIFFSettings(UtInput &aInput)
Definition WsfBattleManager.cpp:280
static WsfProcessor * Create(WsfScenario &aScenario)
Definition WsfBattleManager.cpp:121
virtual WsfAssetMap * GetAssetMapPtr()
Definition WsfBattleManager.cpp:158
virtual bool ProcessTargetProjectionInput(UtInput &aInput)
Definition WsfBattleManager.cpp:343
virtual const char * GetBaseClassName()
Definition WsfBattleManager.cpp:153
virtual bool SetSimulation(WsfSimulation *sim_ptr)
Definition WsfBattleManager.cpp:99
static std::unique_ptr< WsfBattleManager > CreateUnique(WsfScenario &aScenario)
Definition WsfBattleManager.cpp:126
virtual void SetupPointerCrossReferences()
Definition WsfBattleManager.cpp:244
virtual bool ProcessBattleManagementInput(UtInput &aInput)
Definition WsfBattleManager.cpp:330
static void RegisterScriptTypes(WsfApplication *aApplicationPtr)
Definition WsfBattleManager.cpp:109
WsfC2ComponentContainer(const std::shared_ptr< il::BattleManagerInterface > &component, const std::shared_ptr< il::moeLoggingInterface > &logger=nullptr)
Definition WsfC2ComponentRefInterface.cpp:31
Definition WsfDefaultBattleManagerImpl.hpp:45
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
virtual bool ReceiveMessage(double aSimTime, const WsfMessage &aMessage)
Definition WsfPlatformPart.cpp:465
Definition WsfProcessor.hpp:39
WsfProcessor & operator=(const WsfProcessor &aRhs)=delete
WsfProcessor(const WsfScenario &aScenario)
Definition WsfProcessor.cpp:25
const char * GetScriptClassName() const override
Definition WsfProcessor.cpp:63
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
static const char * SCRIPT_CLASS_NAME
Definition WsfScriptBattleManagerClass.hpp:46
WsfScriptOverridableProcessor(const bool autonomous_updates)
Definition WsfScriptOverridableProcessor.hpp:36
virtual void Run(const double sim_time_s)=0
bool Initialize2(double aSimTime) override
Definition WsfScriptProcessor.cpp:142
void Update(double aSimTime) override
Definition WsfScriptProcessor.cpp:281
WsfProcessor * Clone() const override
Definition WsfScriptProcessor.cpp:97
WsfScriptProcessor(const WsfScenario &aScenario)
Definition WsfScriptProcessor.cpp:30
bool Initialize(double aSimTime) override
Definition WsfScriptProcessor.cpp:104
bool ProcessInput(UtInput &aInput) override
Definition WsfScriptProcessor.cpp:186
bool ProcessMessage(double aSimTime, const WsfMessage &aMessage) override
Definition WsfScriptProcessor.cpp:300
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfAssetManager.hpp:34
Copyrights Multiple, All Rights Reserved