Go to the documentation of this file.
11 #ifndef RTCKT_TELSUB_SHMPUBLISHER_HPP
12 #define RTCKT_TELSUB_SHMPUBLISHER_HPP
14 #include <system_error>
17 #include <ipcq/writer.hpp>
30 template <
class UserTopicType,
class DataBlender,
class ShmWriter = ipcq::Writer<UserTopicType>>
33 ShmPublisher(ShmWriter&& shm_writer, DataBlender& blender);
46 UserTopicType m_topic;
47 DataBlender& m_blender;
56 template <
class UserTopicType,
class DataBlender,
class ShmWriter>
58 -> std::unique_ptr<ShmPublisher<UserTopicType, DataBlender, ShmWriter>> {
59 return std::make_unique<ShmPublisher<UserTopicType, DataBlender, ShmWriter>>(
60 std::move(shm_writer), blender);
63 template <
class UserTopicType,
class DataBlender,
class ShmWriter>
68 , m_shm(
std::move(shm_writer)) {
69 static_assert(std::is_invocable_r<std::error_code,
72 UserTopicType&>::value,
73 "DataBlender must have the signature "
74 "`std::error_code(const rtctk::telSub::DataSamplesView&, "
78 template <
class UserTopicType,
class DataBlender,
class ShmWriter>
82 if (
auto err = m_blender(samples, m_topic); !err) {
83 return m_shm.Write(m_topic, ipcq::Notify::All);
89 template <
class UserTopicType,
class DataBlender,
class ShmWriter>
96 #endif // #ifndef RTCKT_TELSUB_SHMPUBLISHER_HPP
Definition: shmPublisher.hpp:31
Simple interface to class that owns the shared memory queue.
Definition: shmPublisherIf.hpp:27
A set of correlated agnostic non-owning data samples references.
Definition: dataSampleView.hpp:46
ShmPublisher(ShmWriter &&shm_writer, DataBlender &blender)
Definition: shmPublisher.hpp:64
std::error_code Publish(DataSamplesView const &samples) noexcept override
Publish correlated DDS samples to shared memory, transforming it first using DataBlender to a UserTop...
Definition: shmPublisher.hpp:79
Definition: mudpiProcessingError.hpp:119
void CloseQueue() noexcept override
Close shared memory queue.
Definition: shmPublisher.hpp:90
auto MakeShmPublisher(ShmWriter &&shm_writer, DataBlender &blender) -> std::unique_ptr< ShmPublisher< UserTopicType, DataBlender, ShmWriter >>
Helper that can deduce DataBlender class template argument.
Definition: shmPublisher.hpp:57