VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtCigiSession Class Reference

#include <cigiSession.h>

Inheritance diagram for makVre::DtCigiSession:
[legend]

Public Types

using ConfigPtr = std::shared_ptr<DtInitializer>
 
using EntityPubPtr = std::shared_ptr<DtCigiSimEntityPublisher>
 
- Public Types inherited from makVre::DtSpSubClass< DtCigiSession >
using Super
 
using Ptr
 
using Sptr
 
using Wptr
 
- Public Types inherited from makVre::DtSpObject
using Ptr = DtSpObject*
 
using Sptr = std::shared_ptr<DtSpObject>
 
using Wptr = std::weak_ptr<DtSpObject>
 

Public Member Functions

 DtCigiSession ()
 
virtual ~DtCigiSession () override
 
virtual unsigned int version () const
 
virtual Sptr setHost (DtCigiHost &host)
 
virtual DtCigiHosthost ()
 
virtual Sptr setConfig (ConfigPtr config)
 
virtual ConfigPtr config ()
 
virtual Sptr setIgAddress (std::string address)
 
virtual std::string igAddress ()
 
virtual void init ()
 
virtual void tick (double dt)
 
virtual unsigned int frame () const
 
virtual void advanceFrame ()
 
virtual bool igOnline ()
 
virtual bool igRunning ()
 
virtual void endSession ()
 
virtual bool endingSession ()
 
virtual bool sessionEnded ()
 
virtual DtCigiIgControlPublisher::Sptr rootPublisher ()
 
virtual void resetPublishers ()
 
virtual void addListener (DtCigiListenerBase::Sptr listener)
 
virtual void requestFrameReceipt (DtCigiPublisherBase::Wptr publisher)
 
virtual void frameConfirmedReceived (unsigned int receivedFrame)
 
virtual Cigi_int8 terrainDatabaseId ()
 
virtual Cigi_uint16 claimNextEntitytId (DtCigiPublisherBase::Sptr forWho)
 
virtual bool useExtendedEntityType ()
 
virtual bool findShortEntityType (const DtEntityType &entityType, Cigi_uint16 &found_id)
 
virtual bool findCigiPartId (const DtEntityType &entityType, unsigned int partType, Cigi_uint8 &found_id)
 
virtual bool findMuzzleFlashType (const DtEntityType &munitionType, Cigi_uint16 &found_id)
 
virtual bool findDetonationType (const DtEntityType &munitionType, Cigi_uint16 &found_id)
 
virtual bool publishOwnshipOnly ()
 
virtual bool findCigiViewType (const std::string &sensor, Cigi_uint8 &found_type)
 
virtual int firstViewId ()
 
EntityPubPtr findEntity (const DtEntityIdentifier &entityId)
 
EntityPubPtr findOrCreateEntity (const DtEntityIdentifier &entityId)
 
virtual DtInitTable findConfigTableByType (const std::string &mapName, const DtEntityType &entityType)
 
template<typename FIND_T, typename RETURN_T = FIND_T>
bool findConfigParam (DtInitTable table, const std::string paramName, RETURN_T &ret)
 
template<class CREATE_T>
std::shared_ptr< CREATE_T > createVersioned ()
 
- Public Member Functions inherited from makVre::DtSpSubClass< DtCigiSession >
 DtSpSubClass ()
 
virtual ~DtSpSubClass ()
 
Sptr self ()
 
std::string type () const override
 
- Public Member Functions inherited from makVre::DtSpObject
 DtSpObject ()
 
virtual ~DtSpObject ()
 
Sptr self ()
 
virtual void setName (const std::string &name)
 
virtual std::string name () const
 

Protected Types

using SortedTypeSet = std::set<DtEntityType>
 
using SortedTypeSetMap = std::map<std::string, SortedTypeSet>
 
using BestTypeMatchMap = std::map<DtEntityType, DtInitTable>
 
using BestTypeMatchMapMap = std::map<std::string, BestTypeMatchMap>
 
using CigiIdMap = std::map<Cigi_uint16, DtCigiPublisherBase::Wptr>
 
using FrameReceiptRequest = std::pair<DtCigiPublisherBase::Wptr, unsigned int>
 
using FrameReceiptMap = std::map<void*, FrameReceiptRequest>
 
using ListenerMap = std::map<Cigi_uint16, DtCigiListenerBase::Sptr>
 

Protected Member Functions

virtual void openSocket ()
 
virtual void initRootPublisher ()
 
virtual void initListeners ()
 
virtual void startSession ()
 
virtual DtCigiStartOfFrameListener::Sptr igStatus ()
 
virtual void checkForIncomingPackets ()
 
virtual void packAndSendFrame ()
 
virtual void updateTerrainDatabaseId ()
 
virtual bool findCigiDatabaseId (const std::string &terrain, Cigi_int8 &found_id)
 

Protected Attributes

DtCigiHostmyHost
 
ConfigPtr myConfig
 
unsigned int myVersion
 
std::string myOverrideIgAddress
 
std::shared_ptr< DtInetSocket > mySocket
 
DtInetEndpoint myIgEndpoint
 
std::shared_ptr< CigiHostSession > mySession
 
DtCigiIgControlPublisher::Sptr myIgControl
 
unsigned int myFrame
 
double myLastFrameTime
 
double myShutdownStarted
 
Cigi_int8 myTerrainDatabaseId
 
SortedTypeSetMap mySortedTypeSetMap
 
BestTypeMatchMapMap myBestTypeMatchMapMap
 
CigiIdMap myCigiIdMap
 
Cigi_uint16 myLastUsedId
 
FrameReceiptMap myFrameReceiptMap
 
ListenerMap myListenerMap
 
bool myFakeIgHeartbeat
 
bool myShuttingDown
 
- Protected Attributes inherited from makVre::DtSpObject
std::string myName
 

Additional Inherited Members

- Static Public Member Functions inherited from makVre::DtSpSubClass< DtCigiSession >
static std::string Type ()
 
static std::shared_ptr< DtCigiSessioncreate ()
 
static void registerCreator ()
 
static std::shared_ptr< DtCigiSessioncreateVersion (unsigned int version)
 
static void registerCreatorVersion (unsigned int version)
 
- Static Public Member Functions inherited from makVre::DtSpObject
template<class AS_T>
static std::shared_ptr< AS_T > cast (Sptr p)
 
template<class AS_T>
static std::shared_ptr< AS_T > unsafe_cast (Sptr p)
 
- Static Protected Member Functions inherited from makVre::DtSpSubClass< DtCigiSession >
static std::shared_ptr< DtBaseCreator< DtCigiSession > > & creator ()
 
static std::shared_ptr< DtBaseCreator< DtCigiSession > > & creatorVersion (unsigned int version)
 

Member Typedef Documentation

◆ ConfigPtr

◆ EntityPubPtr

◆ SortedTypeSet

using makVre::DtCigiSession::SortedTypeSet = std::set<DtEntityType>
protected

◆ SortedTypeSetMap

using makVre::DtCigiSession::SortedTypeSetMap = std::map<std::string, SortedTypeSet>
protected

◆ BestTypeMatchMap

using makVre::DtCigiSession::BestTypeMatchMap = std::map<DtEntityType, DtInitTable>
protected

◆ BestTypeMatchMapMap

using makVre::DtCigiSession::BestTypeMatchMapMap = std::map<std::string, BestTypeMatchMap>
protected

◆ CigiIdMap

using makVre::DtCigiSession::CigiIdMap = std::map<Cigi_uint16, DtCigiPublisherBase::Wptr>
protected

◆ FrameReceiptRequest

using makVre::DtCigiSession::FrameReceiptRequest = std::pair<DtCigiPublisherBase::Wptr, unsigned int>
protected

◆ FrameReceiptMap

using makVre::DtCigiSession::FrameReceiptMap = std::map<void*, FrameReceiptRequest>
protected

◆ ListenerMap

using makVre::DtCigiSession::ListenerMap = std::map<Cigi_uint16, DtCigiListenerBase::Sptr>
protected

Constructor & Destructor Documentation

◆ DtCigiSession()

makVre::DtCigiSession::DtCigiSession ( )

◆ ~DtCigiSession()

virtual makVre::DtCigiSession::~DtCigiSession ( )
overridevirtual

Member Function Documentation

◆ version()

virtual unsigned int makVre::DtCigiSession::version ( ) const
virtual

CIGI Major Version for this Session.

Returns
int representing CIGI Major Version

Referenced by createVersioned().

◆ setHost()

virtual Sptr makVre::DtCigiSession::setHost ( DtCigiHost & host)
virtual

References host().

◆ host()

virtual DtCigiHost & makVre::DtCigiSession::host ( )
virtual

Referenced by setHost().

◆ setConfig()

virtual Sptr makVre::DtCigiSession::setConfig ( ConfigPtr config)
virtual

References config().

◆ config()

virtual ConfigPtr makVre::DtCigiSession::config ( )
virtual

Referenced by setConfig().

◆ setIgAddress()

virtual Sptr makVre::DtCigiSession::setIgAddress ( std::string address)
virtual

◆ igAddress()

virtual std::string makVre::DtCigiSession::igAddress ( )
virtual

◆ init()

virtual void makVre::DtCigiSession::init ( )
virtual

◆ tick()

virtual void makVre::DtCigiSession::tick ( double dt)
virtual

Called once per Sim tick. Processes all incoming CIGI packets and may send outgoing CIGI packets.

DtCigiSession::tick is called from DtCigiHost::tick which is connected to DtSimObjectManager::signal_advanceFrame.

DtCigiSession::ticks process all CIGI packets received from the IG and dispatches them to the correct Listeners.

If a Start Of Frame is received from the IG indicating that the IG has advanced a frame, then advanceFrame() will be called and the Publishers will be ticked and called upon to update and write CIGI packet data. If no Start Of Frame has been received for the configured updTimeout time, the IG will be marked as offline.

If the IG is offline, Publishers will not be ticked, nor called to update and write CIGI data; except for the root DtCigiIgControlPublisher publisher, which will continue to heartbeat IGCtrl CIGI packets once per second.

Parameters
dtElapsed time in seconds since the last tick.

◆ frame()

virtual unsigned int makVre::DtCigiSession::frame ( ) const
virtual

Returns the Session frame number.

The Session frame number is published by DtCigiIgControlPublisher. The Session frame number does not correspond to the IG frame number, but the Session frame number does advances when the IG frame number advances.

◆ advanceFrame()

virtual void makVre::DtCigiSession::advanceFrame ( )
virtual

Advances the Session frame number, updates Publishers and sends CIGI data.

advanceFrame ticks the root Publisher (which in turn ticks all child Publishers), then calls packAndSendFrame(), which will call upon Publishers to update and write CIGI data.

◆ igOnline()

virtual bool makVre::DtCigiSession::igOnline ( )
virtual

Returns online status of IG.

The IG is considered online if a Start Of Frame packet has been received within the configured udpTimeout window, and the Start Of Frame packet does not indicate that the IG is in Offline Maintenance mode.

◆ igRunning()

virtual bool makVre::DtCigiSession::igRunning ( )
virtual

Returns true if the IG is online and has indicated that it is in Operate mode.

◆ endSession()

virtual void makVre::DtCigiSession::endSession ( )
virtual

Begins the process of shutting down the Session.

IG Control Mode is set to Standby and all published CIGI entity states are set to Remove/Destroyed. The Session will continue to tick until receipt of entity removal is confirmed or the IG times out, at which point the IP socket is closed and sessionEnded() will return true.

◆ endingSession()

virtual bool makVre::DtCigiSession::endingSession ( )
virtual

Returns true if endSession() has been called.

◆ sessionEnded()

virtual bool makVre::DtCigiSession::sessionEnded ( )
virtual

Returns true if the process started by endSession() is complete.

◆ rootPublisher()

virtual DtCigiIgControlPublisher::Sptr makVre::DtCigiSession::rootPublisher ( )
virtual

Returns a smart pointer to the root Publisher, a DtCigiIgControlPublisher class.

◆ resetPublishers()

virtual void makVre::DtCigiSession::resetPublishers ( )
virtual

Marks all publishers as dirty and clears list of publishers waiting for receipt confirmation.

◆ addListener()

virtual void makVre::DtCigiSession::addListener ( DtCigiListenerBase::Sptr listener)
virtual

◆ requestFrameReceipt()

virtual void makVre::DtCigiSession::requestFrameReceipt ( DtCigiPublisherBase::Wptr publisher)
virtual

◆ frameConfirmedReceived()

virtual void makVre::DtCigiSession::frameConfirmedReceived ( unsigned int receivedFrame)
virtual

◆ terrainDatabaseId()

virtual Cigi_int8 makVre::DtCigiSession::terrainDatabaseId ( )
virtual

◆ claimNextEntitytId()

virtual Cigi_uint16 makVre::DtCigiSession::claimNextEntitytId ( DtCigiPublisherBase::Sptr forWho)
virtual

Gets the next available CIGI EntityID.

Parameters
forWhoPublisher this ID will be assigned to. ID is freed when Publisher is deleted.
Returns
A CIGI EntityID

◆ useExtendedEntityType()

virtual bool makVre::DtCigiSession::useExtendedEntityType ( )
virtual

◆ findShortEntityType()

virtual bool makVre::DtCigiSession::findShortEntityType ( const DtEntityType & entityType,
Cigi_uint16 & found_id )
virtual

◆ findCigiPartId()

virtual bool makVre::DtCigiSession::findCigiPartId ( const DtEntityType & entityType,
unsigned int partType,
Cigi_uint8 & found_id )
virtual

◆ findMuzzleFlashType()

virtual bool makVre::DtCigiSession::findMuzzleFlashType ( const DtEntityType & munitionType,
Cigi_uint16 & found_id )
virtual

◆ findDetonationType()

virtual bool makVre::DtCigiSession::findDetonationType ( const DtEntityType & munitionType,
Cigi_uint16 & found_id )
virtual

◆ publishOwnshipOnly()

virtual bool makVre::DtCigiSession::publishOwnshipOnly ( )
virtual

In Publish Ownship Only mode, only the entity(s) with a ViewControl attached are published.

Returns
Bool indicating whether Publish Ownship Only mode is enabled.

◆ findCigiViewType()

virtual bool makVre::DtCigiSession::findCigiViewType ( const std::string & sensor,
Cigi_uint8 & found_type )
virtual

◆ firstViewId()

virtual int makVre::DtCigiSession::firstViewId ( )
virtual

◆ findEntity()

EntityPubPtr makVre::DtCigiSession::findEntity ( const DtEntityIdentifier & entityId)

Find the SimEntityPublisher associted with the given DtEntityIdentifier.

Parameters
entityIdDtEntityIdentifier of the Sim Entity to find.
Returns
Shared Pointer to SimEntityPublisher associated with entityId, if there is one.

◆ findOrCreateEntity()

EntityPubPtr makVre::DtCigiSession::findOrCreateEntity ( const DtEntityIdentifier & entityId)

Find the SimEntityPublisher associated with the given entityId, or create one if not found.

Parameters
entityIdDtEntityIdenifier of the Sim Entity to find, or to create a Publisher for.
Returns
Shared Pointer to the SimEntityPublisher associated with the given entityId.

◆ findConfigTableByType()

virtual DtInitTable makVre::DtCigiSession::findConfigTableByType ( const std::string & mapName,
const DtEntityType & entityType )
virtual

◆ findConfigParam()

template<typename FIND_T, typename RETURN_T = FIND_T>
bool makVre::DtCigiSession::findConfigParam ( DtInitTable table,
const std::string paramName,
RETURN_T & ret )
inline

◆ createVersioned()

template<class CREATE_T>
std::shared_ptr< CREATE_T > makVre::DtCigiSession::createVersioned ( )
inline

Creates a new Publisher of the type registered for the given CREATE_T and Session version.

Template Parameters
CREATE_TType of Publisher to create. This is usually an abstract base type, and the actual instance will be a derived concete "V#" class.
Returns
Shared Pointer to the new Publisher.

References version().

◆ openSocket()

virtual void makVre::DtCigiSession::openSocket ( )
protectedvirtual

◆ initRootPublisher()

virtual void makVre::DtCigiSession::initRootPublisher ( )
protectedvirtual

◆ initListeners()

virtual void makVre::DtCigiSession::initListeners ( )
protectedvirtual

◆ startSession()

virtual void makVre::DtCigiSession::startSession ( )
protectedvirtual

◆ igStatus()

virtual DtCigiStartOfFrameListener::Sptr makVre::DtCigiSession::igStatus ( )
protectedvirtual

◆ checkForIncomingPackets()

virtual void makVre::DtCigiSession::checkForIncomingPackets ( )
protectedvirtual

◆ packAndSendFrame()

virtual void makVre::DtCigiSession::packAndSendFrame ( )
protectedvirtual

◆ updateTerrainDatabaseId()

virtual void makVre::DtCigiSession::updateTerrainDatabaseId ( )
protectedvirtual

◆ findCigiDatabaseId()

virtual bool makVre::DtCigiSession::findCigiDatabaseId ( const std::string & terrain,
Cigi_int8 & found_id )
protectedvirtual

Member Data Documentation

◆ myHost

DtCigiHost* makVre::DtCigiSession::myHost
protected

◆ myConfig

ConfigPtr makVre::DtCigiSession::myConfig
protected

◆ myVersion

unsigned int makVre::DtCigiSession::myVersion
protected

◆ myOverrideIgAddress

std::string makVre::DtCigiSession::myOverrideIgAddress
protected

◆ mySocket

std::shared_ptr<DtInetSocket> makVre::DtCigiSession::mySocket
protected

◆ myIgEndpoint

DtInetEndpoint makVre::DtCigiSession::myIgEndpoint
protected

◆ mySession

std::shared_ptr<CigiHostSession> makVre::DtCigiSession::mySession
protected

◆ myIgControl

DtCigiIgControlPublisher::Sptr makVre::DtCigiSession::myIgControl
protected

◆ myFrame

unsigned int makVre::DtCigiSession::myFrame
protected

◆ myLastFrameTime

double makVre::DtCigiSession::myLastFrameTime
protected

◆ myShutdownStarted

double makVre::DtCigiSession::myShutdownStarted
protected

◆ myTerrainDatabaseId

Cigi_int8 makVre::DtCigiSession::myTerrainDatabaseId
protected

◆ mySortedTypeSetMap

SortedTypeSetMap makVre::DtCigiSession::mySortedTypeSetMap
protected

◆ myBestTypeMatchMapMap

BestTypeMatchMapMap makVre::DtCigiSession::myBestTypeMatchMapMap
protected

◆ myCigiIdMap

CigiIdMap makVre::DtCigiSession::myCigiIdMap
protected

◆ myLastUsedId

Cigi_uint16 makVre::DtCigiSession::myLastUsedId
protected

◆ myFrameReceiptMap

FrameReceiptMap makVre::DtCigiSession::myFrameReceiptMap
protected

◆ myListenerMap

ListenerMap makVre::DtCigiSession::myListenerMap
protected

◆ myFakeIgHeartbeat

bool makVre::DtCigiSession::myFakeIgHeartbeat
protected

◆ myShuttingDown

bool makVre::DtCigiSession::myShuttingDown
protected

The documentation for this class was generated from the following file: