24#include "wsf_mil_export.h"
99 void Select(
double aSimTime)
override = 0;
181 void Update(
double aSimTime)
override;
186 void TurnOff(
double aSimTime)
override;
187 void TurnOn(
double aSimTime)
override;
191 void Restore(
double aSimTime)
override;
200 virtual size_t GetEM_RcvrCount()
const;
201 virtual WsfEM_Rcvr& GetEM_Rcvr(
size_t aIndex);
203 virtual size_t GetEM_XmtrCount()
const;
204 virtual WsfEM_Xmtr& GetEM_Xmtr(
size_t aIndex);
205 virtual size_t GetEM_XmtrCount(
size_t aModeIndex)
const;
206 virtual WsfEM_Xmtr& GetEM_Xmtr(
size_t aModeIndex,
size_t aIndex);
207 virtual WsfEM_Xmtr& GetEM_Xmtr(
size_t aModeIndex,
size_t aBeamIndex,
size_t aIndex);
214 virtual WsfWeaponMode* GetCurrentMode();
215 virtual size_t GetModeCount();
216 virtual WsfWeaponMode* GetModeEntry(
size_t aModeIndex);
217 virtual size_t GetModeIndex(
WsfStringId aModeNameId);
218 virtual WsfStringId GetModeName(
size_t aModeIndex);
219 virtual void DeselectMode(
double aSimTime,
WsfStringId aModeNameId);
220 virtual void SelectMode(
double aSimTime,
WsfStringId aModeNameId);
306 SalvoOptions(
int aQuantity,
double aSalvoInterval = -1.0,
int aWeaponId = 0)
351 virtual void ContinueSalvo(
double aSimTime,
unsigned int aRequestId);
412 virtual double GetQuantityRemaining()
const;
413 virtual double GetQuantityCommitted()
const;
414 virtual double GetMaximumQuantity()
const;
415 virtual double GetTotalQuantityUsed()
const;
416 virtual void SetQuantityRemaining(
double aQuantity);
417 void ChangeQuantity(
double aDeltaQuantity);
434 virtual void CompleteReloading(
double aSimTime,
double aQuantity);
456 bool GetTargetLocationWCS(
double aSimTime,
const WsfTrack* aTrackPtr,
double aTargetLocWCS[3]);
476 virtual bool WithinFieldOfView(
double aSimTime,
WsfPlatform* aPlatformPtr);
477 virtual bool WithinFieldOfView(
double aSimTime,
WsfTrack* aTrackPtr);
499 virtual bool StopJamming(
double aSimTime,
double aFrequency,
double aBandwidth,
size_t aBeamNumber,
WsfTrackId aTrackId)
548 double aJammingDeltaGain_dB,
559 double aJammingDeltaGain_dB,
584 double TimeWeaponLastFiredFor(
const WsfTrackId& aTrackId)
const;
585 double TimeWeaponLastTerminatedFor(
const WsfTrackId& aTrackId)
const;
586 int WeaponsPendingFor(
const WsfTrackId& aTrackId)
const;
587 int WeaponsActiveFor(
const WsfTrackId& aTrackId)
const;
588 int RoundsCompleteFor(
const WsfTrackId& aTrackId)
const;
589 int WeaponsActiveAndPendingFor(
const WsfTrackId& aTrackId)
const;
590 int RoundsFiredAt(
const WsfTrackId& aTrackId)
const;
591 int SalvosFiredAt(
const WsfTrackId& aTrackId)
const;
592 std::vector<size_t> ActiveWeaponPlatformsFor(
const WsfTrackId& aTrackId)
const;
605 virtual bool AllocateTheWeapon(
double aSimTime,
WsfTrack* aTrackPtr,
int aStoreId);
607 void SetState(WeaponState aState);
620 virtual void ProcessReloading(
double aSimTime);
627 void SetTimeLastFired(
double aTimeLastFired);
640 size_t mPlatformIndex;
641 unsigned int mRequestId;
653 size_t mPlatformIndex;
736 enum AltitudeReference
743 using SalvoRequestList = std::vector<std::unique_ptr<SalvoRequest>>;
745 ComponentList mComponents;
753 unsigned int mUpdateEventEpoch;
756 bool mUpdateEventActive;
773 bool mIsQuantitySpecified;
778 double mInitialStateQuantityRemaining;
785 double mTotalQuantityUsed;
788 double mQuantityCommitted;
815 double mTimeLastFired;
819 unsigned int mMaximumRequestCount;
822 unsigned int mSalvoRequestId;
825 SalvoRequestList mSalvoRequestList;
836 AltitudeReference mUnknownTargetAltitudeRef;
842 bool mAutomaticTargetCueing;
845 bool mCueToPredictedIntercept;
851 bool mInhibitWhileReloading;
859 std::vector<WsfWeaponMode*> mWeaponModeList;
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_WEAPON
Weapon component.
Definition WsfMilComponentRoles.hpp:18
@ cWSF_INITIALIZE_ORDER_WEAPON
Definition WsfMilComponentRoles.hpp:47
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
bool ProcessInput(UtInput &aInput) override
Definition WsfArticulatedPart.cpp:205
bool Initialize(double aSimTime) override
Definition WsfArticulatedPart.cpp:170
void * QueryInterface(int aRole) override
Definition WsfArticulatedPart.cpp:159
WsfArticulatedPart(const WsfScenario &aScenario, int aPartType)
Definition WsfArticulatedPart.cpp:29
const char * GetScriptClassName() const override
Definition WsfArticulatedPart.cpp:1074
const int * GetComponentRoles() const override
Definition WsfArticulatedPart.cpp:153
A component list that stores only components of a specified type.
Definition WsfComponentList.hpp:343
Definition WsfComponent.hpp:39
virtual bool PreInitialize(double aSimTime)
Definition WsfComponent.cpp:24
virtual void PreInput()
Definition WsfComponent.cpp:86
Definition WsfEM_Rcvr.hpp:68
Definition WsfEM_Xmtr.hpp:55
EventDisposition
Definition WsfEvent.hpp:37
Definition WsfLaunchComputer.hpp:35
Definition WsfModeList.hpp:31
WsfMode()
Definition WsfMode.cpp:15
virtual WsfObject * Clone() const =0
Definition WsfRandomVariable.hpp:33
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfTrackId.hpp:33
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Definition WsfVariable.hpp:149
Definition WsfWeaponEngagement.hpp:43
EventDisposition Execute() override
Definition WsfWeapon.cpp:1958
~CompleteReloadEvent() override=default
CompleteReloadEvent(double aCompletionTime, double aReloadedAmount, WsfWeapon *aWeaponPtr)
Definition WsfWeapon.cpp:1948
Weapon firing options.
Definition WsfWeapon.hpp:275
std::string mWeaponPlatformName
Name of the explicit weapon platform. If empty, the weapon will create a new unique name.
Definition WsfWeapon.hpp:291
WsfStringId mWeaponComponentName
Name of the weapon component that will be used to fire.
Definition WsfWeapon.hpp:294
FireOptions(int aWeaponId)
Definition WsfWeapon.hpp:282
int mWeaponId
The weapon id assigned to an allocated weapon platform.
Definition WsfWeapon.hpp:288
FireOptions()
Definition WsfWeapon.hpp:277
Result of WsfWeapon::Fire().
Definition WsfWeapon.hpp:319
WsfWeaponEngagement * mEngagementPtr
Definition WsfWeapon.hpp:340
bool mSuccess
'true' if WsfWeapon::Fire() is successful, 'false' otherwise.
Definition WsfWeapon.hpp:336
FireResult()
Definition WsfWeapon.hpp:321
FireResult(bool aResult)
Definition WsfWeapon.hpp:327
A target for a weapon to fire upon.
Definition WsfWeapon.hpp:243
WsfTrackId mTrackId
Definition WsfWeapon.hpp:265
FireTarget()
Definition WsfWeapon.hpp:245
const WsfTrack * mTrackPtr
Definition WsfWeapon.hpp:260
FireTarget(const WsfTrack *aTrackPtr)
Definition WsfWeapon.hpp:249
std::string mTargetName
The target name against which to fire the weapon.
Definition WsfWeapon.hpp:263
std::string mTargetOffset
Definition WsfWeapon.hpp:270
EventDisposition Execute() override
Definition WsfWeapon.cpp:1935
SalvoEvent(double aSimTime, WsfWeapon *aWeaponPtr, unsigned int aRequestId)
Definition WsfWeapon.cpp:1923
~SalvoEvent() override=default
Salvoing options.
Definition WsfWeapon.hpp:299
SalvoOptions()
Definition WsfWeapon.hpp:301
double mSalvoInterval
The number of rounds to fire.
Definition WsfWeapon.hpp:314
SalvoOptions(int aQuantity, double aSalvoInterval=-1.0, int aWeaponId=0)
Definition WsfWeapon.hpp:306
int mQuantity
Definition WsfWeapon.hpp:313
WsfPlatform * GetPlatform() const
Return the pointer to the platform to which the associated weapon is attached.
Definition WsfWeapon.hpp:86
void Select(double aSimTime) override=0
~WsfWeaponMode() override=default
WsfWeapon * GetWeapon() const
Return the pointer to the weapon with which this mode is associated.
Definition WsfWeapon.hpp:89
WsfPlatform * mPlatformPtr
Pointer to the platform with which the weapon is associated.
Definition WsfWeapon.hpp:106
WsfWeaponMode & operator=(const WsfWeaponMode &)=delete
WsfWeapon * mWeaponPtr
Pointer to the weapon with which the mode is associated.
Definition WsfWeapon.hpp:108
void Deselect(double aSimTime) override=0
WsfMode * Clone() const override=0
Create an exact duplicate of this mode.
const WsfScenario & GetScenario() const
Definition WsfWeapon.hpp:101
const WsfScenario & mScenario
Definition WsfWeapon.hpp:104
WsfWeaponMode(const WsfScenario &aScenario)
Definition WsfWeapon.cpp:1970
Definition WsfWeapon.hpp:63
bool GetIFCEnabled() const
Returns 'true' if the platform supports IFC (Integrated Fire Control).
Definition WsfWeapon.hpp:601
virtual bool UpdateJamming(double aSimTime, size_t aXmtrIndex, double aFrequency, double aBandwidth, WsfStringId aTechniqueId, WsfTrackId aTrackId, size_t aTargetIndex)
Definition WsfWeapon.hpp:504
double GetInitialStateQuantityRemaining() const
Definition WsfWeapon.hpp:411
virtual size_t GetActiveBeamCount() const
Definition WsfWeapon.hpp:515
bool InhibitWhileReloading() const
Flag indicating that when a weapon reload is in progress, any firing will be inhibited.
Definition WsfWeapon.hpp:432
virtual bool SetEA_DeltaGainTechnique(double aSimTime, WsfStringId aTechniqueId, bool aOnOff, WsfStringId aEffectId, double aJammingDeltaGain_dB, WsfStringId aSystemTypeId, WsfStringId aFunctionTypeId)
Definition WsfWeapon.hpp:544
const ComponentList & GetComponents() const
Definition WsfWeapon.hpp:159
WsfStringId GetWeaponEffectsType() const
Get the string ID of the weapon effects to be used.
Definition WsfWeapon.hpp:235
void SetLaunchedPlatformType(WsfStringId aLaunchedPlatformType)
Set the type of the platform that will be launched.
Definition WsfWeapon.hpp:401
virtual void SetTargetedLocationWCS(int aId, const double aTargetedLocationWCS[3])
Definition WsfWeapon.hpp:466
virtual size_t GetMaximumBeamCount() const
Definition WsfWeapon.hpp:516
WsfWeapon(const WsfScenario &aScenario)
Definition WsfWeapon.cpp:48
WsfWeapon * Clone() const override=0
virtual bool FireSalvo(double aSimTime, const FireTarget &aTarget, const SalvoOptions &aSettings)
Definition WsfWeapon.cpp:847
static const double cUNDEFINED_DOUBLE
Definition WsfWeapon.hpp:65
virtual void ContinueSalvo(double aSimTime, unsigned int aRequestId)
Definition WsfWeapon.cpp:890
WeaponStatusMap mWeaponStatusMap
Definition WsfWeapon.hpp:731
double GetUpdateInterval() const override
Get the update interval.
Definition WsfWeapon.hpp:195
virtual bool SetEA_DeltaGainTechnique(double aSimTime, WsfStringId aTechniqueId, bool aOnOff, WsfStringId aEffectId, double aJammingDeltaGain_dB, WsfStringId aSystemTypeId, WsfStringId aFunctionTypeId, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:555
static double TimeWeaponLastTerminatedFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1621
WsfComponent * CloneComponent() const override
Definition WsfWeapon.hpp:164
double GetReloadIncrement() const
Definition WsfWeapon.hpp:446
double GetFiringInterval() const
Definition WsfWeapon.hpp:387
std::pair< WsfTrackId, WeaponStatus > WeaponStatusVal
Definition WsfWeapon.hpp:730
virtual double GetSalvoInterval()
Definition WsfWeapon.hpp:382
WeaponState
Definition WsfWeapon.hpp:68
@ cWEAPON_STATE_NACK
Definition WsfWeapon.hpp:72
@ cWEAPON_STATE_READY
Definition WsfWeapon.hpp:73
@ cWEAPON_STATE_UNALLOCATED
Definition WsfWeapon.hpp:69
@ cWEAPON_STATE_ALLOCATED
Definition WsfWeapon.hpp:70
@ cWEAPON_STATE_DEALLOCATE
Definition WsfWeapon.hpp:71
WsfModeList * mModeListPtr
The pointer to the list of modes (for things like jammers).
Definition WsfWeapon.hpp:670
ComponentList & GetComponents()
Definition WsfWeapon.hpp:158
WsfWeapon & operator=(const WsfWeapon &)=delete
virtual bool DeselectEA_Technique(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:534
WeaponStatusMap::const_iterator WeaponStatusMapConstIter
Definition WsfWeapon.hpp:729
int GetComponentInitializationOrder() const override
Definition WsfWeapon.hpp:167
double GetReloadInterval() const
Definition WsfWeapon.hpp:672
WsfStringId GetLaunchedPlatformType() const
Get the type of the platform that will be launched.
Definition WsfWeapon.hpp:398
virtual void CeaseFire(double aSimTime)
Definition WsfWeapon.cpp:996
void SetWeaponEffectsType(WsfStringId aWeaponEffect)
Set the string ID of the weapon effects to be used.
Definition WsfWeapon.hpp:238
virtual double GetFiringDelay()
Definition WsfWeapon.hpp:373
WeaponStatusMap::iterator WeaponStatusMapIter
Definition WsfWeapon.hpp:728
void SetFiringInterval(double aFiringInterval)
Definition WsfWeapon.hpp:392
virtual FireResult Fire(double aSimTime, const FireTarget &aTarget, const FireOptions &aSettings)
Definition WsfWeapon.cpp:828
virtual void AbortSalvo(double aSimTime, const WsfTrackId &aTrackId)
Definition WsfWeapon.cpp:975
virtual size_t GetTargetIndex(int aId) const
Definition WsfWeapon.hpp:464
virtual bool StopJamming(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:499
void SetMaximumRequestCount(unsigned int aMaximumRequestCount)
Definition WsfWeapon.hpp:629
static void DetermineFirepowerStatus(WsfPlatform &aPlatform)
Decide whether to set or clear the Firepower appearance bit.
Definition WsfWeapon.cpp:1827
static int WeaponsActiveFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of weapons that have been fired at the track and are still alive.
Definition WsfWeapon.cpp:1672
virtual void WeaponFireAborted(double aSimTime, const WsfTrack *aTargetTrackPtr, double aQuantity)
Definition WsfWeapon.cpp:1578
virtual void GetTargetedLocationWCS(int aId, double aTargetedLocationWCS[3]) const
Definition WsfWeapon.hpp:467
void SetUpdateInterval(double aUpdateInterval) override
Definition WsfWeapon.hpp:579
void SetIFCEnabled(bool aEnabled)
Set to true is IFC is supported.
Definition WsfWeapon.hpp:598
virtual bool SelectEA_Technique(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId)
Definition WsfWeapon.hpp:524
virtual unsigned int GetMaximumRequestCount() const
Definition WsfWeapon.hpp:362
double GetTimeLastFired() const
Get the simulation time when the weapon was last fired.
Definition WsfWeapon.hpp:368
void SetFiringDelay(const WsfRandomVariable &aFiringDelay)
Definition WsfWeapon.hpp:378
static int SalvosFiredAt(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of salvo fire requests requested, and not the actual number of salvos fired.
Definition WsfWeapon.cpp:1772
WsfComponentListT< WsfWeaponComponent > ComponentList
Definition WsfWeapon.hpp:157
virtual size_t GetMaximumSpotCount(size_t aBeamNumber) const
Definition WsfWeapon.hpp:518
virtual bool StartJamming(double aSimTime, double aFrequency, double aBandwidth, size_t aBeamNumber, WsfStringId aTechniqueId, WsfTrackId aTrackId, size_t aTargetIndex)
Definition WsfWeapon.hpp:484
static double TimeWeaponLastFiredFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1597
double GetReloadThreshold() const
Returns the depleted value of inventory at which a reload is attempted.
Definition WsfWeapon.hpp:441
static int WeaponsActiveAndPendingFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Equivalent to WeaponsActiveFor() plus WeaponsPendingFor().
Definition WsfWeapon.cpp:1722
virtual void CueToTarget(double aSimTime, const WsfTrack *aTrackPtr)
Definition WsfWeapon.cpp:752
virtual bool TargetedLocationValid(int aId) const
Definition WsfWeapon.hpp:469
double GetReloadInventory() const
Definition WsfWeapon.hpp:438
virtual unsigned int GetActiveRequestCount() const
Return the number of 'FireSalvo' calls that are in process.
Definition WsfWeapon.hpp:358
static int RoundsCompleteFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Returns number of weapons that were fired at the track and are now terminated.
Definition WsfWeapon.cpp:1697
virtual bool StartJammingTrack(double aSimTime, WsfStringId aTechniqueId, const WsfTrack *aTrackPtr)
Definition WsfWeapon.hpp:494
WsfLaunchComputer * GetLaunchComputer() const
Definition WsfWeapon.hpp:227
virtual size_t GetActiveSpotCount(size_t aBeamNumber) const
Definition WsfWeapon.hpp:517
static int WeaponsPendingFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1647
bool IsQuantitySpecified() const
Definition WsfWeapon.hpp:618
std::map< WsfTrackId, WeaponStatus > WeaponStatusMap
Definition WsfWeapon.hpp:727
bool IsReloading() const
Definition WsfWeapon.hpp:429
virtual void SetTargetIndex(int aId, size_t aTargetIndex)
Definition WsfWeapon.hpp:463
static std::vector< size_t > ActiveWeaponPlatformsFor(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Definition WsfWeapon.cpp:1798
WeaponState GetState() const
Return weapon state.
Definition WsfWeapon.hpp:610
static int RoundsFiredAt(const WsfPlatform &aPlatform, const WsfTrackId &aTrackId, WsfStringId aWeaponName=WsfStringId())
Equivalent to WeaponsActiveFor() plus RoundsCompleteFor().
Definition WsfWeapon.cpp:1747
void SetIsReloading(bool aValue)
Method used for derived classes to set or clear the IsReloading Flag.
Definition WsfWeapon.hpp:623
ActiveWeapon(size_t weaponPlatIndex, unsigned int serialNum)
Definition WsfWeapon.hpp:681
size_t mPlatformIndex
Platform index of the launched weapon platform.
Definition WsfWeapon.hpp:687
unsigned int mSerialNumber
The serial number of the weapon engagement.
Definition WsfWeapon.hpp:689
unsigned int mRequestId
Definition WsfWeapon.hpp:663
SalvoOptions mSettings
Definition WsfWeapon.hpp:665
SalvoRequest(unsigned int aRequestId, const FireTarget &aTarget, const SalvoOptions &aSettings)
Definition WsfWeapon.cpp:1901
FireTarget mTarget
Definition WsfWeapon.hpp:664
double mTimeWeaponLastTerminated
The simulation time when of the most recent weapon termination event for this task.
Definition WsfWeapon.hpp:715
WeaponStatus()
Definition WsfWeapon.hpp:703
int mRoundsActive
The number of weapons that are active (in flight).
Definition WsfWeapon.hpp:723
int mRoundsPending
The number of weapons that are pending (requested but not yet in flight).
Definition WsfWeapon.hpp:721
int mTotalSalvosFired
The number of salvos that have been fired.
Definition WsfWeapon.hpp:717
int mRoundsCompleted
The total number of weapons that have been fired and terminated for this task.
Definition WsfWeapon.hpp:719
double mTimeWeaponLastFired
The simulation time when of the most recent weapon firing event for this task.
Definition WsfWeapon.hpp:713
std::list< ActiveWeapon > mActiveWeaponList
A list of active weapon platforms.
Definition WsfWeapon.hpp:725