RTC Toolkit  1.0.0
Public Member Functions | List of all members
rtctk::telSub::FakeDdsSubscriber Class Reference

Fake DDS subscriber. More...

Inheritance diagram for rtctk::telSub::FakeDdsSubscriber:
rtctk::telSub::DdsSubscriberIf rtctk::telSub::SeqLoanerIf

Public Member Functions

 FakeDdsSubscriber (uint8_t num_topics, uint8_t batch_size)
 
virtual AgnosticDataSamplesGetSamples () noexcept override
 Returns reference to data structure holding taken data samples. More...
 
virtual std::error_code Take (std::chrono::nanoseconds timeout) noexcept override
 Fakes taking new samples. More...
 
virtual size_t GetNumberOfTopics () const noexcept override
 Returns the number of configured topics. More...
 
virtual const std::string & GetTopicName (size_t index) const noexcept override
 Returns a string containing the name of a configured topic. More...
 
virtual std::error_code ReturnLoan (std::uint8_t idx, DdsSampleSeq &samples, DdsInfoSeq &infos) noexcept override
 Returns loaned sample sequence. More...
 
- Public Member Functions inherited from rtctk::telSub::DdsSubscriberIf
 DdsSubscriberIf () RTCTK_NOEXCEPT
 
virtual ~DdsSubscriberIf () RTCTK_NOEXCEPT
 

Detailed Description

Fake DDS subscriber.

Constructor & Destructor Documentation

◆ FakeDdsSubscriber()

rtctk::telSub::FakeDdsSubscriber::FakeDdsSubscriber ( uint8_t  num_topics,
uint8_t  batch_size 
)
inline

Member Function Documentation

◆ GetNumberOfTopics()

virtual size_t rtctk::telSub::FakeDdsSubscriber::GetNumberOfTopics ( ) const
inlineoverridevirtualnoexcept

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.

Implements rtctk::telSub::DdsSubscriberIf.

◆ GetSamples()

virtual AgnosticDataSamples& rtctk::telSub::FakeDdsSubscriber::GetSamples ( )
inlineoverridevirtualnoexcept

Returns reference to data structure holding taken data samples.

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

See also
TakeSamples()

Implements rtctk::telSub::DdsSubscriberIf.

◆ GetTopicName()

virtual const std::string& rtctk::telSub::FakeDdsSubscriber::GetTopicName ( size_t  index) const
inlineoverridevirtualnoexcept

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.

Implements rtctk::telSub::DdsSubscriberIf.

◆ ReturnLoan()

virtual std::error_code rtctk::telSub::FakeDdsSubscriber::ReturnLoan ( std::uint8_t  idx,
DdsSampleSeq samples,
DdsInfoSeq infos 
)
inlineoverridevirtualnoexcept

Returns loaned sample sequence.

After invoking this method successfully the provided sequences will be emptied.

Postcondition
samples.length() == 0u && infos.length() == 0
Parameters
idxTopic index.
samplesSample sequence.
infosSample information sequence.

Implements rtctk::telSub::SeqLoanerIf.

◆ Take()

virtual std::error_code rtctk::telSub::FakeDdsSubscriber::Take ( std::chrono::nanoseconds  timeout)
inlineoverridevirtualnoexcept

Fakes taking new samples.

All it does is to update sample ids to be consecutive and return success.

Implements rtctk::telSub::DdsSubscriberIf.


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