WSF
WsfWeaponTaskManager Class Reference

#include <WsfWeaponTaskManager.hpp>

Inheritance diagram for WsfWeaponTaskManager:
Collaboration diagram for WsfWeaponTaskManager:

Public Member Functions

 WsfWeaponTaskManager ()
 WsfWeaponTaskManager (const WsfWeaponTaskManager &aSrc)
WsfWeaponTaskManageroperator= (const WsfWeaponTaskManager &)=delete
 ~WsfWeaponTaskManager () override=default
virtual void Update (double aSimTime)
virtual void TaskCompleted (double aSimTime, WsfTask &aTask)
WsfProcessorGetProcessor () const
WsfPlatformGetPlatform () const
WsfSimulationGetSimulation () const
virtual void TurnOn (double aSimTime)
virtual void TurnOff (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual bool PreInitialize (double aSimTime)
Public Member Functions inherited from WsfComponentT< WsfProcessor >
 WsfComponentT ()
WsfComponentToperator= (const WsfComponentT &) noexcept
 ~WsfComponentT () override=default
virtual void ComponentParentChanged (ParentType *aParentPtr)
ParentTypeGetComponentParent () const
void SetComponentParent (ParentType *aParentPtr)
Public Member Functions inherited from WsfComponent
virtual ~WsfComponent ()=default
virtual int GetComponentInitializationOrder () const
template<typename T>
bool QueryInterfaceT (T *&aRolePtr)
bool ComponentHasRole (int aRole)
 Returns true if the component has the specified role.
virtual void PreInput ()

Static Public Member Functions

static void RegisterComponentFactory (WsfScenario &aScenario)
 Register the component factory that handles input for this component.
static WsfWeaponTaskManagerFind (const WsfProcessor &aParent)
 Find the instance of this component attached to the specified processor.
static WsfWeaponTaskManagerFindOrCreate (WsfProcessor &aParent)

weapon log data.

These variables are used to keep record of all previously sent weapon tasks Entries only exist while a track is maintained on the target

using WeaponTaskLogEntry = std::set<std::pair<size_t, WsfStringId>>
using WeaponTaskLogMap = std::map<WsfTrackId, WeaponTaskLogEntry>

Query methods

static UtCallbackListN< void(const WsfWeapon *, bool &)> IsWeaponReadyForLaunch
 Check for weapon ready states.
double TimeWeaponLastFiredFor (const WsfTrackId &aTrackId)
 Return the simulation time of the most recent weapon firing against the specified track.
double TimeWeaponLastTerminatedFor (const WsfTrackId &aTrackId)
 Return the simulation time of the most recent weapon termination against the specified track.
int WeaponsActiveFor (const WsfTrackId &aTrackId)
int WeaponsActiveFor (const WsfTrackId &aTrackId, WsfPlatform *aPlatformPtr)
int SalvosFiredAt (const WsfTrackId &aTrackId)
int RoundsFiredAt (const WsfTrackId &aTrackId)
int RoundsFiredAt (const WsfTrackId &aTrackId, WsfPlatform *aPlatformPtr)

Internal methods.

These methods are not intended for public use.

void UplinkStart (double aSimTime, unsigned int aTaskId)
bool IsAutoUplink () const
void SetAutoUplink (bool aBool)
WsfStringId GetAutoUplinkPlatformNameId () const
void SetAutoUplinkPlatformNameId (WsfStringId aAutoUplinkPlatform)

Required interface from WsfComponent.

WsfComponentCloneComponent () const override
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override

Common interface from WsfComponent/WsfProcessorComponent.

bool Initialize (double aSimTime) override
bool ProcessInput (UtInput &aInput) override

WsfTaskManagerComponent interface.

void PlatformDeleted (WsfPlatform *aPlatformPtr) override
bool AcquireResource (double aSimTime, WsfTask &aTask, const WsfTrack &aTrack, bool &aStatusOk) override
bool ReleaseResource (double aSimTime, WsfTask &aTask) override
bool AssignTask (double aSimTime, const WsfTrack &aTrack, const WsfTask &aTask, bool aLockTrack=true) override
void PurgeReceivedTask (double aSimTime, WsfTask &aTask) override
void PurgeTransmittedTask (double aSimTime, WsfTask &aTask) override
void TaskCorrelated (double aSimTime, WsfTask &aTask) override
 Called when a task has been correlated with a local track.
void TaskCanceled (double aSimTime, WsfTask &aTask) override
void TrackDropped (double aSimTime, const WsfTrackId &aTrackId) override
bool ProcessAssociationMessage (double aSimTime, const WsfAssociationMessage &aMessage) override
bool ProcessTaskStatusMessage (double aSimTime, const WsfTaskStatusMessage &aMessage) override

Command methods.

virtual bool AbortFiring (double aSimTime, const WsfTrackId &aTrackId)

Simulation observer callbacks

virtual void WeaponFireAborted (double aSimTime, WsfWeapon *aWeaponPtr, const WsfTrack *aTargetTrackPtr, double aQuantity)
virtual void WeaponFired (double aSimTime, const WsfWeaponEngagement *aEngagementPtr, const WsfTrack *aTargetTrackPtr)
void WeaponTerminated (double aSimTime, const WsfWeaponEngagement *aEngagementPtr)

Task manager observer callbacks.

void StartingWeaponTask (double aSimTime, const WsfTask &aTask)

Additional Inherited Members

Public Types inherited from WsfComponentT< WsfProcessor >
typedef WsfProcessor ParentType
 This is needed to support the WsfComponentList template.

Detailed Description

WsfWeaponTaskManager is a class for weapon task control. This class provides weapon uplink capability for sending tracks to weapons. There are a few methods to perform uplinking:

  • weapon_uplink_path
  • auto_weapon_uplink
  • uplink tasks *note: implementation of weapon_uplink_path is completely separate from the other uplink commands.

In general it is up to the derived classes to decide what actually needs to be done to perform a task, however some intrinsic capabilities are provided:

  • Turn on an acquisition sensor.
  • Turn on and initiate a tracking sensor request.
  • Cancel a tracking sensor request and turn off the sensor.
  • Initiate a weapon release and provide for command guidance uplink.

Member Typedef Documentation

◆ WeaponTaskLogEntry

using WsfWeaponTaskManager::WeaponTaskLogEntry = std::set<std::pair<size_t, WsfStringId>>

◆ WeaponTaskLogMap

Constructor & Destructor Documentation

◆ WsfWeaponTaskManager() [1/2]

WsfWeaponTaskManager::WsfWeaponTaskManager ( )

◆ WsfWeaponTaskManager() [2/2]

WsfWeaponTaskManager::WsfWeaponTaskManager ( const WsfWeaponTaskManager & aSrc)

◆ ~WsfWeaponTaskManager()

WsfWeaponTaskManager::~WsfWeaponTaskManager ( )
overridedefault

Member Function Documentation

◆ AbortFiring()

bool WsfWeaponTaskManager::AbortFiring ( double aSimTime,
const WsfTrackId & aTrackId )
virtual

◆ AcquireResource()

◆ AssignTask()

bool WsfWeaponTaskManager::AssignTask ( double aSimTime,
const WsfTrack & aTrack,
const WsfTask & aTask,
bool aLockTrack = true )
overridevirtual

Assign a task.

Parameters
aSimTimeThe current simulation time.
aTrackThe track that represents the objective of the assignment.
aTaskThe task to be assigned.
aLockTrack'true' if the track should be locked to prevent deletion.

Reimplemented from WsfTaskManagerComponent.

References cTASK_RESOURCE_TYPE_WEAPON, WsfTaskManager::FindTask(), WsfTask::GetAssigneePlatformIndex(), WsfComponentList::GetComponent(), WsfPlatform::GetIndex(), WsfSimulation::GetPlatformByIndex(), WsfTask::GetResourceName(), WsfTask::GetResourceType(), WsfProcessorComponent::GetSimulation(), WsfTask::GetTaskType(), WsfTrack::GetTrackId(), WsfTask::GetUpdateTime(), WsfTrackId::IsNull(), and WsfTask::IsResourceTypeOf().

◆ CloneComponent()

WsfComponent * WsfWeaponTaskManager::CloneComponent ( ) const
overridevirtual

Clones a component. May return null if component does not support clone.

Implements WsfComponent.

References WsfWeaponTaskManager().

◆ Find()

◆ FindOrCreate()

WsfWeaponTaskManager * WsfWeaponTaskManager::FindOrCreate ( WsfProcessor & aParent)
static

Find the instance of this component attached to the specified processor, and create it if it doesn't exist.

References WsfComponentListT< COMPONENT_TYPE >::AddComponent(), Find(), WsfProcessor::GetComponents(), and WsfWeaponTaskManager().

◆ GetAutoUplinkPlatformNameId()

WsfStringId WsfWeaponTaskManager::GetAutoUplinkPlatformNameId ( ) const
inline

◆ GetComponentName()

WsfStringId WsfWeaponTaskManager::GetComponentName ( ) const
overridevirtual

Returns the component's name. Each component in a component list has a unique name. Names are usually defined by the user, but they may also be generated by code and prefixed with a '#' to guarantee no collisions with user-defined names.

Implements WsfComponent.

◆ GetComponentRoles()

const int * WsfWeaponTaskManager::GetComponentRoles ( ) const
overridevirtual

Returns a zero-terminated array of component roles. Note that the array should be in decreasing order of specificity and should generally the inheritance hierarchy. The first entry should be the components 'primary' role. For example a sensor would do the following:

return roles;
@ cWSF_COMPONENT_SENSOR
A 'sensor' component (WsfSensor).
Definition WsfComponentRoles.hpp:105
@ cWSF_COMPONENT_PLATFORM_PART
The component derives from WsfPlatformPart.
Definition WsfComponentRoles.hpp:98
@ cWSF_COMPONENT_ARTICULATED_PART
The component derives from WsfArticulatedPart.
Definition WsfComponentRoles.hpp:99

Implements WsfComponent.

References cWSF_COMPONENT_NULL, cWSF_COMPONENT_PROCESSOR, cWSF_COMPONENT_TASK_MANAGER_COMPONENT, and cWSF_COMPONENT_WEAPON_TASK_MANAGER.

◆ Initialize()

bool WsfWeaponTaskManager::Initialize ( double aSimTime)
overridevirtual

Perform phase 1 initialization. This is called by WsfPlatform::Initialize() during phase 1 initialization of the platform. The component should complete validation of input data that could not be done by ProcessInput, as well as any other functions to prepare for simulation use (subject to the next paragraph).

The order in which components are initialized is defined by GetComponentInitializationOrder. In general a component implementation of this method should not be dependent on the state of another component, i.e.: it should not assume that the other components Initialize() method has been called. If such a dependency exists one should use Initialize2() if possible, or specify a value GetComponentInitializationOrder to force things to initialize in a particular order.

Parameters
aSimTimeThe current simulation time.
Returns
true if successful or false if unsuccessful (bad input data, etc.)
Note
This method should NOT add any other components to the platform. This MUST be done in PreInitialize().

Reimplemented from WsfProcessorComponent.

References WsfProcessorComponent::GetPlatform(), WsfProcessorComponent::GetProcessor(), WsfProcessorComponent::GetSimulation(), WsfUplinkProcessor::GetUplinkProcessor(), WsfUplinkProcessor::HasUplinkProcessor(), ok, platformPtr, WsfObserver::StartingWeaponTask(), StartingWeaponTask(), WsfUplinkProcessor::VerifyUplinks(), WsfObserver::WeaponFireAborted(), WeaponFireAborted(), WsfObserver::WeaponFired(), WeaponFired(), WsfObserver::WeaponTerminated(), and WeaponTerminated().

◆ IsAutoUplink()

bool WsfWeaponTaskManager::IsAutoUplink ( ) const
inline

◆ operator=()

WsfWeaponTaskManager & WsfWeaponTaskManager::operator= ( const WsfWeaponTaskManager & )
delete

◆ PlatformDeleted()

◆ ProcessAssociationMessage()

bool WsfWeaponTaskManager::ProcessAssociationMessage ( double aSimTime,
const WsfAssociationMessage & aMessage )
overridevirtual

Process the sensor track request association message.

When a sensor initiates a track that is the result of StartTracking() request, it will send a WSF_TRACK_ASSOCIATION_MESSAGE prior to sending the first WSF_TRACK_MESSAGE. This information provides the track ID of the StartTracking() request and the track ID of the track that is being produced as a result of that request.

This information is used to potentially uplink track data to a launched missile.

Returns
'false' to allow other message listeners to look at the message.

Reimplemented from WsfTaskManagerComponent.

References WsfProcessorComponent::GetPlatform(), WsfUplinkProcessor::GetUplinkProcessor(), WsfUplinkProcessor::HasUplinkProcessor(), and platformPtr.

◆ ProcessInput()

bool WsfWeaponTaskManager::ProcessInput ( UtInput & aInput)
overridevirtual

Evaluate the current input command and determine if it is one processed by the component. The component should get the current command from the input stream and determine if it is one that it recognizes. If it does not recognize the command then it should leave the command in the input stream and return false. If it does recognize the command then it should process the command and return true. If invalid arguments are encountered then it should throw an exception.

Parameters
aInputThe input stream.
Returns
true if the current command was recognized (and processed), or false if the command was not recognized.
Exceptions
UtInput::ExceptionBaseif an invalid input was encountered.

Reimplemented from WsfProcessorComponent.

References WsfUplinkProcessor::AddUplinkPath(), WsfProcessorComponent::GetPlatform(), WsfUplinkProcessor::GetUplinkProcessor(), platformPtr, and WsfUplinkProcessor::SetSendInterval().

◆ ProcessTaskStatusMessage()

◆ PurgeReceivedTask()

void WsfWeaponTaskManager::PurgeReceivedTask ( double aSimTime,
WsfTask & aTask )
overridevirtual

Perform the actions necessary to purge a received task. This routine is invoked by the receiver of a task after it has completed the task.

Parameters
aSimTimeThe current simulation time.
aTaskThe task being purged.
Note
The caller is responsible for deleting the task from the received task list.

Reimplemented from WsfTaskManagerComponent.

References WsfProcessorComponent::GetPlatform(), WsfTask::GetTaskId(), WsfUplinkProcessor::GetUplinkProcessor(), WsfUplinkProcessor::HasUplinkProcessor(), platformPtr, and WsfUplinkProcessor::RemoveUplink().

◆ PurgeTransmittedTask()

void WsfWeaponTaskManager::PurgeTransmittedTask ( double aSimTime,
WsfTask & aTask )
overridevirtual

Perform the actions necessary to purge a transmitted task. This routine is invoked by the transmitter of a task after it has been notified that the receiver has completed the task (successfully, unsuccessfully or rejected) or if assignee did not accept the task in the required time interval.

Parameters
aSimTimeThe current simulation time.
aTaskThe task being purge.
Note
The caller is responsible for deleting the task from the transmitted task list.

Reimplemented from WsfTaskManagerComponent.

References WsfTask::GetTaskType(), and WsfTask::GetTrackId().

◆ QueryInterface()

void * WsfWeaponTaskManager::QueryInterface ( int aRole)
overridevirtual

Requests a component's role interface. A component can support one or more roles.

Parameters
aRoleThe role whose interface is to be returned.
Returns
A pointer to the object if it supports the indicated role, or 'null' if it does not. Usage: WsfProcessor* procPtrOrNull = (WsfProcessor*)componentPtr->QueryComponentInterface(cWSF_COMPONENT_PROCESSOR);

Implements WsfComponent.

References cWSF_COMPONENT_PROCESSOR, cWSF_COMPONENT_TASK_MANAGER_COMPONENT, and cWSF_COMPONENT_WEAPON_TASK_MANAGER.

◆ RegisterComponentFactory()

void WsfWeaponTaskManager::RegisterComponentFactory ( WsfScenario & aScenario)
static

Register the component factory that handles input for this component.

References WsfScenario::RegisterComponentFactory().

Referenced by WsfMilExtension::AddedToScenario().

◆ ReleaseResource()

◆ RoundsFiredAt() [1/2]

int WsfWeaponTaskManager::RoundsFiredAt ( const WsfTrackId & aTrackId)

Return the count of the number of rounds that have been fired at the specified track .

Parameters
aTrackIdThe local track ID of the track of interest.

References RoundsFiredAt().

Referenced by RoundsFiredAt(), WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT(), WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT(), and WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT().

◆ RoundsFiredAt() [2/2]

int WsfWeaponTaskManager::RoundsFiredAt ( const WsfTrackId & aTrackId,
WsfPlatform * aPlatformPtr )

Return the count of the number of rounds that have been fired at the specified track for a given platform.

Parameters
aTrackIdThe local track ID of the track of interest.
aPlatformPtrThe assignee platform.

References WsfPlatform::GetIndex(), WsfSimulation::GetPlatformByIndex(), WsfProcessorComponent::GetSimulation(), and WsfWeapon::RoundsFiredAt().

◆ SalvosFiredAt()

int WsfWeaponTaskManager::SalvosFiredAt ( const WsfTrackId & aTrackId)

Return the count of the number of salvos that have been fired at the specified track.

Parameters
aTrackIdThe local track ID of the track of interest.

References WsfSimulation::GetPlatformByIndex(), WsfProcessorComponent::GetSimulation(), and WsfWeapon::SalvosFiredAt().

Referenced by WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT().

◆ SetAutoUplink()

void WsfWeaponTaskManager::SetAutoUplink ( bool aBool)
inline

◆ SetAutoUplinkPlatformNameId()

void WsfWeaponTaskManager::SetAutoUplinkPlatformNameId ( WsfStringId aAutoUplinkPlatform)
inline

◆ StartingWeaponTask()

void WsfWeaponTaskManager::StartingWeaponTask ( double aSimTime,
const WsfTask & aTask )

A task manager callback to handle notification that a successful FireSalvo has been issued.

If the callback was invoked due to an assignment from this platform, increment the pending round count.

Parameters
aSimTimeThe current simulation time.
aTaskThe weapon task being started (as viewed by the assignee).

References cTASK_RESOURCE_TYPE_WEAPON, WsfTaskManager::FindTask(), WsfTask::GetAssigneePlatformIndex(), WsfTask::GetResource(), WsfTask::GetResourceName(), WsfTask::GetTaskType(), WsfTask::GetTrackId(), WsfTask::IsResourceTypeOf(), and WsfWeaponTaskResource::mCount.

Referenced by Initialize().

◆ TaskCanceled()

void WsfWeaponTaskManager::TaskCanceled ( double aSimTime,
WsfTask & aTask )
overridevirtual

◆ TaskCorrelated()

void WsfWeaponTaskManager::TaskCorrelated ( double aSimTime,
WsfTask & aTask )
overridevirtual

◆ TimeWeaponLastFiredFor()

double WsfWeaponTaskManager::TimeWeaponLastFiredFor ( const WsfTrackId & aTrackId)

Return the simulation time of the most recent weapon firing against the specified track.

References WsfSimulation::GetPlatformByIndex(), WsfProcessorComponent::GetSimulation(), simTime, and WsfWeapon::TimeWeaponLastFiredFor().

Referenced by WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT().

◆ TimeWeaponLastTerminatedFor()

double WsfWeaponTaskManager::TimeWeaponLastTerminatedFor ( const WsfTrackId & aTrackId)

Return the simulation time of the most recent weapon termination against the specified track.

References WsfSimulation::GetPlatformByIndex(), WsfProcessorComponent::GetSimulation(), simTime, and WsfWeapon::TimeWeaponLastTerminatedFor().

Referenced by WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT().

◆ TrackDropped()

void WsfWeaponTaskManager::TrackDropped ( double aSimTime,
const WsfTrackId & aTrackId )
overridevirtual

Reimplemented from WsfTaskManagerComponent.

◆ UplinkStart()

◆ WeaponFireAborted()

void WsfWeaponTaskManager::WeaponFireAborted ( double aSimTime,
WsfWeapon * aWeaponPtr,
const WsfTrack * aTargetTrackPtr,
double aQuantity )
virtual

A simulation observer callback to handle notification that a weapon firing request was aborted.

If the callback was invoked as the result of a weapon assignment from this platform, decrement the pending weapon count to account for the fact that some of the weapons were not released.

Parameters
aSimTimeThe current simulation time.
aWeaponPtrA pointer to the weapon.
aTargetTrackPtrA pointer to the target track (may be 0).
aQuantityThe quantity of the weapon for which firing was requested but not completed.

References WsfPlatform::GetIndex(), WsfObject::GetNameId(), WsfPlatformPart::GetPlatform(), WsfProcessorComponent::GetProcessor(), and WsfTrack::GetTrackId().

Referenced by Initialize().

◆ WeaponFired()

◆ WeaponsActiveFor() [1/2]

int WsfWeaponTaskManager::WeaponsActiveFor ( const WsfTrackId & aTrackId)

Return the count of the number of weapons that are active against the specified track.

Parameters
aTrackIdThe local track ID of the track of interest.

References WeaponsActiveFor().

Referenced by WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT(), WsfTaskManagerScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT(), and WeaponsActiveFor().

◆ WeaponsActiveFor() [2/2]

int WsfWeaponTaskManager::WeaponsActiveFor ( const WsfTrackId & aTrackId,
WsfPlatform * aPlatformPtr )

Return the count of the number of weapons that are active against the specified track for the given platform.

Parameters
aTrackIdThe local track ID of the track of interest.
aPlatformPtrThe assignee platform of interest.

References cTASK_RESOURCE_TYPE_WEAPON, WsfPlatform::GetIndex(), WsfSimulation::GetPlatformByIndex(), WsfProcessorComponent::GetSimulation(), WsfTrackId::IsNull(), and WsfWeapon::WeaponsActiveAndPendingFor().

◆ WeaponTerminated()

void WsfWeaponTaskManager::WeaponTerminated ( double aSimTime,
const WsfWeaponEngagement * aEngagementPtr )

A simulation observer callback to handle weapon termination events.

Parameters
aSimTimeThe current simulation time.
aEngagementPtrA pointer to the weapon engagement data.

References WsfWeaponEngagement::GetInitialTargetTrackId(), and WsfTrackId::IsNull().

Referenced by Initialize().

Member Data Documentation

◆ IsWeaponReadyForLaunch

UtCallbackListN< void(const WsfWeapon *, bool &)> WsfWeaponTaskManager::IsWeaponReadyForLaunch
static

Check for weapon ready states.

Referenced by WeaponFired().


The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved