RTC Toolkit  0.1.0-alpha
Public Member Functions | List of all members
rtctk::telSub::OperationalLogic Class Referencefinal

#include <operationalLogic.hpp>

Inheritance diagram for rtctk::telSub::OperationalLogic:
rtctk::telSub::OperationalLogicIf

Public Member Functions

 OperationalLogic (OperationalParams params, std::unique_ptr< CorrelatorIf > &&correlator, std::unique_ptr< ShmPublisherIf > &&shm_publisher)
 
 ~OperationalLogic ()
 
void RunAsync () RTCTK_NOEXCEPT override
 
void IdleAsync () RTCTK_NOEXCEPT override
 
std::error_code GetLastError () const RTCTK_NOEXCEPT override
 
uint64_t GetErrorCount () const RTCTK_NOEXCEPT override
 
- Public Member Functions inherited from rtctk::telSub::OperationalLogicIf
virtual ~OperationalLogicIf ()
 

Detailed Description

Implements the behaviour for Operational state.

Main purpose is to take ownership of DDS subscriber and SHM publisher to create isolation between objects to limit thread safe requirements such that no synchronization between m_dds_subscriber and m_shm_publisher is needed.

OperationalLogic also acts as the broker/intermediator between DdsSubscriber and ShmPublisher. as such it is in a position to uniquely enable or disable data flow based on request from user with GoingRunning/GoingIdle.

Monitoring

Due to performance requirements the path between DDS subscriber and SHM publisher must keep a low overhead. This means that non-fatal errors are not thrown.

Non-fatal errors are reported using light-weight counters that can be monitored independently from a lower priority thread (TBC).

SHM Queue

OperationalLogic is responsible for the delay between closing the SHM queue and deleting the shm_publisher object, as configured with OperationalParams::close_detach_delay.

If SHM object is still reachable after ShmPublisher has been deleted, it means that some reader have not detached as they should, which OperationalLogic is then responsible for raising an operator alarm/error.

Non-fatal errors that occur when Idle are ignored.

Synchronization

The running thread is doing a relaxed synchronization with the requested state. This will reduce synchronization overhead with the downside that StartAsync() and StopAsync() are non-blocking and will return before requested state has changed.

The only blocking operation is the destruction of OperationalLogic which synchronizes and joins with the thread.

Constructor & Destructor Documentation

◆ OperationalLogic()

rtctk::telSub::OperationalLogic::OperationalLogic ( OperationalParams  params,
std::unique_ptr< CorrelatorIf > &&  correlator,
std::unique_ptr< ShmPublisherIf > &&  shm_publisher 
)

Spawns reader thread and starts subscribing to DDS data, but does not publish until StartAsync() is invoked.

◆ ~OperationalLogic()

rtctk::telSub::OperationalLogic::~OperationalLogic ( )

Requests threads to exit and joins with it.

Member Function Documentation

◆ GetErrorCount()

uint64_t rtctk::telSub::OperationalLogic::GetErrorCount ( ) const
overridevirtual

Get current error count.

Returns

@threadsafe{}

Implements rtctk::telSub::OperationalLogicIf.

◆ GetLastError()

std::error_code rtctk::telSub::OperationalLogic::GetLastError ( ) const
overridevirtual

Return last recorded error.

@threadsafe{}

Implements rtctk::telSub::OperationalLogicIf.

◆ IdleAsync()

void rtctk::telSub::OperationalLogic::IdleAsync ( )
overridevirtual

Stop publishing

@threadsafe{}

Implements rtctk::telSub::OperationalLogicIf.

◆ RunAsync()

void rtctk::telSub::OperationalLogic::RunAsync ( )
overridevirtual

Start publishing

Postcondition
Error count is reset to 0.

@threadsafe{}

Implements rtctk::telSub::OperationalLogicIf.


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