RTC Toolkit  2.0.0
Public Member Functions | List of all members
rtctk::telSub::DdsWaitSetIf Class Referenceabstract

Base class abstracting DDS communication code. More...

#include <ddsWaitSetIf.hpp>

Inheritance diagram for rtctk::telSub::DdsWaitSetIf:
rtctk::telSub::DdsWaitSet rtctk::telSub::FakeDdsSubscriber

Public Member Functions

 DdsWaitSetIf () RTCTK_NOEXCEPT
 
virtual ~DdsWaitSetIf () RTCTK_NOEXCEPT
 
virtual AgnosticDataSamplesGetSamples () RTCTK_NOEXCEPT=0
 Returns reference to data structure holding taken data samples. More...
 
virtual std::error_code Take (std::chrono::nanoseconds timeout) RTCTK_NOEXCEPT=0
 Takes new samples from DDS readers and updates data structure accessable from GetSamples() More...
 
virtual size_t GetNumberOfTopics () const RTCTK_NOEXCEPT=0
 Returns the number of configured topics. More...
 
virtual std::string GetTopicName (size_t index) const RTCTK_NOEXCEPT=0
 Returns a string containing the name of a configured topic. More...
 

Detailed Description

Base class abstracting DDS communication code.

Constructor & Destructor Documentation

◆ DdsWaitSetIf()

rtctk::telSub::DdsWaitSetIf::DdsWaitSetIf ( )
inline

◆ ~DdsWaitSetIf()

virtual rtctk::telSub::DdsWaitSetIf::~DdsWaitSetIf ( )
inlinevirtual

Member Function Documentation

◆ GetNumberOfTopics()

virtual size_t rtctk::telSub::DdsWaitSetIf::GetNumberOfTopics ( ) const
pure virtual

Returns the number of configured topics.

This returns the number of topics that were configured during construction of the subscriber object. This corresponds to the size of the DdsParams::m_topics vector passed to the constructor.

Returns
The number of configured topics.

Implemented in rtctk::telSub::DdsWaitSet, and rtctk::telSub::FakeDdsSubscriber.

◆ GetSamples()

virtual AgnosticDataSamples& rtctk::telSub::DdsWaitSetIf::GetSamples ( )
pure virtual

Returns reference to data structure holding taken data samples.

To update structure with new samples TakeSamples() must be used.

See also
TakeSamples()

Implemented in rtctk::telSub::DdsWaitSet, and rtctk::telSub::FakeDdsSubscriber.

◆ GetTopicName()

virtual std::string rtctk::telSub::DdsWaitSetIf::GetTopicName ( size_t  index) const
pure virtual

Returns a string containing the name of a configured topic.

This returns the name of a configured DDS topic as a string. The topic name is associated with the index'th DDS reader and will also identify the topic for samples[index], which is the output parameter vector filled by TakeSamples containing newly arrived DDS samples for the index'th DDS reader.

Parameters
[in]indexThis selects which topic name to fetch. The value must be in the range 0 <= index and index < GetNumberOfTopics().
Returns
The index'th topic name.

Implemented in rtctk::telSub::DdsWaitSet, and rtctk::telSub::FakeDdsSubscriber.

◆ Take()

virtual std::error_code rtctk::telSub::DdsWaitSetIf::Take ( std::chrono::nanoseconds  timeout)
pure virtual

Takes new samples from DDS readers and updates data structure accessable from GetSamples()

The method waits for new DDS samples to become available on one or more of the DDS topic readers as needed to fill up AgnosticDataSamples from GetSamples() with a non-empty sample sequence for each topic.

An empty / zero error code is returned if the operation completed successfully, meaning at least one non-empty sample sequence was taken.

If no samples were available within the timeout period then a std::errc::timed_out error code is returned. If some other error occurred, an appropriate error code is returned.

It is expected that the caller processes the samples and when done with them calls AgnosticAgnosticDataSamples::Clear() to return the samples to DDS. It is not required that all sample sequences are cleared at the same time.

Parameters
[in]timeoutThe maximum amount of time to wait for this operation to complete, measured in nanoseconds.
Returns
An error code indicating success, failure or timeout of the operation.

The following is the list of possible error codes returned:

0
At least one samples was successfully returned.
std::errc::timed_out
The operation timed out while waiting for DDS samples.
std::errc::protocol_error
A call to the DDS API failed.
std::errc::bad_address
Could not identify the associated topic reader for a sample.
See also
GetSamples()

Implemented in rtctk::telSub::DdsWaitSet, and rtctk::telSub::FakeDdsSubscriber.


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