|
WSF
|
DIS interface implementation of worker thread. More...
#include <WsfDisIO_Thread.hpp>


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 |
DIS interface implementation of worker thread.
| WsfDisIO_Thread::WsfDisIO_Thread | ( | WsfDisInterface * | aInterfacePtr | ) |
Constructor and destructor.
References RCV_INCOMING, and WsfThread::WsfThread().
|
override |
Work queue of Incoming PDUs to process
Work queue of Outgoing PDUs to process
| void WsfDisIO_Thread::AdvanceTime | ( | double | aSimTime | ) |
Called from the main thread AdvanceTime method.
References WsfThread::AssignWork(), and WsfThread::ReadyForWork().
|
overridevirtual |
Performs the thread work.
Implements WsfThread.
References WsfThread::ASSIGNED, WsfThread::AVAILABLE, WsfThread::GetFunction(), IDLE, RCV_INCOMING, SEND_OUTBOUND, and WORK_COMPLETE.
| DisPdu * WsfDisIO_Thread::GetPdu | ( | ) |
Called from the main thread to get the next PDU from the receive queue.
| 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.
| void WsfDisIO_Thread::Initialize | ( | bool | aAutostart | ) |
Called from the main thread to initialize the thread.
References WsfDisUtil::GetSimulation(), IDLE, and WsfSimulation::IsRealTime().
|
inlineoverridevirtual |
The user defines the processing to be performed during the PAUSED state by implementing this method.
Implements WsfThread.
References WsfThread::AVAILABLE.
| 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.
| void WsfDisIO_Thread::SendPduOnDevices | ( | double | aSimTime, |
| DisPdu & | aPdu ) |
Immediately send a PDU out over the current connections.
| aSimTime | The current simulation time. |
| aPdu | The PDU to be sent. |
|
inline |
|
inline |
| 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().
| void WsfDisIO_Thread::SimulationStarting | ( | ) |
Called from the main thread to indicate that the simulation is complete.
References RCV_INCOMING.
|
inline |