WSF
WsfExtInterface Class Reference

The WSF Ext is code which is shared between common external interfaces like DIS and HLA. More...

#include <WsfExtInterface.hpp>

Inheritance diagram for WsfExtInterface:
Collaboration diagram for WsfExtInterface:

Public Types

enum  {
  cALL_SITES = 0xFFFF , cALL_APPLIC = 0xFFFF , cALL_ENTITIES = 0xFFFF , cNO_SITES = 0 ,
  cNO_APPLIC = 0 , cNO_ENTITY = 0 , cRQST_ASSIGN_ID = 0xFFFE
}
Public Types inherited from WsfExtData
using Component = WsfExtInterfaceComponent
using ComponentList = WsfComponentListT<WsfExtInterfaceComponent>

Public Member Functions

 WsfExtInterface (WsfExtInput &aInput)
 ~WsfExtInterface () override
void SimulationComplete (double aSimTime)
bool PrepareExtension () override
WsfStringId SelectPlatformType (const WsfExtEntityType &aEntityType)
 Given an entity type, select the object type to be used.
WsfPlatformCreateExternalPlatform (const std::string &aPlatformType)
WsfStringId GetDefaultPlatformTypeId ()
 Return the type ID of the default platform.
WsfStringId GetUnknownPlatformTypeId ()
 Return the type ID of the platform mapped to unknown types.
void SelectEntityId (WsfPlatform *aPlatformPtr, uint16_t &aEntityId)
void FreeEntityId (uint16_t aEntityId)
 Release an entity ID to be used by another entity.
bool IsPrivate (const WsfPlatform *aPlatformPtr) const
 Returns 'true' if aPlatform is a private platform which should not be transmitted to another simulation.
std::set< WsfStringId > & GetPrivateNameId ()
std::set< WsfStringId > & GetPrivateTypeId ()
WsfCategoryListGetPrivateCategoryId ()
void AddPrivateType (WsfStringId aTypeId)
unsigned short GetSiteId ()
unsigned short GetApplicationId ()
std::map< WsfStringId, WsfExtEntityType > & GetObjectToEntityTypeMap ()
std::map< WsfExtEntityType, WsfStringId > & GetEntityTypeToObjectMap ()
bool IsEntityExternallyMoved (const WsfExtEntityId &aEntityId, const WsfExtEntityType &aEntityType)
uint16_t GetNewEventId ()
ut::Random & GetRandom ()
 Get the local random number generator.
double GetDeferredConnectionTime () const
 Return the time from the start of the simulation run that external interfaces will open connections.
double GetDeferredPDUSendTime () const
 Return the time from the start of the simulation run that DIS PDUs can be sent across external interfaces.
WsfExtEntityDeadReckonGetEntityDeadReckon () const
uint16_t AssignNewEntity ()
std::bitset< 65536U > * PreassignedEntityIds ()
std::bitset< 65536U > * ActiveEntityIds ()
std::map< WsfStringId, uint16_t > * PlatformNameToEntityId ()
Public Member Functions inherited from WsfSimulationExtension
 WsfSimulationExtension ()
 ~WsfSimulationExtension () override=default
WsfSimulationGetSimulation () const
const WsfScenarioGetScenario () const
virtual void AddedToSimulation ()
virtual bool Initialize ()
virtual bool PlatformsInitialized ()
virtual void PendingStart ()
virtual void Start ()
virtual void Complete (double aSimTime)
Public Member Functions inherited from WsfExtension
virtual ~WsfExtension ()=default
const std::string & GetExtensionName () const
Public Member Functions inherited from WsfExtData
 WsfExtData (WsfScenario &aScenario)
virtual ~WsfExtData ()
void AddComponent (Component *aComponentPtr)
const ComponentListGetComponents () const
virtual bool ProcessInput (WsfScenario &aScenario, UtInput &aInput)
WsfExtEmissionGetEmission () const
bool ProcessDeadReckonInput (UtInput &aInput)
void ProcessEntityType (UtInput &aInput)
void ProcessRadioEntityType (UtInput &aInput)
void ProcessExternalEntity (UtInput &aInput)
void ProcessExternalType (UtInput &aInput)
bool ProcessEntityId (std::string aName, int aEntityId)
void ProcessEntityId (UtInput &aInput)
void WriteEntityTypes (WsfScenario &aScenario, std::ostream &aStream)
 Prints entity type mapping for each platform type.
void WriteEmitterTypes (WsfScenario &aScenario, std::ostream &aStream)
 Prints entity type mapping for each platform type.
bool GetEntityType (WsfStringId aObjectTypeId, WsfExtEntityType &aEntityType) const
bool GetRadioEntityType (WsfStringId aCommTypeId, WsfExtRadioEntityType &aEntityType) const
bool GetEntityType (const WsfObject *aObjectPtr, WsfExtEntityType &aEntityType) const
 Given an object, select a entity type.
int GetForceId (WsfStringId aSideId) const
 Return the force ID that corresponds to a given WSF side ID.
WsfStringId GetSideId (int aForceId) const
 Return the WSF side ID that corresponds to the given force ID.
void SelectEntityType (WsfPlatform *aPlatformPtr, WsfExtEntityType &aEntityType) const
 Given a platform, select an entity type.
WsfStringId GetStringId (const WsfExtEntityType &aEntityType) const
WsfStringId GetStringId (const WsfExtRadioEntityType &aEntityType) const
bool GetRadioEntityType (const wsf::comm::Comm *aCommPtr, WsfExtRadioEntityType &aEntityType) const
 Given an object, select a entity type.
bool CompleteLoad (WsfScenario &aScenario)

Static Public Member Functions

static WsfExtInterfaceFind (const WsfSimulation &aSimulation)
static void StripExternalPlatform (WsfPlatform *aPlatformPtr)
static void __private_SetSim (WsfSimulationExtension &aExtension, WsfSimulation *aSimPtr)
Static Public Member Functions inherited from WsfExtData
static void ReadEntityType (UtInput &aInput, WsfExtEntityType &aEntityType)
static void ReadEntityId (UtInput &aInput, WsfExtEntityId &aEntityId)
static void ReadRadioEntityType (UtInput &aInput, WsfExtRadioEntityType &aEntityType)
static void ConvertInputToEntityId (std::string &aInput, WsfExtEntityId &aEntityId)
static void ConvertInputToEntityType (std::string &aInput, WsfExtEntityType &aEntityType)
static void ConvertInputToRadioEntityType (std::string &aInput, WsfExtRadioEntityType &aEntityType)

Public Attributes

UtCallbackListN< void(double)> ConnectionComplete
Public Attributes inherited from WsfExtData
bool mAllPrivate
std::set< WsfStringIdmPrivateTypeId
std::set< WsfStringIdmPrivateNameId
WsfCategoryList mPrivateCategoryId
uint16_t mStartEntity
unsigned short mSiteId
unsigned short mApplicationId
double mDeferredConnectionTime
double mDeferredPDUSendTime
 Deferred time before any DIS PDUs can be sent.
bool mDebugDetonationEnabled
std::map< WsfStringId, double > mTargetPriority
WsfStringId mUnknownPlatformTypeId
std::map< WsfStringId, int > mSideIdToForceId
std::map< WsfStringId, WsfExtEntityTypemObjectTypeToEntityType
std::map< WsfExtEntityType, WsfStringIdmEntityTypeToObjectType
std::map< WsfStringId, WsfExtRadioEntityTypemCommTypeToRadioEntityType
std::map< WsfExtRadioEntityType, WsfStringIdmRadioEntityTypeToCommType
WsfExtEntityDeadReckonSetup mDR_Setup
std::bitset< 65536U > mPreassignedEntityIds
std::map< WsfStringId, uint16_t > mPlatformNameToEntityId
std::set< WsfExtEntityIdmExternalEntityIds
std::set< WsfExtEntityTypemExternalEntityTypes
WsfExtEmissionmEmissionPtr

Additional Inherited Members

Protected Member Functions inherited from WsfExtension
void InitializeExtensionName (const std::string &aName)
Protected Attributes inherited from WsfExtData
ComponentList mComponents

Detailed Description

The WSF Ext is code which is shared between common external interfaces like DIS and HLA.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
cALL_SITES 
cALL_APPLIC 
cALL_ENTITIES 
cNO_SITES 
cNO_APPLIC 
cNO_ENTITY 
cRQST_ASSIGN_ID 

Constructor & Destructor Documentation

◆ WsfExtInterface()

◆ ~WsfExtInterface()

WsfExtInterface::~WsfExtInterface ( )
override

Member Function Documentation

◆ ActiveEntityIds()

std::bitset< 65536U > * WsfExtInterface::ActiveEntityIds ( )
inline

◆ AddPrivateType()

void WsfExtInterface::AddPrivateType ( WsfStringId aTypeId)

◆ AssignNewEntity()

uint16_t WsfExtInterface::AssignNewEntity ( )

References cALL_ENTITIES, cNO_ENTITY, and cRQST_ASSIGN_ID.

Referenced by SelectEntityId().

◆ CreateExternalPlatform()

WsfPlatform * WsfExtInterface::CreateExternalPlatform ( const std::string & aPlatformType)

◆ Find()

◆ FreeEntityId()

void WsfExtInterface::FreeEntityId ( uint16_t aEntityId)

Release an entity ID to be used by another entity.

◆ GetApplicationId()

unsigned short WsfExtInterface::GetApplicationId ( )
inline

◆ GetDefaultPlatformTypeId()

WsfStringId WsfExtInterface::GetDefaultPlatformTypeId ( )
inline

Return the type ID of the default platform.

◆ GetDeferredConnectionTime()

double WsfExtInterface::GetDeferredConnectionTime ( ) const
inline

Return the time from the start of the simulation run that external interfaces will open connections.

References WsfExtData::mDeferredConnectionTime.

Referenced by WsfStandardApplication::UpdateOptionsP(), and WsfDisPlatform::WsfDisPlatform().

◆ GetDeferredPDUSendTime()

double WsfExtInterface::GetDeferredPDUSendTime ( ) const
inline

Return the time from the start of the simulation run that DIS PDUs can be sent across external interfaces.

References WsfExtData::mDeferredPDUSendTime.

◆ GetEntityDeadReckon()

◆ GetEntityTypeToObjectMap()

std::map< WsfExtEntityType, WsfStringId > & WsfExtInterface::GetEntityTypeToObjectMap ( )
inline

◆ GetNewEventId()

uint16_t WsfExtInterface::GetNewEventId ( )

◆ GetObjectToEntityTypeMap()

std::map< WsfStringId, WsfExtEntityType > & WsfExtInterface::GetObjectToEntityTypeMap ( )
inline

◆ GetPrivateCategoryId()

WsfCategoryList & WsfExtInterface::GetPrivateCategoryId ( )
inline

◆ GetPrivateNameId()

std::set< WsfStringId > & WsfExtInterface::GetPrivateNameId ( )
inline

◆ GetPrivateTypeId()

std::set< WsfStringId > & WsfExtInterface::GetPrivateTypeId ( )
inline

◆ GetRandom()

ut::Random & WsfExtInterface::GetRandom ( )
inline

Get the local random number generator.

Referenced by PrepareExtension().

◆ GetSiteId()

unsigned short WsfExtInterface::GetSiteId ( )
inline

References WsfExtData::mSiteId.

◆ GetUnknownPlatformTypeId()

WsfStringId WsfExtInterface::GetUnknownPlatformTypeId ( )
inline

Return the type ID of the platform mapped to unknown types.

References WsfExtData::mUnknownPlatformTypeId.

◆ IsEntityExternallyMoved()

bool WsfExtInterface::IsEntityExternallyMoved ( const WsfExtEntityId & aEntityId,
const WsfExtEntityType & aEntityType )

◆ IsPrivate()

bool WsfExtInterface::IsPrivate ( const WsfPlatform * aPlatformPtr) const

Returns 'true' if aPlatform is a private platform which should not be transmitted to another simulation.

References WsfPlatform::GetCategories(), WsfObject::GetNameId(), WsfObject::GetTypeId(), WsfExtData::mAllPrivate, WsfExtData::mPrivateCategoryId, WsfExtData::mPrivateNameId, and WsfExtData::mPrivateTypeId.

◆ PlatformNameToEntityId()

std::map< WsfStringId, uint16_t > * WsfExtInterface::PlatformNameToEntityId ( )
inline

◆ PreassignedEntityIds()

std::bitset< 65536U > * WsfExtInterface::PreassignedEntityIds ( )
inline

◆ PrepareExtension()

bool WsfExtInterface::PrepareExtension ( )
overridevirtual

Called in response to a call to WsfSimulation::Initialize and WsfSimulation::PrepareSimulation.

A simulation extension will typically implement either WsfSimulationExtension::Initialize or WsfSimulationExtension::PrepareExtension, or a combination of both. The main difference is that:

  • WsfSimulationExtension::Initialize is called only when a simulation is initialized after being loaded from input files (the normal mode of operation).
  • WsfSimulation::PrepareExecution is called in the former case AND when a simulation is reloaded from a snapshot.

The primary criteria for deciding which method to use is to look at the extension and see if it uses any external resources such as files or sockets. If the extension uses external resources and wants to support snapshotting then it MUST use this this method so it can (re)establish connections to external resources (A snapshot cannot save the state of an open file or socket and so it must be reopened.)

Reimplemented from WsfSimulationExtension.

References WsfSimulation::AddEvent(), ConnectionComplete, GetRandom(), WsfSimulationExtension::GetSimulation(), WsfExtData::mDeferredConnectionTime, WsfExtData::mSideIdToForceId, and WsfExtData::mStartEntity.

Referenced by SimulationComplete().

◆ SelectEntityId()

void WsfExtInterface::SelectEntityId ( WsfPlatform * aPlatformPtr,
uint16_t & aEntityId )

Given a platform, select an entity id. Call FreeEntityId() when the ID is no longer assigned to the platform

References AssignNewEntity(), WsfObject::GetName(), WsfObject::GetNameId(), WsfExtData::mPlatformNameToEntityId, and WsfExtData::mPreassignedEntityIds.

◆ SelectPlatformType()

◆ SimulationComplete()

void WsfExtInterface::SimulationComplete ( double aSimTime)

◆ StripExternalPlatform()

Member Data Documentation

◆ ConnectionComplete

UtCallbackListN<void(double)> WsfExtInterface::ConnectionComplete

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