|
VLink
2.0.0
A high-performance communication middleware
|
Type-safe latest-value writer for the VLink field communication model. More...
#include <setter.h>
Public Types | |
| using | UniquePtr = std::unique_ptr< Setter< ValueT, SecT > > |
| Owning unique-pointer alias. More... | |
| using | SharedPtr = std::shared_ptr< Setter< ValueT, SecT > > |
| Owning shared-pointer alias. More... | |
Public Types inherited from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > | |
| using | StatusCallback = NodeImpl::StatusCallback |
| Handler signature for status-change notifications. More... | |
Public Member Functions | |
| template<typename ConfT , typename = std::enable_if_t<std::is_base_of_v<Conf, ConfT>>> | |
| Setter (const ConfT &conf, InitType type=InitType::kWithInit) | |
| Constructs a setter from a typed transport configuration object. More... | |
| Setter (const std::string &url_str, InitType type=InitType::kWithInit) | |
| Constructs a setter from a URL string. More... | |
| ~Setter () override | |
| Destroys the setter and drains in-flight transport callbacks. More... | |
| bool | init () override |
Initialises the setter and registers the late-getter sync() hook. More... | |
| bool | deinit () override |
| Deinitialises the setter and releases the underlying transport resources. More... | |
| void | set (const ValueT &value) |
Writes a new field value and emits it to every connected Getter. More... | |
| void | mark_as_publisher () |
Promotes this setter to behave as a Publisher at the transport layer. More... | |
Public Member Functions inherited from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > | |
| virtual void | interrupt () |
| Aborts any blocking wait on this node. More... | |
| bool | has_inited () const |
Reports whether init() has been successfully called. More... | |
| bool | is_support_loan () const |
| Reports whether the transport supports zero-copy loaned buffers. More... | |
| Bytes | loan (int64_t size) |
| Allocates a loaned buffer from the transport memory pool. More... | |
| bool | return_loan (const Bytes &bytes) |
| Returns a previously loaned buffer to the transport pool. More... | |
| virtual void | set_manual_unloan (bool manual_unloan) |
| Toggles manual-unloan mode for zero-copy receives. More... | |
| virtual bool | is_manual_unloan () const |
| Reports whether manual-unloan mode is currently active. More... | |
| bool | suspend () |
| Suspends message delivery on this node. More... | |
| bool | resume () |
Resumes message delivery after a prior suspend(). More... | |
| bool | is_suspend () const |
| Reports whether the node is currently suspended. More... | |
| bool | attach (class MessageLoop *message_loop) |
Attaches the node to a MessageLoop for callback dispatch. More... | |
| bool | detach () |
Detaches the node from its current MessageLoop. More... | |
| class MessageLoop * | get_message_loop () const |
Returns the MessageLoop this node is currently attached to. More... | |
| const AbstractNode * | get_abstract_node () const |
| Returns the abstract-graph handle for runtime topology inspection. More... | |
| Status::BasePtr | get_status (Status::Type type) const |
| Retrieves the current status object for the requested category. More... | |
| void | register_status_handler (StatusCallback &&callback) |
| Registers a handler invoked whenever the node's status changes. More... | |
| void | set_property (const std::string &prop, const std::string &value) |
| Sets a transport-specific string-keyed property. More... | |
| std::string | get_property (const std::string &prop) const |
| Retrieves a previously set transport-specific property value. More... | |
| TransportType | get_transport_type () const |
Returns the TransportType this node is bound to. More... | |
| const std::string & | get_url () const |
| Returns the URL string used to construct this node. More... | |
| void | set_record_path (const std::string &path) |
| Enables recording of inbound or outbound messages to a bag file. More... | |
| void | set_ser_type (const std::string &ser_type, SchemaType schema_type=SchemaType::kUnknown) |
| Overrides the runtime wire-metadata identifiers for this node. More... | |
| const std::string & | get_ser_type () const |
| Returns the current concrete runtime type identifier. More... | |
| SchemaType | get_schema_type () const |
| Returns the current coarse schema family. More... | |
| void | set_discovery_enabled (bool enable) |
| Toggles peer-discovery on this node. More... | |
| bool | get_discovery_enabled () const |
| Reports whether peer-discovery is currently enabled. More... | |
| void | bind_proto_arena (void *proto_arena) |
| Binds a Protobuf Arena for arena-allocated message objects. More... | |
| double | get_cpu_usage () const |
| Returns the cumulative CPU-usage ratio sampled by the profiler. More... | |
| bool | get_safety_quit () const |
| Reports whether safe-quit mode is currently active. More... | |
| void | set_safety_quit (bool safety_quit) |
| Enables or disables safe-quit mode. More... | |
| void | set_ssl_options (const SslOptions &options) |
| Configures transport-layer SSL/TLS encryption for this node. More... | |
Static Public Member Functions | |
| static UniquePtr | create_unique (const std::string &url_str, InitType type=InitType::kWithInit) |
Heap-allocates a Setter and wraps it in a std::unique_ptr. More... | |
| static SharedPtr | create_shared (const std::string &url_str, InitType type=InitType::kWithInit) |
Heap-allocates a Setter and wraps it in a std::shared_ptr. More... | |
Static Public Attributes | |
| static constexpr ImplType | kImplType = kSetter |
Node role tag (kSetter). More... | |
| static constexpr Serializer::Type | kValueType = Serializer::get_type_of<ValueT>() |
Codec resolved from ValueT. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > | |
| Node () | |
| virtual | ~Node () |
| bool | enable_security (const Security::Config &cfg) |
Installs a Security configuration before transport initialisation. More... | |
| bool | enable_security (Security::Config &&cfg) |
| Move overload for construction-time security installation. More... | |
| void | invoke_callback (const CallbackT &callback, ArgsT &&... args) |
| TypeT | get_default_value () |
Protected Attributes inherited from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > | |
| void * | proto_arena_ |
| bool | is_support_loan_ |
| bool | is_manual_unloan_ |
| std::atomic_bool | has_inited_ |
| std::optional< std::mutex > | quit_mtx_ |
| std::unique_ptr< SetterImpl > | impl_ |
Type-safe latest-value writer for the VLink field communication model.
Inherits the full Node API and adds field-specific operations: cached set(), automatic late-joiner sync via an internally registered sync() callback, and bridging hooks to behave as a plain publisher on transports that do not natively differentiate the two roles.
| ValueT | C++ value type. Must satisfy Serializer::is_supported(). |
| SecT | Security mode; defaults to SecurityType::kWithoutSecurity. |
| using vlink::Setter< ValueT, SecT >::SharedPtr = std::shared_ptr<Setter<ValueT, SecT> > |
Owning shared-pointer alias.
| using vlink::Setter< ValueT, SecT >::UniquePtr = std::unique_ptr<Setter<ValueT, SecT> > |
Owning unique-pointer alias.
|
inlineexplicit |
Constructs a setter from a typed transport configuration object.
Accepts any Conf-derived configuration. Following init() the setter registers a transport-level sync() callback that re-emits the cached value whenever a late Getter connects.
| ConfT | Concrete configuration type derived from Conf. |
| conf | Populated configuration aggregate. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
|
inlineexplicit |
Constructs a setter from a URL string.
| url_str | Field URL such as "dds://vehicle/gear". |
| type | Whether to call init() inline; default is InitType::kWithInit. |
|
inlineoverride |
|
inlinestatic |
Heap-allocates a Setter and wraps it in a std::shared_ptr.
| url_str | Field URL string. |
| type | Whether to call init() inline; default is InitType::kWithInit. |
SharedPtr to the new setter.
|
inlinestatic |
Heap-allocates a Setter and wraps it in a std::unique_ptr.
| url_str | Field URL such as "shm://vehicle/gear". |
| type | Whether to call init() inline; default is InitType::kWithInit. |
UniquePtr to the new setter.
|
inlineoverridevirtual |
Deinitialises the setter and releases the underlying transport resources.
Delegates to the base Node teardown path. After deinitialisation the setter no longer participates in sync() or writes until init() is called again.
true on first successful deinitialisation; false if not initialised. Reimplemented from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity >.
|
inlineoverridevirtual |
Initialises the setter and registers the late-getter sync() hook.
Calls the base Node initialisation, then installs a transport-level callback that resends the cached value whenever a new Getter joins after this setter has already been written.
true on first successful initialisation; false otherwise. Reimplemented from vlink::Node< SetterImpl, SecurityType::kWithoutSecurity >.
|
inline |
Promotes this setter to behave as a Publisher at the transport layer.
Switches impl_type from kSetter to kPublisher so that event-mode semantics are applied (no latest-value retention). Reinitialises the transport extension if called post-init(). Useful on transports that do not natively distinguish the two roles.
|
inline |
Writes a new field value and emits it to every connected Getter.
Caches value under mtx_, then serialises and writes it via the transport. When security is enabled the serialised payload is encrypted before transmission. The cached value is automatically re-emitted when a late Getter joins (see init()).
| value | New field value to publish. |
|
staticconstexpr |
Node role tag (kSetter).
|
staticconstexpr |
Codec resolved from ValueT.