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