RTC Toolkit  2.0.0
ddsWaitSet.hpp
Go to the documentation of this file.
1 
11 #ifndef RTCKT_TELSUB_DDSWAITSET_HPP
12 #define RTCKT_TELSUB_DDSWAITSET_HPP
13 
14 #include <list>
15 #include <map>
16 #include <memory>
17 #include <set>
18 
22 
23 namespace rtctk::telSub {
24 
30 class DdsWaitSet final : public DdsWaitSetIf, SeqLoanerIf {
31 public:
32  using Alloc = std::pmr::polymorphic_allocator<std::byte>;
33  DdsWaitSet(const DdsParams& params, Alloc const& alloc = {});
34  virtual ~DdsWaitSet() noexcept;
35 
37  DdsWaitSet& operator=(DdsWaitSet&& rhs) = delete;
38 
39  AgnosticDataSamples& GetSamples() noexcept override;
40  std::error_code Take(std::chrono::nanoseconds timeout) noexcept override;
41 
42  size_t GetNumberOfTopics() const noexcept override;
43  std::string GetTopicName(size_t index) const noexcept override;
44 
46  std::error_code
47  ReturnLoan(std::uint8_t idx, DdsSampleSeq& samples, DdsInfoSeq& infos) noexcept override;
48 
49 private:
50  // Do not allow copying of this object.
51  DdsWaitSet(const DdsWaitSet& rhs) = delete;
52  DdsWaitSet& operator=(const DdsWaitSet& rhs) = delete;
53 
54  void Initialise(const DdsParams& params);
55  void Finalise();
56 
57  std::unique_ptr<rtctk::componentFramework::DdsSub> m_dds_sub;
58 
59  std::vector<rtctk::componentFramework::DataReader *> *m_readers;
60  std::map<Condition*, uint32_t> m_reader_context_lut;
61  std::unique_ptr<WaitSet> m_waitset;
62  AgnosticDataSamples m_samples;
63 };
64 
65 } // namespace rtctk::telSub
66 #endif // RTCKT_TELSUB_DDSWAITSET_HPP
rtctk::telSub::DdsWaitSet::GetSamples
AgnosticDataSamples & GetSamples() noexcept override
Returns reference to data structure holding taken data samples.
Definition: ddsWaitSet.cpp:84
rtctk::telSub::DdsWaitSet::GetNumberOfTopics
size_t GetNumberOfTopics() const noexcept override
Returns the number of configured topics.
Definition: ddsWaitSet.cpp:259
rtctk::telSub::DdsSampleSeq
rtctk::componentFramework::AgnosticTopicSeq DdsSampleSeq
Definition: agnosticDataSamples.hpp:27
ddsReaderListener.hpp
DDS Reader Listener.
rtctk::telSub::DdsWaitSet::ReturnLoan
std::error_code ReturnLoan(std::uint8_t idx, DdsSampleSeq &samples, DdsInfoSeq &infos) noexcept override
Returns loaned sample sequence.
Definition: ddsWaitSet.cpp:248
rtctk::telSub::DdsWaitSet::~DdsWaitSet
virtual ~DdsWaitSet() noexcept
Destroys the DDS subscriber and releases all DDS resources.
Definition: ddsWaitSet.cpp:71
rtctk::telSub::SeqLoanerIf
Loaner interface.
Definition: agnosticDataSamples.hpp:36
rtctk::telSub::DdsWaitSet::GetTopicName
std::string GetTopicName(size_t index) const noexcept override
Returns a string containing the name of a configured topic.
Definition: ddsWaitSet.cpp:263
ddsWaitSetIf.hpp
Declares DdsWaitSetIf.
rtctk::componentFramework::DdsSub
All functionality needed to create DDS entities for DDS data subscribing is concentrated in this clas...
Definition: ddsSub.hpp:48
rtctk::telSub
Definition: main.cpp:6
rtctk_config_tool.delete
def delete(repo, path, recursive)
Definition: rtctk_config_tool.py:216
rtctk::telSub::DdsWaitSetIf
Base class abstracting DDS communication code.
Definition: ddsWaitSetIf.hpp:58
rtctk::telSub::DdsParams
Parameter set to be passed to classes deriving from DdsWaitSetIf.
Definition: ddsWaitSetIf.hpp:40
ddsSub.hpp
DDS Subscriber.
rtctk::telSub::DdsWaitSet::Take
std::error_code Take(std::chrono::nanoseconds timeout) noexcept override
Takes new samples from DDS readers and updates data structure accessable from GetSamples()
Definition: ddsWaitSet.cpp:202
mudpi::uint32_t
unsigned int uint32_t
Definition: mudpi.h:16
std
Definition: mudpiProcessingError.hpp:119
rtctk::telSub::DdsWaitSet
Implements DDS communication using FastDDS.
Definition: ddsWaitSet.hpp:30
rtctk::telSub::DdsWaitSet::DdsWaitSet
DdsWaitSet(const DdsParams &params, Alloc const &alloc={})
Constructs a DDS subscriber from given configuration parameters.
Definition: ddsWaitSet.cpp:51
rtctk::telSub::DdsWaitSet::Alloc
std::pmr::polymorphic_allocator< std::byte > Alloc
Definition: ddsWaitSet.hpp:32
rtctk::telSub::DdsInfoSeq
rtctk::componentFramework::SampleInfoSeq DdsInfoSeq
Definition: agnosticDataSamples.hpp:29
rtctk::telSub::AgnosticDataSamples
Container of DDS samples and associated sample information.
Definition: agnosticDataSamples.hpp:71
rtctk
Definition: commandReplier.cpp:20