WSF
WsfSA_Perceive Class Reference

This is the perceive module of the SA Processor. More...

#include <WsfSA_Perceive.hpp>

Inheritance diagram for WsfSA_Perceive:
Collaboration diagram for WsfSA_Perceive:

Public Types

enum  RecipientType {
  cCOMMANDER = 1 , cPEERS = 2 , cSUBORDINATES = 4 , cALLCOMMANDERS = 8 ,
  cALLSUBORDINATES = 16
}

Public Member Functions

 WsfSA_Perceive (WsfSA_Processor *aSA_ProcPtr, WsfSA_Processor::PerceiveData *aDataPtr)
WsfSA_Perceiveoperator= (const WsfSA_Perceive &)=delete
 ~WsfSA_Perceive ()
void AddExtraCognitiveLoading (double aTimeDelay)
 Add a cognitive loading time (delay).
void MarkAssetAsImportant (WsfPlatform &aAsset)
 Mark an asset as important.
void MarkAssetAsImportant (size_t aIndex)
 Mark an asset as important.
void MarkAssetTypeAsImportant (const std::string &aType)
 Mark an asset type as important.
void MarkAssetTypeAsUnimportant (const std::string &aType)
 Mark an asset type as unimportant.
void MarkAssetAsUnimportant (WsfPlatform &aAsset)
 Mark an asset as unimportant.
void MarkAssetAsUnimportant (size_t aIndex)
 Mark an asset as unimportant.
void MarkThreatAsImportant (WsfLocalTrack &aThreat)
 Mark a threat as important.
void MarkThreatAsUnimportant (WsfLocalTrack &aThreat)
 Mark a threat as unimportant.
void MarkThreatTypeAsImportant (const std::string &aType)
 Mark a threat type as important.
void MarkThreatTypeAsUnimportant (const std::string &aType)
 Mark a threat type as unimportant.
int MaxAssetLoad ()
 Return the max asset load the platform can handle.
int MaxThreatLoad ()
 Return the max threat load the platform can handle.
const WsfSA_EntityPerceptionPerceivedAsset (size_t aPlatformIndex) const
 Find an asset in the perceived asset list by platform index.
const std::vector< WsfSA_EntityPerception * > & PerceivedAssets (double aSimTime)
 Return a reference to the list of perceived assets for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedAircraftAssets (double aSimTime)
 Return a reference to the list of perceived aircraft assets for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedMissileAssets (double aSimTime)
 Return a reference to the list of missile perceived assets for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedBogies (double aSimTime)
 Return a reference to the list of perceived bogies for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedAircraftBogies (double aSimTime)
 Return a reference to the list of perceived aircraft bogies for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedMissileBogies (double aSimTime)
 Return a reference to the list of perceived missile bogies for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedBandits (double aSimTime)
 Return a reference to the list of perceived missile bandits for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedAircraftBandits (double aSimTime)
 Return a reference to the list of perceived aircraft bandits for the current platform at a given time.
const std::vector< WsfSA_EntityPerception * > & PerceivedMissileBandits (double aSimTime)
 Return a reference to the list of perceived missile bandits for the current platform at a given time.
WsfLocalTrackPerceivedThreat (WsfStringId aTargetNameId)
 Find a threat in the perceived threat list by string id.
WsfLocalTrackPerceivedThreat (const WsfTrackId &aTrackId)
 Find a threat in the perceived threat list by track id.
bool PossibleEnemy (WsfLocalTrack *aTrackPtr)
 Return true if a track is a possible enemy, false otherwise.
bool ProcessInput (UtInput &aInput)
 Process input from script.
bool ProcessMessage (double aSimTime, const WsfMessage &aMessage)
 Process a WsfMessage.
void Initialize (double aSimTime)
 Performs initialization during creation.
void SetMaxAssetLoad (int aLoad)
 Set the max asset load.
void ResetMaxAssetLoad ()
 Set the max asset load to the value provided during initialization (default is -1 where not provided).
bool AssetScore (double aSimTime, WsfSA_EntityPerception *aEntityPtr, double &aScore)
 Score an asset.
bool EntityIsInAssetGroup (const WsfSA_EntityPerception *aEntity) const
bool EntityIsInAssetGroup (size_t aEntityIndex) const
void PurgeOldAssets (double aSimTime)
WsfSA_EntityPerceptionNearestAsset (double aSimTime)
 Return the nearest asset entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestAircraftAsset (double aSimTime)
 Return the nearest aircraft asset entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestMissileAsset (double aSimTime)
 Return the nearest missile asset entity perception (WsfSA_EntityPerception).
void SetMaxThreatLoad (int aLoad)
 Set the max asset load.
void ResetMaxThreatLoad ()
 Set the max threat load to the value provided during initialization (default is -1 where not provided).
bool ThreatScore (double aSimTime, WsfLocalTrack *aThreatPtr, bool aIsMissile, double &aScore)
 Score a threat.
double DefaultThreatScore (double aSimTime, WsfSA_PerceivedItem *aThreatPtr)
 If a threat scoring function isn't provided by script, this is what's used instead.
WsfSA_EntityPerceptionNearestBogie () const
 Return the nearest bogie entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestAircraftBogie () const
 Return the nearest aircraft bogie entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestMissileBogie () const
 Return the nearest missile bogie entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestBandit () const
 Return the nearest bandit entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestAircraftBandit () const
 Return the nearest aircraft bandit entity perception (WsfSA_EntityPerception).
WsfSA_EntityPerceptionNearestMissileBandit () const
 Return the nearest missile bandit entity perception (WsfSA_EntityPerception).
std::set< WsfPlatform * > TruthAssets ()
 Return a set of assets based on mTruthPerceptionMask.
std::string SelectedWeaponName () const
 These functions provide data related to the selected weapon ------------------------------------—.
const WsfExplicitWeaponSelectedWeapon () const
 Returns a pointer to the selected weapon.
int QuantityOfSelectedWeapon () const
 Returns the available quantity of the selected weapon.
bool SetSelectedWeapon (const std::string &aWeaponName)
 Returns true if the weapon selection was successful, else false.
const std::vector< WsfExplicitWeapon * > GetWeaponList () const
 Returns the current list of weapons.
void SetMasterArm (bool aArmed)
 Sets the master arm to the specified condition.
bool GetMasterArm () const
 Returns true if the master arm is active (armed), else false.
bool MasterWarningActive () const
 Returns true if the master warning is active, else false.
bool MasterCautionActive () const
 Returns true if the master warning is active, else false.
bool WeaponBayDoorsAreOpen () const
 Returns true if the weapon bay doors are open, else false.
bool ShootCueActive () const
 Returns true if the shoot cue is active, else false.
bool ShootCueBlinking () const
 Returns true if the shoot cue is blinking, else false.
bool JammingDetected () const
 Returns true if radar jamming is detected by local radar sensors, else false.
void SetMasterWarningActive (bool aActive)
 Sets the master warning to the specified condition.
void SetMasterCautionActive (bool aActive)
 Sets the master caution to the specified condition.
void SetWeaponBayDoorsAreOpen (bool aOpen)
 Sets the weapon bay doors to the specified condition.
void SetShootCueActive (bool aActive)
 Sets the shoot cue to the specified condition.
void SetShootCueBlinking (bool aBlinking)
 Sets the shoot cue blinking to the specified condition.
void SetJammingDetected (bool aJammingDetected)
 Sets the jamming detected flag to the specified condition.
bool EngagedTargetValid () const
 These functions provide data related to the primary target being engaged.
WsfSA_Processor::SA_EngagedTarget GetEngagedTarget () const
 Returns an EngagedTarget struct for the primary engaged target.
void SetEngagedTarget (const WsfSA_Processor::SA_EngagedTarget &aEngagedTarget)
 Sets the engaged target using the specified engaged target data.
int QuantityOfChaff () const
 These functions provide data related to expendables.
int QuantityOfFlares () const
 Returns the available quantity of the flare cartridges.
int QuantityOfDecoys () const
 Returns the available quantity of the expendable decoys.
bool DispenseChaff (double aSimTime)
 Returns true if there was chaff available and dispenses a deployment of chaff.
bool DispenseFlare (double aSimTime)
 Returns true if there was a flare available and dispenses a deployment of flare(s).
bool DispenseDecoy (double aSimTime)
 Returns true if there was a decoy available and dispenses a single decoy.
bool RenameGroup (WsfSA_Group *aGroup, const std::string &aName)
 This allows a group to be renamed.
WsfSA_GroupCreateGroup (const std::list< WsfSA_EntityPerception * > &aElements, bool aProtect=false)
 Creates a new group and inserts all entities from the array argument into it.
bool DisbandGroup (WsfSA_Group *aGroup, bool aProtect=false)
 Disbands the group.
WsfSA_GroupMergeGroups (const std::list< WsfSA_Group * > &aGroups, bool aProtect=false)
 Merges the groups.
std::pair< WsfSA_Group *, WsfSA_Group * > SplitGroup (WsfSA_Group *aGroup, int aNumElements, int aCriterion, bool aProtect=false)
 Splits a group according to the splitCriteria enumeration.
bool TransferEntity (WsfSA_EntityPerception *aEntity, WsfSA_Group *aGroup, bool aProtect=false)
 Transfers the entity into the group.
bool RemoveEntityFromGroup (WsfSA_EntityPerception *aEntity, bool aProtect=false)
 Removes an entity from a group, but does not delete the entity.
bool SetFocus (WsfSA_Group *aGroup, bool aFocus, bool aProtect=false)
 Sets a group to focused or unfocused depending on whether focus is true or false, respectively.
void SetImportant (WsfSA_PerceivedItem *aItem, bool aIsImportant)
 Sets an entity as important, meaning it should be favored over other entities.
bool GetFocus (WsfSA_Group *aGroup)
 Gets whenther or not a group is focused.
bool GetImportant (WsfSA_PerceivedItem *aItem)
 Gets the importance of a PI as a boolean.

Protected Member Functions

 WsfSA_Perceive (const WsfSA_Perceive &aSrc)
WsfSA_EntityPerceptionNearestEntity (const std::vector< WsfSA_EntityPerception * > &aDataList) const
 Return the nearest bogie/bandit entity perception (WsfSA_EntityPerception) in the list.
bool Important (WsfLocalTrack *aThreatPtr)
 Return true if the threat given is important, false otherwise.
bool Important (WsfPlatform *aAssetPtr)
 Return true if the asset given is important, false otherwise.
bool Important (size_t aPlatformIndex)
 Return true if the platform given is important, false otherwise.
bool Unimportant (WsfLocalTrack *aThreatPtr)
 Return true if the threat given is unimportant, false otherwise.
bool Unimportant (WsfPlatform *aAssetPtr)
 Return true if the asset given is unimportant, false otherwise.
bool Unimportant (size_t aPlatformIndex)
 Return true if the platform given is unimportant, false otherwise.
void LocalTrackDropped (double aSimTime, const WsfLocalTrack *aLocalTrackPtr)
 Handle a track dropping.
double TryUpdateStatus (double aSimTime)
 Attempt to update status at a sim time, and return an appropriate time for the next event update.
double TryUpdateAssets (double aSimTime)
 Attempt to update assets at a sim time, and return an appropriate time for the next event update.
double TryUpdatePerceivedItemData (double aSimTime)
 Attempt to update the data for perceived items, which include bogies and bandits as well as groups.
double TryUpdatePerceivedItemCalculation (double aSimTime)
 Attempt to update the perceived items calculations, which include bogies and bandits as well as groups, at a sim time, and return an appropriate time for the next event update.
double UpdateStatus (double aSimTime)
 If this platform has external links, send a status message to those links.
void UpdateAssets (double aSimTime)
 Update assets.
void UpdateAssetsData (double aSimTime)
 Update assets.
void UpdateGroupsData (double aSimTime)
 Update group data at a sim time, and return an appropriate time for the next event update.
void UpdatePerceivedItemsCalculation (double aSimTime)
 Update the perceived items calculations, which include bogies and bandits as well as groups.
void RemoveAnyInvalidEntitiesInBogiesAndBandits ()
 Remove any invalid (perceived index not valid) in the bogies and bandits lists.
void Prune (double aSimTime)
 Unfocus or remove groups in order to stay under the PI limit.
void FindExpenableCountermeasures ()
 This will attempt to find expendable countermeasures for chaff, flare, and decoys.
void FindWeapons ()
 This will attempt to find weapons, excluding countermeasure "weapons".
void CreateAssetsList (double aSimTime, std::list< WsfSA_EntityPerception * > &aTempAssetsList, bool aUnlimitedAssets)
 This creates the mPerceivedAssets list, using the specified temporary asset list and flag.
void CreateBanditsList (double aSimTime, std::list< WsfSA_EntityPerception * > &aTrackedEntitiesList, bool aUnlimitedBandits)
 This creates the mPerceivedBandits list, using the specified temporary tracked entities list and flag.
void CreateBogiesList (double aSimTime, std::list< WsfSA_EntityPerception * > &aTrackedEntitiesList, bool aUnlimitedBogies)
 This creates the mPerceivedBogies list, using the specified temporary tracked entities list and flag.
double GetThreatScore (double aSimTime, WsfSA_EntityPerception *aThreatPtr, bool aIsMissile)
 Score a threat.
void CreateAssetSublists ()
 This creates sublists for aircraft and missiles for assets.
void CreateSublists ()
 This creates sublists for aircraft and missiles for bogies and bandits.
void RemoveExpiredCoastingPerceptions (std::vector< WsfSA_EntityPerception * > &aPerceptionList, double aCoastTime, double aSimTime)
 This function removes any Wsf_EntityPerceptions from the given list that have outlived the given coast time.
void SetOldPerceptionsAsCoasting (const std::vector< WsfSA_EntityPerception * > &aPerceptionList, double aSimTime)
void UpdateCoastingPerceptions (const std::vector< WsfSA_EntityPerception * > &aPerceptionList, const std::list< WsfSA_EntityPerception * > &aNewPerceptionList, double aSimTime)
 This function sets any currently perceived entities to coasting if they aren't present in the new data.
void AddOrUpdatePerception (std::vector< WsfSA_EntityPerception * > &aPerceptionList, WsfSA_EntityPerception &aPerception, double aSimTime)
 Either adds an entity perception to the given vector or updates a matching perception in the list.
void JoinInitialGroups (std::vector< WsfSA_EntityPerception * > &aPerceptionList, std::list< WsfSA_Group * > &aGroupList, double aSimTime)
 All entities in aPerceptionList that do not have a parent group will either join an existing one, or form a degenerate group.
void DropEntity (WsfSA_EntityPerception *aOldEntity)
 Helper function for Prune() which drops an entity from current perception.
void DeleteLater (WsfSA_EntityPerception *aOldEntity)
 Prepare an entity for later deletion.
void DeferredDelete ()
 Deletes all entities that have been passed to DeleteLater().

Friends

class WsfSA_Processor
class WsfSA_ProcessorUpdateEvent

Detailed Description

This is the perceive module of the SA Processor.

Member Enumeration Documentation

◆ RecipientType

Enumerator
cCOMMANDER 
cPEERS 
cSUBORDINATES 
cALLCOMMANDERS 
cALLSUBORDINATES 

Constructor & Destructor Documentation

◆ WsfSA_Perceive() [1/2]

WsfSA_Perceive::WsfSA_Perceive ( WsfSA_Processor * aSA_ProcPtr,
WsfSA_Processor::PerceiveData * aDataPtr )

◆ ~WsfSA_Perceive()

WsfSA_Perceive::~WsfSA_Perceive ( )

References DeferredDelete().

◆ WsfSA_Perceive() [2/2]

WsfSA_Perceive::WsfSA_Perceive ( const WsfSA_Perceive & aSrc)
protected

Member Function Documentation

◆ AddExtraCognitiveLoading()

void WsfSA_Perceive::AddExtraCognitiveLoading ( double aTimeDelay)

Add a cognitive loading time (delay).

Parameters
aTimeDelaytime to delay

References WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ AddOrUpdatePerception()

void WsfSA_Perceive::AddOrUpdatePerception ( std::vector< WsfSA_EntityPerception * > & aPerceptionList,
WsfSA_EntityPerception & aPerception,
double aSimTime )
protected

Either adds an entity perception to the given vector or updates a matching perception in the list.

Parameters
aPerceptionListA vector containing entity perceptions.
aPerceptionThe entity perception to add (or the perception containing data to update an existing perception with).
aSimTimeThe current simulation time.

References WsfSA_EntityPerception::IsSame(), and WsfSA_EntityPerception::SetLastUpdateTime().

Referenced by CreateAssetsList(), CreateBanditsList(), and CreateBogiesList().

◆ AssetScore()

bool WsfSA_Perceive::AssetScore ( double aSimTime,
WsfSA_EntityPerception * aEntityPtr,
double & aScore )

Score an asset.

Return true if scored, false otherwise

Parameters
aSimTimetime at which to calc score
aEntityPtrasset to score
aScorereference variable to hold the score

References WsfScriptContext::ExecuteScript(), WsfObject::GetName(), WsfSA_Module::GetPlatform(), WsfSA_Module::GetScriptContext(), and WsfSA_Module::mDataPtr.

Referenced by CreateAssetsList().

◆ CreateAssetsList()

void WsfSA_Perceive::CreateAssetsList ( double aSimTime,
std::list< WsfSA_EntityPerception * > & aTempAssetsList,
bool aUnlimitedAssets )
protected

◆ CreateAssetSublists()

void WsfSA_Perceive::CreateAssetSublists ( )
protected

This creates sublists for aircraft and missiles for assets.

References WsfSA_Module::mDataPtr.

Referenced by UpdateAssetsData().

◆ CreateBanditsList()

void WsfSA_Perceive::CreateBanditsList ( double aSimTime,
std::list< WsfSA_EntityPerception * > & aTrackedEntitiesList,
bool aUnlimitedBandits )
protected

This creates the mPerceivedBandits list, using the specified temporary tracked entities list and flag.

Note: CreateBanditsList should be called before calling CreateBogiesList.

Parameters
aSimTimetime when created
aTrackedEntitiesListlist of tracked entities to evaluate
aUnlimitedBanditstrue if there is no limit to the number of assets in mPerceivedThreats

References AddOrUpdatePerception(), WsfSA_PerceivedItem::BANDIT, WsfTrack::cIFF_FOE, WsfTrack::cIFF_FRIEND, WsfTrack::cIFF_NEUTRAL, WsfSA_PerceivedItem::CompareScoreHighGood(), WsfSA_PerceivedItem::FRIENDLY, WsfSA_EntityPerception::GetEntityPlatformIndex(), WsfSA_EntityPerception::GetIdAuxFoe(), WsfSA_EntityPerception::GetIdAuxFriend(), WsfSA_EntityPerception::GetIdAuxNeutral(), WsfSA_EntityPerception::GetIdIffFoe(), WsfSA_EntityPerception::GetIdIffFriend(), WsfSA_EntityPerception::GetIdIffNeutral(), WsfSA_EntityPerception::GetIdSideFoe(), WsfSA_EntityPerception::GetIdSideFriend(), WsfSA_EntityPerception::GetIdSideNeutral(), WsfSA_EntityPerception::GetIdTypeFoe(), WsfSA_EntityPerception::GetIdTypeFriend(), WsfSA_EntityPerception::GetIdTypeNeutral(), WsfTrack::GetIFF_Status(), WsfSA_EntityPerception::GetIsMissile(), WsfSimulation::GetPlatformByIndex(), WsfSA_Module::GetSAP(), WsfSA_PerceivedItem::GetSelectionScore(), WsfPlatform::GetSide(), WsfSA_Module::GetSimulation(), WsfTrack::GetTargetIndex(), GetThreatScore(), WsfSA_EntityPerception::GetTrackPtr(), WsfTrack::IFF_StatusValid(), WsfSA_PerceivedItem::IGNORED, WsfSA_PerceivedItem::IMPORTANT, Important(), WsfSA_Module::mDataPtr, WsfSA_PerceivedItem::NEUTRAL, WsfSA_EntityPerception::SetIdentification(), WsfSA_EntityPerception::SetIdIffFoe(), WsfSA_EntityPerception::SetIdIffFriend(), WsfSA_EntityPerception::SetIdIffNeutral(), WsfSA_EntityPerception::SetIdSideFoe(), WsfSA_EntityPerception::SetIdSideFriend(), WsfSA_EntityPerception::SetIdSideNeutral(), WsfSA_EntityPerception::SetIdTypeFoe(), WsfSA_EntityPerception::SetIdTypeFriend(), WsfSA_EntityPerception::SetIdTypeNeutral(), WsfSA_EntityPerception::SetImportance(), WsfSA_EntityPerception::SetIsMissile(), SetOldPerceptionsAsCoasting(), WsfSA_PerceivedItem::SetSelectionScore(), and Unimportant().

Referenced by UpdatePerceivedItemsCalculation().

◆ CreateBogiesList()

void WsfSA_Perceive::CreateBogiesList ( double aSimTime,
std::list< WsfSA_EntityPerception * > & aTrackedEntitiesList,
bool aUnlimitedBogies )
protected

This creates the mPerceivedBogies list, using the specified temporary tracked entities list and flag.

Note: CreateBogiesList should be called after calling CreateThreatsList.

Parameters
aSimTimetime when created
aTrackedEntitiesListlist of tracked entities to evaluate
aUnlimitedBogiestrue if there is no limit to the number of assets in mPerceivedBogies

References AddOrUpdatePerception(), WsfSA_PerceivedItem::CompareScoreHighGood(), EntityIsInAssetGroup(), WsfSA_EntityPerception::GetIsMissile(), WsfSA_EntityPerception::GetPerceivedIndex(), WsfSA_Module::GetPlatform(), WsfSA_PerceivedItem::GetSelectionScore(), GetThreatScore(), WsfSA_EntityPerception::GetTrackPtr(), Important(), WsfSA_Module::mDataPtr, SetOldPerceptionsAsCoasting(), WsfSA_PerceivedItem::SetSelectionScore(), and Unimportant().

Referenced by UpdatePerceivedItemsCalculation().

◆ CreateGroup()

WsfSA_Group * WsfSA_Perceive::CreateGroup ( const std::list< WsfSA_EntityPerception * > & aElements,
bool aProtect = false )

Creates a new group and inserts all entities from the array argument into it.

As an exception to the general approach, if an entity in the array is already in another group, it will be removed from that group, but that group will not be marked as protected.

Parameters
aElementsThe list of entities that should be contained within this new group.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if an entity being removed from an unfocused group causes the PI limit to be exceeded, true otherwise.

References WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_GroupUtils::CreateGroup(), WsfSA_Module::GetPlatform(), and WsfSA_Module::mDataPtr.

◆ CreateSublists()

void WsfSA_Perceive::CreateSublists ( )
protected

This creates sublists for aircraft and missiles for bogies and bandits.

References WsfSA_Module::mDataPtr.

Referenced by UpdatePerceivedItemsCalculation().

◆ DefaultThreatScore()

double WsfSA_Perceive::DefaultThreatScore ( double aSimTime,
WsfSA_PerceivedItem * aThreatPtr )

If a threat scoring function isn't provided by script, this is what's used instead.

Parameters
aSimTimetime when calculated
aThreatPtrthreat to score

References WsfSA_PerceivedItem::CalcRangeForPlatform(), and WsfSA_Module::GetPlatform().

Referenced by GetThreatScore(), and Prune().

◆ DeferredDelete()

void WsfSA_Perceive::DeferredDelete ( )
protected

Deletes all entities that have been passed to DeleteLater().

Referenced by UpdatePerceivedItemsCalculation(), and ~WsfSA_Perceive().

◆ DeleteLater()

void WsfSA_Perceive::DeleteLater ( WsfSA_EntityPerception * aOldEntity)
protected

Prepare an entity for later deletion.

This is used to allow a pointer to remain valid after an entity is no longer needed until all other references to it are gone.

Parameters
aOldEntityThe entity to be deleted.

Referenced by DropEntity(), RemoveAnyInvalidEntitiesInBogiesAndBandits(), and RemoveExpiredCoastingPerceptions().

◆ DisbandGroup()

bool WsfSA_Perceive::DisbandGroup ( WsfSA_Group * aGroup,
bool aProtect = false )

Disbands the group.

This does not delete the entities within that group. The group is deleted, so it should be considered invalid after successfully calling the function.

Parameters
aGroupThe group to disband.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if disbanding an unfocused group causes the PI limit to be exceeded, true otherwise.

References WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_GroupUtils::DisbandGroup(), and WsfSA_Module::mDataPtr.

◆ DispenseChaff()

bool WsfSA_Perceive::DispenseChaff ( double aSimTime)

Returns true if there was chaff available and dispenses a deployment of chaff.

References WsfSA_Module::mDataPtr, and QuantityOfChaff().

◆ DispenseDecoy()

bool WsfSA_Perceive::DispenseDecoy ( double aSimTime)

Returns true if there was a decoy available and dispenses a single decoy.

References WsfSA_Module::mDataPtr.

◆ DispenseFlare()

bool WsfSA_Perceive::DispenseFlare ( double aSimTime)

Returns true if there was a flare available and dispenses a deployment of flare(s).

References WsfSA_Module::mDataPtr.

◆ DropEntity()

void WsfSA_Perceive::DropEntity ( WsfSA_EntityPerception * aOldEntity)
protected

Helper function for Prune() which drops an entity from current perception.

In addition to deleting the entity, it removes it from all relevant entity lists.

Parameters
aOldEntityThe entity to be dropped.

References WsfSA_PerceivedItem::BANDIT, WsfSA_PerceivedItem::BOGIE, DeleteLater(), WsfSA_PerceivedItem::FRIENDLY, WsfSA_EntityPerception::GetIdentification(), WsfSA_EntityPerception::IsSame(), and WsfSA_Module::mDataPtr.

Referenced by Prune().

◆ EngagedTargetValid()

bool WsfSA_Perceive::EngagedTargetValid ( ) const
inline

These functions provide data related to the primary target being engaged.

Returns true if there is an engaged target

References WsfSA_Module::mDataPtr.

◆ EntityIsInAssetGroup() [1/2]

bool WsfSA_Perceive::EntityIsInAssetGroup ( const WsfSA_EntityPerception * aEntity) const

◆ EntityIsInAssetGroup() [2/2]

bool WsfSA_Perceive::EntityIsInAssetGroup ( size_t aEntityIndex) const

◆ FindExpenableCountermeasures()

void WsfSA_Perceive::FindExpenableCountermeasures ( )
protected

This will attempt to find expendable countermeasures for chaff, flare, and decoys.

References WsfComponentList::RoleIterator< T >::AtEnd(), WsfSA_Module::GetPlatform(), WsfObject::IsA_TypeOf(), and WsfSA_Module::mDataPtr.

Referenced by Initialize().

◆ FindWeapons()

void WsfSA_Perceive::FindWeapons ( )
protected

This will attempt to find weapons, excluding countermeasure "weapons".

References WsfComponentList::RoleIterator< T >::AtEnd(), WsfSA_Module::GetPlatform(), WsfObject::IsA_TypeOf(), and WsfSA_Module::mDataPtr.

Referenced by Initialize().

◆ GetEngagedTarget()

WsfSA_Processor::SA_EngagedTarget WsfSA_Perceive::GetEngagedTarget ( ) const
inline

Returns an EngagedTarget struct for the primary engaged target.

References WsfSA_Module::mDataPtr.

◆ GetFocus()

bool WsfSA_Perceive::GetFocus ( WsfSA_Group * aGroup)

Gets whenther or not a group is focused.

Parameters
aGroupThe group to query.
Returns
The group's focus state.

References WsfSA_Group::GetFocus().

◆ GetImportant()

bool WsfSA_Perceive::GetImportant ( WsfSA_PerceivedItem * aItem)

Gets the importance of a PI as a boolean.

Parameters
aItemThe PI to query.
Returns
True if the PI is set to WsfSA_PerceivedItem::IMPORTANT, false otherwize.

References WsfSA_PerceivedItem::GetImportance(), and WsfSA_PerceivedItem::IMPORTANT.

◆ GetMasterArm()

bool WsfSA_Perceive::GetMasterArm ( ) const

Returns true if the master arm is active (armed), else false.

References WsfSA_Module::mDataPtr.

◆ GetThreatScore()

double WsfSA_Perceive::GetThreatScore ( double aSimTime,
WsfSA_EntityPerception * aThreatPtr,
bool aIsMissile )
protected

Score a threat.

Return the score. Prefer a user-defined scoring method, but failing that, use the default.

Parameters
aSimTimetime when calculated
aThreatPtrthreat to score
aIsMissileindicates if track is perceived as a missile

References DefaultThreatScore(), WsfSA_EntityPerception::GetTrackPtr(), and ThreatScore().

Referenced by CreateBanditsList(), and CreateBogiesList().

◆ GetWeaponList()

const std::vector< WsfExplicitWeapon * > WsfSA_Perceive::GetWeaponList ( ) const
inline

Returns the current list of weapons.

References WsfSA_Module::mDataPtr.

◆ Important() [1/3]

bool WsfSA_Perceive::Important ( size_t aPlatformIndex)
protected

Return true if the platform given is important, false otherwise.

Parameters
aPlatformIndexindex of platform to evaluate

References WsfSA_Module::GetSimulation(), and Important().

◆ Important() [2/3]

bool WsfSA_Perceive::Important ( WsfLocalTrack * aThreatPtr)
protected

Return true if the threat given is important, false otherwise.

Parameters
aThreatPtrthreat to evaluate

References WsfTrack::GetTargetIndex(), WsfTrack::GetTargetType(), and WsfSA_Module::mDataPtr.

Referenced by CreateAssetsList(), CreateBanditsList(), CreateBogiesList(), Important(), and Prune().

◆ Important() [3/3]

bool WsfSA_Perceive::Important ( WsfPlatform * aAssetPtr)
protected

Return true if the asset given is important, false otherwise.

Parameters
aAssetPtrasset to evaluate

References WsfPlatform::GetIndex(), WsfObject::GetType(), and WsfSA_Module::mDataPtr.

◆ Initialize()

void WsfSA_Perceive::Initialize ( double aSimTime)

Performs initialization during creation.

This should be called from the SA Processor's Initialize() function.

Parameters
aSimTimesim time when processing

References FindExpenableCountermeasures(), WsfScriptContext::FindScript(), FindWeapons(), WsfScriptContext::GetClass(), WsfSA_Module::GetPlatform(), WsfSA_Module::GetSAP(), WsfScriptProcessor::GetScriptContext(), WsfSA_Module::mDataPtr, ok, and WsfScriptContext::ValidateScript().

◆ JammingDetected()

bool WsfSA_Perceive::JammingDetected ( ) const

Returns true if radar jamming is detected by local radar sensors, else false.

References WsfSA_Module::mDataPtr.

◆ JoinInitialGroups()

void WsfSA_Perceive::JoinInitialGroups ( std::vector< WsfSA_EntityPerception * > & aPerceptionList,
std::list< WsfSA_Group * > & aGroupList,
double aSimTime )
protected

All entities in aPerceptionList that do not have a parent group will either join an existing one, or form a degenerate group.

Parameters
aPerceptionListA vector containing entity perceptions.
aGroupListA list of possible groups that perceptions can join.
aSimTimeThe current simulation time.

Referenced by UpdatePerceivedItemsCalculation().

◆ LocalTrackDropped()

void WsfSA_Perceive::LocalTrackDropped ( double aSimTime,
const WsfLocalTrack * aLocalTrackPtr )
protected

Handle a track dropping.

Parameters
aSimTimesim time at which track dropped
aLocalTrackPtrpointer to the dropped track

References WsfTrack::GetTrackId(), and WsfSA_Module::mDataPtr.

◆ MarkAssetAsImportant() [1/2]

void WsfSA_Perceive::MarkAssetAsImportant ( size_t aIndex)

Mark an asset as important.

Parameters
aIndexindex of the platform to mark as important

References WsfSA_Module::mDataPtr.

◆ MarkAssetAsImportant() [2/2]

void WsfSA_Perceive::MarkAssetAsImportant ( WsfPlatform & aAsset)

Mark an asset as important.

Parameters
aAssetplatform to mark as important

References WsfPlatform::GetIndex(), and MarkAssetAsImportant().

Referenced by MarkAssetAsImportant(), and operator=().

◆ MarkAssetAsUnimportant() [1/2]

void WsfSA_Perceive::MarkAssetAsUnimportant ( size_t aIndex)

Mark an asset as unimportant.

Parameters
aIndexindex of the platform to mark as unimportant

References WsfSA_Module::mDataPtr.

◆ MarkAssetAsUnimportant() [2/2]

void WsfSA_Perceive::MarkAssetAsUnimportant ( WsfPlatform & aAsset)

Mark an asset as unimportant.

Parameters
aAssetplatform to mark as unimportant

References WsfPlatform::GetIndex(), and MarkAssetAsUnimportant().

Referenced by MarkAssetAsUnimportant(), and operator=().

◆ MarkAssetTypeAsImportant()

void WsfSA_Perceive::MarkAssetTypeAsImportant ( const std::string & aType)

Mark an asset type as important.

Parameters
aTypetype to mark as important

References WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MarkAssetTypeAsUnimportant()

void WsfSA_Perceive::MarkAssetTypeAsUnimportant ( const std::string & aType)

Mark an asset type as unimportant.

Parameters
aTypetype to mark as unimportant

References WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MarkThreatAsImportant()

void WsfSA_Perceive::MarkThreatAsImportant ( WsfLocalTrack & aThreat)

Mark a threat as important.

Parameters
aThreattrack to mark as important

References WsfTrack::GetTargetIndex(), and WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MarkThreatAsUnimportant()

void WsfSA_Perceive::MarkThreatAsUnimportant ( WsfLocalTrack & aThreat)

Mark a threat as unimportant.

Parameters
aThreattrack to mark as unimportant

References WsfTrack::GetTargetIndex(), and WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MarkThreatTypeAsImportant()

void WsfSA_Perceive::MarkThreatTypeAsImportant ( const std::string & aType)

Mark a threat type as important.

Parameters
aTypetype to mark as important

References WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MarkThreatTypeAsUnimportant()

void WsfSA_Perceive::MarkThreatTypeAsUnimportant ( const std::string & aType)

Mark a threat type as unimportant.

Parameters
aTypetype to mark as unimportant

References WsfSA_Module::mDataPtr.

Referenced by operator=().

◆ MasterCautionActive()

bool WsfSA_Perceive::MasterCautionActive ( ) const

Returns true if the master warning is active, else false.

References WsfSA_Module::mDataPtr.

◆ MasterWarningActive()

bool WsfSA_Perceive::MasterWarningActive ( ) const

Returns true if the master warning is active, else false.

References WsfSA_Module::mDataPtr.

◆ MaxAssetLoad()

int WsfSA_Perceive::MaxAssetLoad ( )
inline

Return the max asset load the platform can handle.

References WsfSA_Module::mDataPtr.

◆ MaxThreatLoad()

int WsfSA_Perceive::MaxThreatLoad ( )
inline

Return the max threat load the platform can handle.

References WsfSA_Module::mDataPtr.

◆ MergeGroups()

WsfSA_Group * WsfSA_Perceive::MergeGroups ( const std::list< WsfSA_Group * > & aGroups,
bool aProtect = false )

Merges the groups.

All groups are deleted, and a new group is created, so the original groups should be considered invalid after successfully calling this function.

Parameters
aGroupsA list of all of the groups which will be merged. The group pointers in this list will be invalid after this function successfuly completes.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if the groups cannot be merged due to conflicting focus, true otherwise.

References WsfSA_Module::GetPlatform(), WsfSA_Module::mDataPtr, and WsfSA_GroupUtils::MergeGroups().

◆ NearestAircraftAsset()

WsfSA_EntityPerception * WsfSA_Perceive::NearestAircraftAsset ( double aSimTime)

Return the nearest aircraft asset entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

Parameters
aSimTimetime at which to get entity

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestAircraftBandit()

WsfSA_EntityPerception * WsfSA_Perceive::NearestAircraftBandit ( ) const

Return the nearest aircraft bandit entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestAircraftBogie()

WsfSA_EntityPerception * WsfSA_Perceive::NearestAircraftBogie ( ) const

Return the nearest aircraft bogie entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestAsset()

WsfSA_EntityPerception * WsfSA_Perceive::NearestAsset ( double aSimTime)

Return the nearest asset entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

Parameters
aSimTimetime at which to get entity

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestBandit()

WsfSA_EntityPerception * WsfSA_Perceive::NearestBandit ( ) const

Return the nearest bandit entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestBogie()

WsfSA_EntityPerception * WsfSA_Perceive::NearestBogie ( ) const

Return the nearest bogie entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestEntity()

WsfSA_EntityPerception * WsfSA_Perceive::NearestEntity ( const std::vector< WsfSA_EntityPerception * > & aDataList) const
protected

Return the nearest bogie/bandit entity perception (WsfSA_EntityPerception) in the list.

If no such entity exists, return nullptr.

References WsfSA_Module::GetPlatform().

Referenced by NearestAircraftAsset(), NearestAircraftBandit(), NearestAircraftBogie(), NearestAsset(), NearestBandit(), NearestBogie(), NearestMissileAsset(), NearestMissileBandit(), and NearestMissileBogie().

◆ NearestMissileAsset()

WsfSA_EntityPerception * WsfSA_Perceive::NearestMissileAsset ( double aSimTime)

Return the nearest missile asset entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

Parameters
aSimTimetime at which to get entity

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestMissileBandit()

WsfSA_EntityPerception * WsfSA_Perceive::NearestMissileBandit ( ) const

Return the nearest missile bandit entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ NearestMissileBogie()

WsfSA_EntityPerception * WsfSA_Perceive::NearestMissileBogie ( ) const

Return the nearest missile bogie entity perception (WsfSA_EntityPerception).

If no such entity exists, return nullptr.

References WsfSA_Module::mDataPtr, and NearestEntity().

◆ operator=()

◆ PerceivedAircraftAssets()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedAircraftAssets ( double aSimTime)

Return a reference to the list of perceived aircraft assets for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived assets

References WsfSA_Processor::cASSETS_DATA, WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, and UpdateAssets().

◆ PerceivedAircraftBandits()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedAircraftBandits ( double aSimTime)

Return a reference to the list of perceived aircraft bandits for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived aircraft bandits

References WsfSA_Module::mDataPtr.

◆ PerceivedAircraftBogies()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedAircraftBogies ( double aSimTime)

Return a reference to the list of perceived aircraft bogies for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived aircraft bogies

References WsfSA_Module::mDataPtr.

◆ PerceivedAsset()

const WsfSA_EntityPerception * WsfSA_Perceive::PerceivedAsset ( size_t aPlatformIndex) const

Find an asset in the perceived asset list by platform index.

If the asset isn't found, return nullptr.

Parameters
aPlatformIndexindex of the platform asset

References WsfSA_Module::mDataPtr.

◆ PerceivedAssets()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedAssets ( double aSimTime)

Return a reference to the list of perceived assets for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived assets

References WsfSA_Processor::cASSETS_DATA, WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, and UpdateAssets().

◆ PerceivedBandits()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedBandits ( double aSimTime)

Return a reference to the list of perceived missile bandits for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived bandits

References WsfSA_Module::mDataPtr.

◆ PerceivedBogies()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedBogies ( double aSimTime)

Return a reference to the list of perceived bogies for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived bogies

References WsfSA_Module::mDataPtr.

◆ PerceivedMissileAssets()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedMissileAssets ( double aSimTime)

Return a reference to the list of missile perceived assets for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived assets

References WsfSA_Processor::cASSETS_DATA, WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, and UpdateAssets().

◆ PerceivedMissileBandits()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedMissileBandits ( double aSimTime)

Return a reference to the list of perceived missile bandits for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived missile bandits

References WsfSA_Module::mDataPtr.

◆ PerceivedMissileBogies()

const std::vector< WsfSA_EntityPerception * > & WsfSA_Perceive::PerceivedMissileBogies ( double aSimTime)

Return a reference to the list of perceived missile bogies for the current platform at a given time.

Parameters
aSimTimesim time at which to get list of perceived missile bogies

References WsfSA_Module::mDataPtr.

◆ PerceivedThreat() [1/2]

WsfLocalTrack * WsfSA_Perceive::PerceivedThreat ( const WsfTrackId & aTrackId)

Find a threat in the perceived threat list by track id.

If the threat isn't found, return nullptr.

Parameters
aTrackIdtrack id of the threat

References WsfSA_Module::mDataPtr.

◆ PerceivedThreat() [2/2]

WsfLocalTrack * WsfSA_Perceive::PerceivedThreat ( WsfStringId aTargetNameId)

Find a threat in the perceived threat list by string id.

If the threat isn't found, return nullptr.

Parameters
aTargetNameIdstring id of the threat

References WsfSA_Module::mDataPtr.

◆ PossibleEnemy()

bool WsfSA_Perceive::PossibleEnemy ( WsfLocalTrack * aTrackPtr)

Return true if a track is a possible enemy, false otherwise.

Parameters
aTrackPtrtrack to check

References WsfTrack::cIFF_FOE, WsfTrack::cIFF_FRIEND, WsfTrack::cIFF_NEUTRAL, WsfTrack::GetIFF_Status(), WsfSA_Module::GetSAP(), and WsfTrack::IFF_StatusValid().

◆ ProcessInput()

bool WsfSA_Perceive::ProcessInput ( UtInput & aInput)

◆ ProcessMessage()

◆ Prune()

void WsfSA_Perceive::Prune ( double aSimTime)
protected

◆ PurgeOldAssets()

◆ QuantityOfChaff()

int WsfSA_Perceive::QuantityOfChaff ( ) const

These functions provide data related to expendables.

Returns the available quantity of the chaff cartridges

References WsfSA_Module::mDataPtr.

Referenced by DispenseChaff().

◆ QuantityOfDecoys()

int WsfSA_Perceive::QuantityOfDecoys ( ) const

Returns the available quantity of the expendable decoys.

References WsfSA_Module::mDataPtr.

◆ QuantityOfFlares()

int WsfSA_Perceive::QuantityOfFlares ( ) const

Returns the available quantity of the flare cartridges.

References WsfSA_Module::mDataPtr.

◆ QuantityOfSelectedWeapon()

int WsfSA_Perceive::QuantityOfSelectedWeapon ( ) const

Returns the available quantity of the selected weapon.

References WsfSA_Module::mDataPtr.

◆ RemoveAnyInvalidEntitiesInBogiesAndBandits()

void WsfSA_Perceive::RemoveAnyInvalidEntitiesInBogiesAndBandits ( )
protected

Remove any invalid (perceived index not valid) in the bogies and bandits lists.

References DeleteLater(), WsfSA_EntityPerception::GetPerceivedIndex(), and WsfSA_Module::mDataPtr.

Referenced by UpdatePerceivedItemsCalculation().

◆ RemoveEntityFromGroup()

bool WsfSA_Perceive::RemoveEntityFromGroup ( WsfSA_EntityPerception * aEntity,
bool aProtect = false )

Removes an entity from a group, but does not delete the entity.

Parameters
aEntityThe entity to remove from its group.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if removing an entity from an unfocused group causes the PI limit to be exceeded, true otherwise.

References WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_Module::mDataPtr, and WsfSA_GroupUtils::RemoveEntityFromGroup().

◆ RemoveExpiredCoastingPerceptions()

void WsfSA_Perceive::RemoveExpiredCoastingPerceptions ( std::vector< WsfSA_EntityPerception * > & aPerceptionList,
double aCoastTime,
double aSimTime )
protected

This function removes any Wsf_EntityPerceptions from the given list that have outlived the given coast time.

Parameters
aPerceptionListA vector containing entity perceptions.
aCoastTimeThe time each perception is allowed to persist without any update (in sec).
aSimTimeThe current simulation time.

References DeleteLater().

Referenced by UpdateAssetsData(), and UpdatePerceivedItemsCalculation().

◆ RenameGroup()

bool WsfSA_Perceive::RenameGroup ( WsfSA_Group * aGroup,
const std::string & aName )

This allows a group to be renamed.

Parameters
aGroupThe group to rename.
aNameThe new name.
Returns
True if success.

References WsfSA_Module::mDataPtr, and WsfSA_GroupUtils::RenameGroup().

◆ ResetMaxAssetLoad()

void WsfSA_Perceive::ResetMaxAssetLoad ( )
inline

Set the max asset load to the value provided during initialization (default is -1 where not provided).

References WsfSA_Module::mDataPtr.

◆ ResetMaxThreatLoad()

void WsfSA_Perceive::ResetMaxThreatLoad ( )
inline

Set the max threat load to the value provided during initialization (default is -1 where not provided).

References WsfSA_Module::mDataPtr.

◆ SelectedWeapon()

const WsfExplicitWeapon * WsfSA_Perceive::SelectedWeapon ( ) const

Returns a pointer to the selected weapon.

References WsfSA_Module::mDataPtr.

◆ SelectedWeaponName()

std::string WsfSA_Perceive::SelectedWeaponName ( ) const

These functions provide data related to the selected weapon ------------------------------------—.

Returns the name of the selected weapon

References WsfSA_Module::mDataPtr.

◆ SetEngagedTarget()

void WsfSA_Perceive::SetEngagedTarget ( const WsfSA_Processor::SA_EngagedTarget & aEngagedTarget)
inline

Sets the engaged target using the specified engaged target data.

Parameters
aEngagedTargetengaged target data

References WsfSA_Module::mDataPtr.

◆ SetFocus()

bool WsfSA_Perceive::SetFocus ( WsfSA_Group * aGroup,
bool aFocus,
bool aProtect = false )

Sets a group to focused or unfocused depending on whether focus is true or false, respectively.

Parameters
aGroupThe group for which focus is set.
aFocusSets the group to focused if true, unfocused otherwise.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if setting an unfocused group to focused causes the PI limit to be exceeded.

References WsfSA_Processor::Assess(), WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, WsfSA_GroupUtils::SetFocus(), and WsfSA_Assess::UpdateGroupFocusLists().

◆ SetImportant()

void WsfSA_Perceive::SetImportant ( WsfSA_PerceivedItem * aItem,
bool aIsImportant )

Sets an entity as important, meaning it should be favored over other entities.

A version of this for groups would be available as well, which for focused groups, would set each entity within the group as important, and for unfocused groups, will flag the group itself as important.

Parameters
aItemThe PI for which importance is set.
aIsImportantTrue to set as important, false otherwise.

References WsfSA_PerceivedItem::IMPORTANT, WsfSA_PerceivedItem::NOMINAL, and WsfSA_PerceivedItem::SetImportance().

◆ SetJammingDetected()

void WsfSA_Perceive::SetJammingDetected ( bool aJammingDetected)

Sets the jamming detected flag to the specified condition.

Parameters
aJammingDetectedset to true if jamming is detected, false if no jamming is detected

References WsfSA_Module::mDataPtr.

◆ SetMasterArm()

void WsfSA_Perceive::SetMasterArm ( bool aArmed)

Sets the master arm to the specified condition.

Parameters
aArmedset to true to arm, false to safe

References WsfSA_Module::mDataPtr.

◆ SetMasterCautionActive()

void WsfSA_Perceive::SetMasterCautionActive ( bool aActive)

Sets the master caution to the specified condition.

Parameters
aActiveset to true if active, false if off

References WsfSA_Module::mDataPtr.

◆ SetMasterWarningActive()

void WsfSA_Perceive::SetMasterWarningActive ( bool aActive)

Sets the master warning to the specified condition.

Parameters
aActiveset to true if active, false if off

References WsfSA_Module::mDataPtr.

◆ SetMaxAssetLoad()

void WsfSA_Perceive::SetMaxAssetLoad ( int aLoad)
inline

Set the max asset load.

Parameters
aLoadnumber of assets a platform can cognitively handle (negative value means no limit)

References WsfSA_Module::mDataPtr.

◆ SetMaxThreatLoad()

void WsfSA_Perceive::SetMaxThreatLoad ( int aLoad)
inline

Set the max asset load.

Parameters
aLoadnumber of threats a platform can cognitively handle (negative value means no limit)

References WsfSA_Module::mDataPtr.

◆ SetOldPerceptionsAsCoasting()

void WsfSA_Perceive::SetOldPerceptionsAsCoasting ( const std::vector< WsfSA_EntityPerception * > & aPerceptionList,
double aSimTime )
protected

◆ SetSelectedWeapon()

bool WsfSA_Perceive::SetSelectedWeapon ( const std::string & aWeaponName)

Returns true if the weapon selection was successful, else false.

Parameters
aWeaponNamename of the desired weapon

References WsfComponentList::RoleIterator< T >::AtEnd(), WsfSA_Module::GetPlatform(), and WsfSA_Module::mDataPtr.

◆ SetShootCueActive()

void WsfSA_Perceive::SetShootCueActive ( bool aActive)

Sets the shoot cue to the specified condition.

Parameters
aActiveset to true if active, false if off

References WsfSA_Module::mDataPtr.

◆ SetShootCueBlinking()

void WsfSA_Perceive::SetShootCueBlinking ( bool aBlinking)

Sets the shoot cue blinking to the specified condition.

Parameters
aBlinkingset to true if blinking, false if not

References WsfSA_Module::mDataPtr.

◆ SetWeaponBayDoorsAreOpen()

void WsfSA_Perceive::SetWeaponBayDoorsAreOpen ( bool aOpen)

Sets the weapon bay doors to the specified condition.

Parameters
aOpenset to true if doors are open, false if doors are closed

References WsfSA_Module::mDataPtr.

◆ ShootCueActive()

bool WsfSA_Perceive::ShootCueActive ( ) const

Returns true if the shoot cue is active, else false.

References WsfSA_Module::mDataPtr.

◆ ShootCueBlinking()

bool WsfSA_Perceive::ShootCueBlinking ( ) const

Returns true if the shoot cue is blinking, else false.

References WsfSA_Module::mDataPtr.

◆ SplitGroup()

std::pair< WsfSA_Group *, WsfSA_Group * > WsfSA_Perceive::SplitGroup ( WsfSA_Group * aGroup,
int aNumElements,
int aCriterion,
bool aProtect = false )

Splits a group according to the splitCriteria enumeration.

The number of entities specified by the number argument will be added to a new group which fits splitCriteria. The remainder will be put into the other created group. The input group is deleted, so the original group should be considered invalid after successfully calling this function.

Parameters
aGroupThe group to split.
aNumElementsThe number of elements that will appear in the new group.
aCriterionAn enumeration describing how the group should be split.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
The new groups upon success, or a pair of null pointers upon failure.

References WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_Module::GetPlatform(), WsfSA_Module::mDataPtr, and WsfSA_GroupUtils::SplitGroup().

◆ ThreatScore()

bool WsfSA_Perceive::ThreatScore ( double aSimTime,
WsfLocalTrack * aThreatPtr,
bool aIsMissile,
double & aScore )

Score a threat.

Return true if scored, false otherwise.

Parameters
aSimTimetime when calculated
aThreatPtrthreat to score
aIsMissileindicates if track is perceived as a missile
aScorereference variable in which to hold the score

References WsfScriptContext::ExecuteScript(), WsfObject::GetName(), WsfSA_Module::GetPlatform(), WsfSA_Module::GetScriptContext(), and WsfSA_Module::mDataPtr.

Referenced by GetThreatScore().

◆ TransferEntity()

bool WsfSA_Perceive::TransferEntity ( WsfSA_EntityPerception * aEntity,
WsfSA_Group * aGroup,
bool aProtect = false )

Transfers the entity into the group.

As an exception to the general approach, if the entity is already in another group, it will be removed from that group, but that group will not be marked as protected.

Parameters
aEntityThe entity to transfer.
aGroupThe group into which the entity will be transferred.
aProtectIf this function was called from script, then this should be set to true in order to protect the user's changes from being overridden by automatic merges or splits. Otherwise, it should be false.
Returns
False if transferring an entity from an unfocused group to a focused one causes the PI limit to be exceeded, true otherwise.

References WsfSA_GroupUtils::CalculateNumPIs(), WsfSA_Module::mDataPtr, and WsfSA_GroupUtils::TransferEntity().

◆ TruthAssets()

◆ TryUpdateAssets()

double WsfSA_Perceive::TryUpdateAssets ( double aSimTime)
protected

Attempt to update assets at a sim time, and return an appropriate time for the next event update.

A cognitive delay is factored in.

Parameters
aSimTimesim time at which to attempt updating

References WsfObserver::AirCombatSendPerceivedAssetsData(), WsfSA_Processor::cASSETS_DATA, WsfSA_Module::GetPlatform(), WsfSA_Module::GetSAP(), WsfSA_Module::GetSimulation(), WsfSA_Module::mDataPtr, WsfSA_Processor::SetLastUpdateTime(), and UpdateAssets().

◆ TryUpdatePerceivedItemCalculation()

double WsfSA_Perceive::TryUpdatePerceivedItemCalculation ( double aSimTime)
protected

Attempt to update the perceived items calculations, which include bogies and bandits as well as groups, at a sim time, and return an appropriate time for the next event update.

A cognitive delay is factored in.

Parameters
aSimTimesim time at which to attempt updating

References WsfSA_Processor::cPERCEIVED_ITEM_CALCULATION, WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, WsfSA_Processor::SetLastUpdateTime(), UpdateGroupsData(), and UpdatePerceivedItemsCalculation().

◆ TryUpdatePerceivedItemData()

double WsfSA_Perceive::TryUpdatePerceivedItemData ( double aSimTime)
protected

Attempt to update the data for perceived items, which include bogies and bandits as well as groups.

A cognitive delay is factored in.

Parameters
aSimTimesim time at which to attempt updating

References WsfObserver::AirCombatSendPerceivedItemsData(), WsfSA_Processor::cPERCEIVED_ITEM_DATA, WsfSA_Module::GetPlatform(), WsfSA_Module::GetSAP(), WsfSA_Module::GetSimulation(), and WsfSA_Processor::SetLastUpdateTime().

◆ TryUpdateStatus()

double WsfSA_Perceive::TryUpdateStatus ( double aSimTime)
protected

Attempt to update status at a sim time, and return an appropriate time for the next event update.

Parameters
aSimTimesim time at which to send status

References WsfSA_Processor::cSTATUS, WsfSA_Module::GetSAP(), and UpdateStatus().

◆ Unimportant() [1/3]

bool WsfSA_Perceive::Unimportant ( size_t aPlatformIndex)
protected

Return true if the platform given is unimportant, false otherwise.

Parameters
aPlatformIndexindex of platform to evaluate

References WsfSA_Module::GetSimulation(), and Unimportant().

◆ Unimportant() [2/3]

bool WsfSA_Perceive::Unimportant ( WsfLocalTrack * aThreatPtr)
protected

Return true if the threat given is unimportant, false otherwise.

Parameters
aThreatPtrthreat to evaluate

References WsfTrack::GetTargetIndex(), WsfTrack::GetTargetType(), and WsfSA_Module::mDataPtr.

Referenced by CreateAssetsList(), CreateBanditsList(), CreateBogiesList(), Unimportant(), and UpdatePerceivedItemsCalculation().

◆ Unimportant() [3/3]

bool WsfSA_Perceive::Unimportant ( WsfPlatform * aAssetPtr)
protected

Return true if the asset given is unimportant, false otherwise.

Parameters
aAssetPtrasset to evaluate

References WsfPlatform::GetIndex(), WsfObject::GetType(), and WsfSA_Module::mDataPtr.

◆ UpdateAssets()

void WsfSA_Perceive::UpdateAssets ( double aSimTime)
protected

◆ UpdateAssetsData()

void WsfSA_Perceive::UpdateAssetsData ( double aSimTime)
protected

◆ UpdateCoastingPerceptions()

void WsfSA_Perceive::UpdateCoastingPerceptions ( const std::vector< WsfSA_EntityPerception * > & aPerceptionList,
const std::list< WsfSA_EntityPerception * > & aNewPerceptionList,
double aSimTime )
protected

This function sets any currently perceived entities to coasting if they aren't present in the new data.

Additionally, any perceived entities that are already coasting will have their positions manually updated based on their last known velocity and heading.

Parameters
aPerceptionListA vector containing entity perceptions to potentially coast.
aNewPerceptionListA list containing new entity perceptions to update aPerceptionList with.
aSimTimeThe current simulation time.

Referenced by UpdateAssetsData(), and UpdatePerceivedItemsCalculation().

◆ UpdateGroupsData()

void WsfSA_Perceive::UpdateGroupsData ( double aSimTime)
protected

Update group data at a sim time, and return an appropriate time for the next event update.

A cognitive delay is factored in.

Parameters
aSimTimesim time at which to attempt updating

References WsfSA_Processor::Assess(), WsfSA_Module::GetPlatform(), WsfSA_Module::GetSAP(), WsfSA_Module::mDataPtr, and WsfSA_Assess::UpdateGroupFocusLists().

Referenced by TryUpdatePerceivedItemCalculation().

◆ UpdatePerceivedItemsCalculation()

◆ UpdateStatus()

double WsfSA_Perceive::UpdateStatus ( double aSimTime)
protected

If this platform has external links, send a status message to those links.

Parameters
aSimTimesim time at which to send status

References WsfSA_Processor::cSTATUS, WsfSA_Module::GetPlatform(), WsfSA_Module::GetSAP(), WsfSA_Module::GetSimulation(), WsfSA_Processor::GetUpdateInterval(), WsfSA_Module::mDataPtr, platformPtr, WsfSA_Processor::SendMessage(), and WsfSA_EntityPerception::SetFlightId().

Referenced by TryUpdateStatus().

◆ WeaponBayDoorsAreOpen()

bool WsfSA_Perceive::WeaponBayDoorsAreOpen ( ) const

Returns true if the weapon bay doors are open, else false.

References WsfSA_Module::mDataPtr.

◆ WsfSA_Processor

friend class WsfSA_Processor
friend

References WsfSA_Processor.

Referenced by WsfSA_Perceive(), and WsfSA_Processor.

◆ WsfSA_ProcessorUpdateEvent

friend class WsfSA_ProcessorUpdateEvent
friend

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