WSF
WsfDisIO_Thread Class Reference

DIS interface implementation of worker thread. More...

#include <WsfDisIO_Thread.hpp>

Inheritance diagram for WsfDisIO_Thread:
Collaboration diagram for WsfDisIO_Thread:

Public Types

enum  ThreadState { IDLE = 0 , SEND_OUTBOUND = 1 , RCV_INCOMING = 2 , WORK_COMPLETE = 3 }
Public Types inherited from WsfThread
enum  FunctionType {
  STOPPED = 0 , AVAILABLE = 1 , ASSIGNED = 2 , PAUSED = 3 ,
  CRITICAL = 4
}

Public Member Functions

 WsfDisIO_Thread (WsfDisInterface *aInterfacePtr)
 Constructor and destructor.
 ~WsfDisIO_Thread () override
FunctionType DoWork () override
FunctionType Pause () override
DisPdu * GetPdu ()
 Called from the main thread to get the next PDU from the receive queue.
void ImmediatePutPdu (double aSimTime, DisPdu *aPduPtr)
 Called from the main thread to add a PDU to the transmit queue.
void PutPdu (double aSimTime, std::unique_ptr< DisPdu > aPduPtr)
 Called from the main thread to add a PDU to the transmit queue.
void SendPduOnDevices (double aSimTime, DisPdu &aPdu)
void AdvanceTime (double aSimTime)
 Called from the main thread AdvanceTime method.
void Initialize (bool aAutostart)
 Called from the main thread to initialize the thread.
void SimulationComplete ()
 Called from the main thread to indicate that the simulation is complete.
void SimulationStarting ()
 Called from the main thread to indicate that the simulation is complete.
void SetReceivePDUs (bool aReceivePDUs)
void SetOutboundPDUs (bool aSendOutboundPDUs)
void WaitForStartPDU (bool aWaitForStartPDU)
Public Member Functions inherited from WsfThread
 WsfThread ()=default
 ~WsfThread () override=default
void Run () override
FunctionType GetFunction () const
bool CriticalWork () const
 Thread Run() function status methods.
bool ReadyForWork () const
bool Stopped () const
bool AssignWork ()
 Thread internal Run() control methods.
bool StopWork ()
bool ForceStopWork ()
bool PauseWork ()
void EndThread ()
void WaitUntilWorkDone ()
bool TryWaitUntilWorkDone (double aTimeoutSecs)
virtual void Available ()
 Methods called by the thread's Run() method.

Additional Inherited Members

Protected Member Functions inherited from WsfThread
bool BeginCriticalWork ()
bool EndCriticalWork ()
bool SetFunction (FunctionType aOldFunction, FunctionType aNewFunction)
Protected Attributes inherited from WsfThread
FunctionType mSavedState = STOPPED
std::condition_variable mWorkDoneCond
std::mutex mFunctionWriteMutex

Detailed Description

DIS interface implementation of worker thread.

Member Enumeration Documentation

◆ ThreadState

Enumerator
IDLE 
SEND_OUTBOUND 
RCV_INCOMING 
WORK_COMPLETE 

Constructor & Destructor Documentation

◆ WsfDisIO_Thread()

WsfDisIO_Thread::WsfDisIO_Thread ( WsfDisInterface * aInterfacePtr)

Constructor and destructor.

References RCV_INCOMING, and WsfThread::WsfThread().

◆ ~WsfDisIO_Thread()

WsfDisIO_Thread::~WsfDisIO_Thread ( )
override

Work queue of Incoming PDUs to process

Work queue of Outgoing PDUs to process

Member Function Documentation

◆ AdvanceTime()

void WsfDisIO_Thread::AdvanceTime ( double aSimTime)

Called from the main thread AdvanceTime method.

References WsfThread::AssignWork(), and WsfThread::ReadyForWork().

◆ DoWork()

WsfDisIO_Thread::FunctionType WsfDisIO_Thread::DoWork ( )
overridevirtual

Performs the thread work.

Returns
Function state of the thread. (See WsfThread)

Implements WsfThread.

References WsfThread::ASSIGNED, WsfThread::AVAILABLE, WsfThread::GetFunction(), IDLE, RCV_INCOMING, SEND_OUTBOUND, and WORK_COMPLETE.

◆ GetPdu()

DisPdu * WsfDisIO_Thread::GetPdu ( )

Called from the main thread to get the next PDU from the receive queue.

◆ ImmediatePutPdu()

void WsfDisIO_Thread::ImmediatePutPdu ( double aSimTime,
DisPdu * aPduPtr )

Called from the main thread to add a PDU to the transmit queue.

References WsfThread::AssignWork(), WsfThread::ReadyForWork(), SEND_OUTBOUND, and WORK_COMPLETE.

◆ Initialize()

void WsfDisIO_Thread::Initialize ( bool aAutostart)

Called from the main thread to initialize the thread.

References WsfDisUtil::GetSimulation(), IDLE, and WsfSimulation::IsRealTime().

◆ Pause()

FunctionType WsfDisIO_Thread::Pause ( )
inlineoverridevirtual

The user defines the processing to be performed during the PAUSED state by implementing this method.

Returns
The FunctionType defining the state the thread will be in after completion of the work. If the pause is complete, return either AVAILABLE or ASSIGNED; otherwise return PAUSED.

Implements WsfThread.

References WsfThread::AVAILABLE.

◆ PutPdu()

void WsfDisIO_Thread::PutPdu ( double aSimTime,
std::unique_ptr< DisPdu > aPduPtr )

Called from the main thread to add a PDU to the transmit queue.

References WsfThread::AssignWork(), WsfThread::ReadyForWork(), SEND_OUTBOUND, and WORK_COMPLETE.

◆ SendPduOnDevices()

void WsfDisIO_Thread::SendPduOnDevices ( double aSimTime,
DisPdu & aPdu )

Immediately send a PDU out over the current connections.

Parameters
aSimTimeThe current simulation time.
aPduThe PDU to be sent.

◆ SetOutboundPDUs()

void WsfDisIO_Thread::SetOutboundPDUs ( bool aSendOutboundPDUs)
inline

◆ SetReceivePDUs()

void WsfDisIO_Thread::SetReceivePDUs ( bool aReceivePDUs)
inline

◆ SimulationComplete()

void WsfDisIO_Thread::SimulationComplete ( )

Called from the main thread to indicate that the simulation is complete.

References WsfThread::EndThread(), WsfThread::GetFunction(), WsfThread::STOPPED, WsfThread::StopWork(), and WsfThread::WaitUntilWorkDone().

◆ SimulationStarting()

void WsfDisIO_Thread::SimulationStarting ( )

Called from the main thread to indicate that the simulation is complete.

References RCV_INCOMING.

◆ WaitForStartPDU()

void WsfDisIO_Thread::WaitForStartPDU ( bool aWaitForStartPDU)
inline

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