108 #include <type_traits>
129 template <
typename MsgT, SecurityType SecT = SecurityType::kWithoutSecurity>
132 using UniquePtr = std::unique_ptr<Publisher<MsgT, SecT>>;
133 using SharedPtr = std::shared_ptr<Publisher<MsgT, SecT>>;
173 template <
typename ConfT,
typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>>
244 bool publish(
const MsgT& msg,
bool force =
false);
258 bool publish_fbb(
const void* fbb,
bool force =
false);
272 bool write_bytes(
const Bytes& data);
274 bool write_intra(
const IntraData& intra_data);
293 template <
typename MsgT>
296 using UniquePtr = std::unique_ptr<SecurityPublisher<MsgT>>;
297 using SharedPtr = std::shared_ptr<SecurityPublisher<MsgT>>;
309 template <
typename SecurityConfigT = Security::Config>
323 template <
typename SecurityConfigT = Security::Config>
343 template <
typename ConfT,
typename SecurityConfigT = Security::Config,
344 typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>>
356 template <
typename SecurityConfigT = Security::Config>
357 explicit SecurityPublisher(
const std::string& url_str, SecurityConfigT&& sec_cfg = {},
Fixed-size 128-byte buffer holder with SBO, five ownership modes and integrated codecs.
Definition: bytes.h:120
Copyable type-erased callable analogue of std::function with a tunable SBO and pool spill.
Definition: functional.h:131
Function< void(bool)> ConnectCallback
Callback fired when peer presence changes.
Definition: node_impl.h:171
Transport-agnostic CRTP base for all VLink communication primitives.
Definition: node.h:164
Type-safe topic emitter for the VLink event communication model.
Definition: publisher.h:130
void mark_as_setter()
Promotes this publisher to behave as a Setter (field-writer) at the transport layer.
Definition: publisher-inl.h:184
void detect_subscribers(ConnectCallback &&callback)
Registers a callback invoked whenever subscriber presence transitions.
Definition: publisher-inl.h:90
std::unique_ptr< Publisher< MsgT, SecT > > UniquePtr
Owning unique-pointer alias.
Definition: publisher.h:132
Publisher(const ConfT &conf, InitType type=InitType::kWithInit)
Constructs a publisher from a typed transport configuration object.
Definition: publisher-inl.h:52
bool publish(const MsgT &msg, bool force=false)
Serialises and emits msg to every connected subscriber.
Definition: publisher-inl.h:110
bool has_subscribers() const
Non-blocking query of subscriber presence.
Definition: publisher-inl.h:105
static constexpr ImplType kImplType
Node role tag (kPublisher).
Definition: publisher.h:136
bool publish_fbb(const void *fbb, bool force=false)
Publishes the raw payload of a pre-finished flatbuffers::FlatBufferBuilder.
Definition: publisher-inl.h:167
std::shared_ptr< Publisher< MsgT, SecT > > SharedPtr
Owning shared-pointer alias.
Definition: publisher.h:133
bool wait_for_subscribers(std::chrono::milliseconds timeout=Timeout::kDefaultInterval)
Blocks until at least one subscriber is detected or timeout expires.
Definition: publisher-inl.h:95
static constexpr Serializer::Type kMsgType
Codec resolved from MsgT.
Definition: publisher.h:137
static SharedPtr create_shared(const std::string &url_str, InitType type=InitType::kWithInit)
Heap-allocates a Publisher and wraps it in a std::shared_ptr.
Definition: publisher-inl.h:45
static UniquePtr create_unique(const std::string &url_str, InitType type=InitType::kWithInit)
Heap-allocates a Publisher and wraps it in a std::unique_ptr.
Definition: publisher-inl.h:39
Convenience alias of Publisher with per-message security enabled.
Definition: publisher.h:294
SecurityPublisher(const ConfT &conf, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Constructs a SecurityPublisher from a typed configuration object.
Definition: publisher-inl.h:241
static SharedPtr create_shared(const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Heap-allocates a SecurityPublisher and wraps it in a std::shared_ptr.
Definition: publisher-inl.h:230
std::unique_ptr< SecurityPublisher< MsgT > > UniquePtr
Owning unique-pointer alias.
Definition: publisher.h:296
std::shared_ptr< SecurityPublisher< MsgT > > SharedPtr
Owning shared-pointer alias.
Definition: publisher.h:297
static UniquePtr create_unique(const std::string &url_str, SecurityConfigT &&sec_cfg={}, InitType type=InitType::kWithInit)
Heap-allocates a SecurityPublisher and wraps it in a std::unique_ptr.
Definition: publisher-inl.h:219
Type
Identifies the codec to use for a given C++ message type.
Definition: serializer.h:154
constexpr bool is_supported(Type type) noexcept
Reports whether type identifies a usable codec.
Definition: serializer-inl.h:160
InitType
Selects between immediate and deferred node initialisation.
Definition: types.h:154
@ kWithInit
Initialise immediately in the constructor.
std::shared_ptr< IntraDataType > IntraData
Shared-ownership handle for an IntraDataType payload.
Definition: intra_data.h:112
ImplType
Bitmask identifying the role of a VLink node implementation.
Definition: types.h:110
@ kPublisher
Event publisher (one-to-many broadcast).
Definition: types.h:114
Common CRTP base for every VLink communication primitive.
Transport-neutral base class for every event-model publisher implementation.
static constexpr std::chrono::milliseconds kDefaultInterval
Default wait timeout: 5 seconds.
Definition: types.h:258