WSF
WsfInterceptCalc.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// Classification: UNCLASSIFIED
10
11#ifndef WSF_INTERCEPT_CALLBACK_HPP
12#define WSF_INTERCEPT_CALLBACK_HPP
13
14#include "WsfBMCommon.hpp"
15
16#include <map>
17
18#include "UtScript.hpp"
19#include "WsfSimulation.hpp"
20#include "WsfPlatform.hpp"
21#include "WsfGeoPoint.hpp"
24class WsfWeapon;
25
26#include <iadsLib/interceptCalculatorInterface.hpp>
27
28class WSF_IADS_C2_LIB_EXPORT WsfInterceptCalculator : public il::InterceptCalculatorIface
29{
30 public:
32 virtual ~WsfInterceptCalculator() = default;
33
34 bool Initialize(WsfScriptProcessor* script_proc);
35 // can be called on an uninitialized WsfInterceptCalculator()
36 virtual bool ScriptCalculatorExists(WsfScriptProcessor* processor, WsfPlatform* owning_platform);
37
38 bool CanIntercept(const il::trackRecord& track, const il::weaponRecord* weapon, double& interceptTime_s, double pred_pt_ecef_m[3], double& est_pk, double& weap_max_range, std::weak_ptr<il::logger::GlobalLogger> aGlobalLogger) override;
39 // we can also fold in an AFSIM-layer interface
40 virtual bool CanIntercept(WsfTrack* track, WsfPlatform* owning_platform, WsfWeapon* weapon, double& interceptTime_s, double pred_pt_ecef_m[3], double& est_pk, double& weap_max_range);
41
42 protected:
43 // own-processor related contexts for intercept calculation
45 UtScript* m_script;
46
48
49 // if the weapon doesn't have a launch computer then we need to see if there is a calculator deployed on the owning platform
50 // we'll cache these for future invocations
51 typedef std::map<il::idRecord, std::pair<WsfPlatform*, UtScript*>> tPlatformInterceptCalcCache;
53
54 UtScript* GetInterceptCalculatorOnPlatform(WsfPlatform* platform, bool cache = true);
55
56 UtScript* GetInterceptCalculator(WsfScriptContext& context);
57};
58
59#endif
bool CanIntercept(const il::trackRecord &track, const il::weaponRecord *weapon, double &interceptTime_s, double pred_pt_ecef_m[3], double &est_pk, double &weap_max_range, std::weak_ptr< il::logger::GlobalLogger > aGlobalLogger) override
Definition WsfInterceptCalc.cpp:55
WsfInterceptCalculator()
Definition WsfInterceptCalc.cpp:22
UtScript * GetInterceptCalculator(WsfScriptContext &context)
Definition WsfInterceptCalc.cpp:190
tPlatformInterceptCalcCache m_platform_calculators
Definition WsfInterceptCalc.hpp:52
UtScript * GetInterceptCalculatorOnPlatform(WsfPlatform *platform, bool cache=true)
Definition WsfInterceptCalc.cpp:204
virtual ~WsfInterceptCalculator()=default
bool Initialize(WsfScriptProcessor *script_proc)
Definition WsfInterceptCalc.cpp:28
WsfScriptProcessor * m_script_proc
Definition WsfInterceptCalc.hpp:44
WsfScriptContext & GetContext()
Definition WsfInterceptCalc.cpp:185
UtScript * m_script
Definition WsfInterceptCalc.hpp:45
std::map< il::idRecord, std::pair< WsfPlatform *, UtScript * > > tPlatformInterceptCalcCache
Definition WsfInterceptCalc.hpp:51
virtual bool ScriptCalculatorExists(WsfScriptProcessor *processor, WsfPlatform *owning_platform)
Definition WsfInterceptCalc.cpp:50
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfScriptContext.hpp:71
Definition WsfScriptProcessor.hpp:43
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfWeapon.hpp:63
Copyrights Multiple, All Rights Reserved