VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
vlink::Setter< ValueT, SecT > 模板类 参考

Type-safe field writer for the VLink field communication model. 更多...

#include <setter.h>

类 vlink::Setter< ValueT, SecT > 继承关系图:
vlink::Setter< ValueT, SecT > 的协作图:

Public 类型

using UniquePtr = std::unique_ptr<Setter<ValueT, SecT>>
 Unique-pointer alias.
using SharedPtr = std::shared_ptr<Setter<ValueT, SecT>>
 Shared-pointer alias.

Public 成员函数

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.
 Setter (const std::string &url_str, InitType type=InitType::kWithInit)
 Constructs a setter from a URL string.
bool init () override
 Initializes the setter transport and registers the late-getter sync callback.
bool deinit () override
 Deinitializes the setter and releases the underlying transport resources.
void set (const ValueT &value)
 Writes a new field value and notifies all connected Getter nodes.
void mark_as_publisher ()
 Changes this setter's role to kPublisher (event-emitter).

静态 Public 成员函数

static UniquePtr create_unique (const std::string &url_str, InitType type=InitType::kWithInit)
 Creates a Setter on the heap wrapped in a unique_ptr.
static SharedPtr create_shared (const std::string &url_str, InitType type=InitType::kWithInit)
 Creates a Setter on the heap wrapped in a shared_ptr.

静态 Public 属性

static constexpr ImplType kImplType = kSetter
 Node role identifier (kSetter).
static constexpr Serializer::Type kValueType = Serializer::get_type_of<ValueT>()
 Serializer type resolved at compile time from ValueT.

额外继承的成员函数

详细描述

template<typename ValueT, SecurityType SecT = SecurityType::kWithoutSecurity>
class vlink::Setter< ValueT, SecT >

Type-safe field writer for the VLink field communication model.

模板参数
ValueTValue type to write.
SecTSecurity mode.

成员类型定义说明

◆ SharedPtr

template<typename ValueT, SecurityType SecT = SecurityType::kWithoutSecurity>
using vlink::Setter< ValueT, SecT >::SharedPtr = std::shared_ptr<Setter<ValueT, SecT>>

Shared-pointer alias.

◆ UniquePtr

template<typename ValueT, SecurityType SecT = SecurityType::kWithoutSecurity>
using vlink::Setter< ValueT, SecT >::UniquePtr = std::unique_ptr<Setter<ValueT, SecT>>

Unique-pointer alias.

构造及析构函数说明

◆ Setter() [1/2]

template<typename ValueT, SecurityType SecT>
template<typename ConfT, typename>
vlink::Setter< ValueT, SecT >::Setter ( const ConfT & conf,
InitType type = InitType::kWithInit )
inlineexplicit

Constructs a setter from a typed transport configuration object.

Accepts any Conf-derived configuration. After init(), registers an internal sync() callback with the transport so that when a late Getter connects the cached value is re-sent automatically.

模板参数
ConfTConf-derived configuration type.
参数
confPopulated configuration object.
typekWithInit to call init() immediately (default).
函数调用图:
这是这个函数的调用关系图:

◆ Setter() [2/2]

template<typename ValueT, SecurityType SecT>
vlink::Setter< ValueT, SecT >::Setter ( const std::string & url_str,
InitType type = InitType::kWithInit )
inlineexplicit

Constructs a setter from a URL string.

参数
url_strField URL (e.g. "dds://vehicle/gear").
typekWithInit to call init() immediately (default).
函数调用图:

成员函数说明

◆ create_shared()

template<typename ValueT, SecurityType SecT>
Setter< ValueT, SecT >::SharedPtr vlink::Setter< ValueT, SecT >::create_shared ( const std::string & url_str,
InitType type = InitType::kWithInit )
inlinestaticnodiscard

Creates a Setter on the heap wrapped in a shared_ptr.

参数
url_strField URL string.
typekWithInit to call init() immediately (default).
返回
SharedPtr owning the new setter.

◆ create_unique()

template<typename ValueT, SecurityType SecT>
Setter< ValueT, SecT >::UniquePtr vlink::Setter< ValueT, SecT >::create_unique ( const std::string & url_str,
InitType type = InitType::kWithInit )
inlinestaticnodiscard

Creates a Setter on the heap wrapped in a unique_ptr.

参数
url_strField URL string (e.g. "shm://vehicle/gear").
typekWithInit to call init() immediately (default).
返回
UniquePtr owning the new setter.

◆ deinit()

template<typename ValueT, SecurityType SecT>
bool vlink::Setter< ValueT, SecT >::deinit ( )
inlineoverridevirtual

Deinitializes the setter and releases the underlying transport resources.

Delegates to the base Node deinitialization path. After deinitialization, the setter stops participating in transport sync and write operations until it is initialized again.

返回
true on success, false if the underlying transport reports failure.

重载 vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > .

函数调用图:

◆ init()

template<typename ValueT, SecurityType SecT>
bool vlink::Setter< ValueT, SecT >::init ( )
inlineoverridevirtual

Initializes the setter transport and registers the late-getter sync callback.

Calls the base Node initialization, then installs a transport sync() callback that re-sends the cached latest value when a new Getter joins after this setter has already been written to.

返回
true on success, false if transport initialization fails.

重载 vlink::Node< SetterImpl, SecurityType::kWithoutSecurity > .

函数调用图:
这是这个函数的调用关系图:

◆ mark_as_publisher()

template<typename ValueT, SecurityType SecT>
void vlink::Setter< ValueT, SecT >::mark_as_publisher ( )
inline

Changes this setter's role to kPublisher (event-emitter).

Updates impl_->impl_type from kSetter to kPublisher so that event-model transport semantics are applied (no last-value retention). If called after init(), the extension is automatically reinitialised. Used when a Setter should behave as a plain publisher on transports that do not natively distinguish the two roles.

◆ set()

template<typename ValueT, SecurityType SecT>
void vlink::Setter< ValueT, SecT >::set ( const ValueT & value)
inline

Writes a new field value and notifies all connected Getter nodes.

Caches value internally (guarded by mutex), then serializes and writes it to the transport. If security is enabled the serialized bytes are encrypted before transmission. The cached value is automatically re-sent when a late Getter connects.

参数
valueThe new field value to write.

类成员变量说明

◆ kImplType

template<typename ValueT, SecurityType SecT = SecurityType::kWithoutSecurity>
ImplType vlink::Setter< ValueT, SecT >::kImplType = kSetter
staticconstexpr

Node role identifier (kSetter).

◆ kValueType

template<typename ValueT, SecurityType SecT = SecurityType::kWithoutSecurity>
Serializer::Type vlink::Setter< ValueT, SecT >::kValueType = Serializer::get_type_of<ValueT>()
staticconstexpr

Serializer type resolved at compile time from ValueT.


该类的文档由以下文件生成: