VLink  2.0.0
A high-performance communication middleware
vlink::NodeImpl类 参考abstract

Backbone of every transport-specific VLink node implementation. 更多...

#include <node_impl.h>

类 vlink::NodeImpl 继承关系图:
vlink::NodeImpl 的协作图:

Public 类型

using ConnectCallback = Function< void(bool)>
 Callback fired when peer presence changes. 更多...
 
using StatusCallback = Function< void(const Status::BasePtr &ptr)>
 Callback fired on DDS-family status notifications (e.g. deadline missed). 更多...
 
using SyncCallback = Function< void()>
 Callback fired when a SetterImpl completes a late-getter sync. 更多...
 
using ReqRespCallback = Function< void(uint64_t, const Bytes &, Bytes *)>
 Request / response handler installed by ServerImpl::listen(). 更多...
 
using MsgCallback = Function< void(const Bytes &)>
 Callback delivering a serialised payload to a subscriber or getter. 更多...
 
using IntraMsgCallback = Function< void(const IntraData &)>
 Callback delivering an in-process payload to an intra:// subscriber. 更多...
 

Public 成员函数

virtual void init ()=0
 Brings the underlying transport channel online. 更多...
 
virtual void deinit ()=0
 Tears the underlying transport channel down. 更多...
 
virtual bool suspend ()
 Pauses message delivery without releasing the channel. 更多...
 
virtual bool resume ()
 Resumes message delivery after suspend(). 更多...
 
virtual bool is_suspend () const
 Reports whether the node is currently suspended. 更多...
 
virtual void interrupt ()
 Marks the node interrupted and wakes blocking operations. 更多...
 
virtual bool is_support_loan () const
 Indicates whether zero-copy loaning is available on this backend. 更多...
 
virtual Bytes loan (int64_t size)
 Borrows a write buffer of size bytes from the transport. 更多...
 
virtual bool return_loan (const Bytes &bytes)
 Returns a previously loaned buffer to the transport. 更多...
 
virtual void set_manual_unloan (bool manual_unloan)
 Toggles automatic versus manual release of received loaned buffers. 更多...
 
virtual const struct Confget_conf () const
 Returns the associated transport Conf, or nullptr in the base. 更多...
 
virtual const AbstractNodeget_abstract_node () const
 Returns the companion AbstractNode, when the impl is split. 更多...
 
virtual Status::BasePtr get_status (Status::Type type) const
 Retrieves a transport-specific status object. 更多...
 
virtual bool check_version (const Version &version)
 Compares version with the runtime VLink library version. 更多...
 
virtual bool attach (class MessageLoop *message_loop)
 Attaches the node to a MessageLoop for callback dispatch. 更多...
 
virtual bool detach ()
 Detaches the node from its MessageLoop. 更多...
 
class MessageLoopget_message_loop () const
 Returns the currently attached MessageLoop. 更多...
 
template<typename T >
const T * get_target_conf () const
 Convenience downcast wrapper around get_conf(). 更多...
 
void register_status_handler (StatusCallback &&callback)
 Installs a DDS-family status handler. 更多...
 
bool has_register_status () const
 Reports whether a status handler has been registered. 更多...
 
void call_status (Status::BasePtr ptr)
 Delivers a status notification to the registered handler. 更多...
 
void set_property (const std::string &prop, const std::string &value)
 Sets a named property on this node. 更多...
 
std::string get_property (const std::string &prop) const
 Retrieves the value of a named property. 更多...
 
Conf::PropertiesMap get_all_properties () const
 Returns a copy of every property currently set on this node. 更多...
 
void set_discovery_enabled (bool enable)
 Toggles whether this node is reported to the discovery layer. 更多...
 
bool get_discovery_enabled () const
 Returns the current discovery-reporting flag. 更多...
 
void set_record_path (const std::string &path)
 Configures per-node message recording. 更多...
 
bool enable_security (const Security::Config &cfg)
 Installs application-layer security from a const-reference config. 更多...
 
bool enable_security (Security::Config &&cfg)
 Installs application-layer security by consuming cfg. 更多...
 
void set_ssl_options (const SslOptions &options)
 Merges SSL options into the node property map. 更多...
 
void try_record (ActionType action_type, const Bytes &data)
 Records a message to the global and / or per-node bag writers. 更多...
 
void reset_interrupted ()
 Clears the interrupted flag set by interrupt(). 更多...
 
bool is_interrupted () const
 Reports whether interrupt() has been called and not yet reset. 更多...
 
void init_ext ()
 Registers the node with the runtime-owned discovery reporter. 更多...
 
void deinit_ext ()
 Deregisters the node from the runtime-owned discovery reporter. 更多...
 

静态 Public 成员函数

static void global_init ()
 Initialises process-wide VLink singletons. 更多...
 

Public 属性

std::string url
 Full URL string of the node, e.g. "dds://my/topic". 更多...
 
std::string ser_type
 Concrete serialisation type tag (e.g. "demo.proto.PointCloud"). 更多...
 
ImplType impl_type {kUnknownImplType}
 Role of this implementation node. 更多...
 
SchemaType schema_type {SchemaType::kUnknown}
 Coarse schema family reported to discovery and bag / proxy paths. 更多...
 
TransportType transport_type {TransportType::kUnknown}
 Transport backend identifier for this node. 更多...
 
bool is_cdr_type {false}
 true when DDS native CDR serialisation is in use. 更多...
 
bool is_security_type {false}
 true when an authenticated transport is enabled. 更多...
 
bool is_discovery_enabled {true}
 Whether the node is reported to the discovery layer. 更多...
 
std::atomic_bool has_suspend {false}
 Atomic suspend flag (currently unused by the default impls). 更多...
 
std::unique_ptr< CpuProfilerprofiler
 Optional per-node CPU profiler activated under global profiling. 更多...
 
std::unique_ptr< Securitysecurity
 Installed per-node message-security context, or nullptr. 更多...
 

Protected 成员函数

 NodeImpl (ImplType type)
 
virtual ~NodeImpl ()
 

详细描述

Backbone of every transport-specific VLink node implementation.

Every concrete transport backend ultimately derives from NodeImpl. The class centralises lifecycle, instrumentation and observability so that subclass authors only need to focus on transport mechanics. The contract table at file scope summarises which knobs the base owns and which require a transport override.

注解
suspend() and resume() are optional capabilities; the base implementation logs a warning and returns false so that backends lacking the operation can be detected gracefully.
register_status_handler() and call_status() are only meaningful on DDS-family transports (kDds, kDdsc, kDdsr, kDdst); other backends log a warning and treat them as no-ops.

成员类型定义说明

◆ ConnectCallback

Callback fired when peer presence changes.

The boolean argument is true when the peer becomes reachable and false when it disappears.

◆ IntraMsgCallback

Callback delivering an in-process payload to an intra:// subscriber.

IntraData is a shared_ptr to the payload type, so no copy occurs as the callback is dispatched.

◆ MsgCallback

Callback delivering a serialised payload to a subscriber or getter.

参数
bytesPayload bytes; lifetime is scoped to the callback.

◆ ReqRespCallback

using vlink::NodeImpl::ReqRespCallback = Function<void(uint64_t, const Bytes&, Bytes*)>

Request / response handler installed by ServerImpl::listen().

Parameters are (req_id, request_bytes, response_bytes_ptr). The handler writes the response into *response_bytes_ptr; when the pointer is nullptr the server is running in fire-and-forget mode.

◆ StatusCallback

Callback fired on DDS-family status notifications (e.g. deadline missed).

参数
ptrPolymorphic status object; downcast to the concrete subtype.

◆ SyncCallback

Callback fired when a SetterImpl completes a late-getter sync.

构造及析构函数说明

◆ NodeImpl()

vlink::NodeImpl::NodeImpl ( ImplType  type)
explicitprotected

◆ ~NodeImpl()

virtual vlink::NodeImpl::~NodeImpl ( )
protectedvirtual

成员函数说明

◆ attach()

virtual bool vlink::NodeImpl::attach ( class MessageLoop message_loop)
virtual

Attaches the node to a MessageLoop for callback dispatch.

Records message_loop atomically; subsequent call_status() posts onto the loop thread. When another non-null loop is already attached the call is rejected. Passing nullptr does not establish a usable binding even though it may succeed when the node was already detached.

参数
message_loopLoop to bind to.
返回
true when the pointer was stored; false on conflict.

◆ call_status()

void vlink::NodeImpl::call_status ( Status::BasePtr  ptr)

Delivers a status notification to the registered handler.

Posts the call onto the attached MessageLoop when one exists; otherwise invokes the handler synchronously.

参数
ptrStatus object to forward.

◆ check_version()

virtual bool vlink::NodeImpl::check_version ( const Version version)
virtual

Compares version with the runtime VLink library version.

Logs a warning (once per process) on the first mismatch. Version checks are advisory and do not block node creation.

参数
versionCompile-time version constants embedded by the caller.
返回
true when the versions agree.

◆ deinit()

virtual void vlink::NodeImpl::deinit ( )
pure virtual

Tears the underlying transport channel down.

Called by the Node<> template destructor; releases all transport-owned resources.

◆ deinit_ext()

void vlink::NodeImpl::deinit_ext ( )

Deregisters the node from the runtime-owned discovery reporter.

Mirrors init_ext(); called after deinit() to release the discovery entry and restart the global profiler if it had been paused.

◆ detach()

virtual bool vlink::NodeImpl::detach ( )
virtual

Detaches the node from its MessageLoop.

Clears the cached pointer and, when called from a thread different from the loop, blocks until the previous loop becomes idle so no callback is still in flight on return.

返回
true on success; false if no loop was attached.

◆ enable_security() [1/2]

bool vlink::NodeImpl::enable_security ( const Security::Config cfg)

Installs application-layer security from a const-reference config.

Performs the wire-metadata validation and AAD-context plumbing, then forwards a fully prepared Security::Config into a Security instance stored in security. Unsupported transports return false without installing anything.

参数
cfgSecurity configuration supplied by the public node wrapper.
返回
true once a usable Security instance is installed.

◆ enable_security() [2/2]

bool vlink::NodeImpl::enable_security ( Security::Config &&  cfg)

Installs application-layer security by consuming cfg.

Same validation path as the const-reference overload, but avoids copying callback targets and key material when the caller owns the config. The AAD context may be filled before the config is moved into Security.

参数
cfgSecurity configuration to consume.
返回
true once a usable Security instance is installed.

◆ get_abstract_node()

virtual const AbstractNode* vlink::NodeImpl::get_abstract_node ( ) const
virtual

Returns the companion AbstractNode, when the impl is split.

返回
Pointer to the abstract node, or nullptr.

◆ get_all_properties()

Conf::PropertiesMap vlink::NodeImpl::get_all_properties ( ) const

Returns a copy of every property currently set on this node.

返回
Snapshot of the internal PropertiesMap.

◆ get_conf()

virtual const struct Conf* vlink::NodeImpl::get_conf ( ) const
virtual

Returns the associated transport Conf, or nullptr in the base.

Concrete backends override the method to expose their typed Conf so the public node templates can resolve transport-specific options.

返回
Pointer to the owning Conf.
这是这个函数的调用关系图:

◆ get_discovery_enabled()

bool vlink::NodeImpl::get_discovery_enabled ( ) const

Returns the current discovery-reporting flag.

返回
true when the node will be visible to discovery.

◆ get_message_loop()

class MessageLoop* vlink::NodeImpl::get_message_loop ( ) const

Returns the currently attached MessageLoop.

返回
Loop pointer or nullptr when none is bound.

◆ get_property()

std::string vlink::NodeImpl::get_property ( const std::string &  prop) const

Retrieves the value of a named property.

参数
propProperty key.
返回
Value, or empty string when no entry exists.

◆ get_status()

virtual Status::BasePtr vlink::NodeImpl::get_status ( Status::Type  type) const
virtual

Retrieves a transport-specific status object.

Only meaningful on DDS-family transports; the base logs a warning and returns Status::Unknown.

参数
typeRequested status category.
返回
Polymorphic status object; never nullptr.

◆ get_target_conf()

template<typename T >
const T * vlink::NodeImpl::get_target_conf
inline

Convenience downcast wrapper around get_conf().

Details

模板参数
TExpected concrete Conf subclass.
返回
Typed pointer; nullptr when get_conf() returns nullptr.
函数调用图:

◆ global_init()

static void vlink::NodeImpl::global_init ( )
static

Initialises process-wide VLink singletons.

Brings the logger, memory pool, and global bag writer online, and prepares the runtime-owned discovery reporter holder without starting the reporter until a discoverable node is registered. Safe to call multiple times; only the first call has an effect. The base constructor invokes this automatically.

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

◆ has_register_status()

bool vlink::NodeImpl::has_register_status ( ) const

Reports whether a status handler has been registered.

返回
true when a non-null status handler exists.

◆ init()

virtual void vlink::NodeImpl::init ( )
pure virtual

Brings the underlying transport channel online.

Called by the public Node<> template after properties have been wired in. Backends create their DDS entities, shared-memory channels or any other resources here.

◆ init_ext()

void vlink::NodeImpl::init_ext ( )

Registers the node with the runtime-owned discovery reporter.

Invoked at the end of init() by every public Node<> template. Also starts the per-node CpuProfiler when global profiling is enabled. Skips registration for CDR, security, and (by default) intra nodes.

◆ interrupt()

virtual void vlink::NodeImpl::interrupt ( )
virtual

Marks the node interrupted and wakes blocking operations.

Sets the internal interrupted flag and is overridden by subclasses to signal additional condition variables (e.g. wait_for_subscribers()). Pair with reset_interrupted() before reusing blocking helpers.

vlink::PublisherImpl , 以及 vlink::ClientImpl 重载.

◆ is_interrupted()

bool vlink::NodeImpl::is_interrupted ( ) const

Reports whether interrupt() has been called and not yet reset.

返回
true when the interrupted flag is set.

◆ is_support_loan()

virtual bool vlink::NodeImpl::is_support_loan ( ) const
virtual

Indicates whether zero-copy loaning is available on this backend.

返回
true when loan() / return_loan() can be used.

◆ is_suspend()

virtual bool vlink::NodeImpl::is_suspend ( ) const
virtual

Reports whether the node is currently suspended.

Default implementation logs a warning and returns false. Override alongside suspend() / resume() when relevant.

返回
true when the node is paused.

◆ loan()

virtual Bytes vlink::NodeImpl::loan ( int64_t  size)
virtual

Borrows a write buffer of size bytes from the transport.

Backends that support zero-copy override this method to return a Bytes view onto pre-allocated transport memory. The default returns an empty Bytes.

参数
sizeRequested buffer size in bytes.
返回
Borrowed Bytes; empty when loaning is unsupported or failed.

◆ register_status_handler()

void vlink::NodeImpl::register_status_handler ( StatusCallback &&  callback)

Installs a DDS-family status handler.

No-op on non-DDS transports. When a MessageLoop is attached the callback is invoked on the loop thread.

参数
callbackHandler invoked for each status notification.

◆ reset_interrupted()

void vlink::NodeImpl::reset_interrupted ( )

Clears the interrupted flag set by interrupt().

Required before re-running a blocking helper such as wait_for_subscribers() after a prior interruption.

◆ resume()

virtual bool vlink::NodeImpl::resume ( )
virtual

Resumes message delivery after suspend().

Default no-op returns false. Override in backends that support suspension.

返回
true on success; false otherwise.

◆ return_loan()

virtual bool vlink::NodeImpl::return_loan ( const Bytes bytes)
virtual

Returns a previously loaned buffer to the transport.

Must be called whenever loan() succeeded but the caller decided not to publish (for example because serialisation failed).

参数
bytesBuffer previously obtained via loan().
返回
true on success; false when loaning is unsupported.

◆ set_discovery_enabled()

void vlink::NodeImpl::set_discovery_enabled ( bool  enable)

Toggles whether this node is reported to the discovery layer.

Must be called before init_ext(). Disabling discovery hides the node from DiscoveryReporter / DiscoveryViewer; the proxy implementation uses this to keep its internal channels off topology views.

参数
enabletrue to report to discovery (default); false to hide.

◆ set_manual_unloan()

virtual void vlink::NodeImpl::set_manual_unloan ( bool  manual_unloan)
virtual

Toggles automatic versus manual release of received loaned buffers.

With manual_unloan set to true the backend does not release loaned buffers after callback dispatch; the application must call return_loan() itself.

参数
manual_unloantrue for manual release; false for automatic.

◆ set_property()

void vlink::NodeImpl::set_property ( const std::string &  prop,
const std::string &  value 
)

Sets a named property on this node.

Properties are key / value strings consumed during init(). The underlying map is guarded by a shared mutex for thread safety.

参数
propProperty key.
valueProperty value.

◆ set_record_path()

void vlink::NodeImpl::set_record_path ( const std::string &  path)

Configures per-node message recording.

A non-empty path acquires (or shares) a BagWriter so that subsequent try_record() calls capture frames. An empty path turns recording off.

参数
pathFile path; empty or unsupported suffix disables recording.

◆ set_ssl_options()

void vlink::NodeImpl::set_ssl_options ( const SslOptions options)

Merges SSL options into the node property map.

Acquires the helper mutex and delegates to SslOptions::parse_to() so the transport factory reads the resulting ssl.* entries during connection setup.

参数
optionsSSL / TLS configuration to merge.
参见
SslOptions::parse_to(), Node::set_ssl_options()

◆ suspend()

virtual bool vlink::NodeImpl::suspend ( )
virtual

Pauses message delivery without releasing the channel.

The base implementation logs a warning and returns false. Only a few backends implement true suspension; others should leave the default.

返回
true on success; false when the operation is unsupported.

◆ try_record()

void vlink::NodeImpl::try_record ( ActionType  action_type,
const Bytes data 
)

Records a message to the global and / or per-node bag writers.

Skips DDS CDR payloads and (when the ignore-intra filter is on) intra messages. Used by every node role to feed BagWriter pipelines.

参数
action_typeLogical role under which the message is being recorded.
dataRaw serialised payload bytes.

类成员变量说明

◆ has_suspend

std::atomic_bool vlink::NodeImpl::has_suspend {false}

Atomic suspend flag (currently unused by the default impls).

◆ impl_type

ImplType vlink::NodeImpl::impl_type {kUnknownImplType}

Role of this implementation node.

◆ is_cdr_type

bool vlink::NodeImpl::is_cdr_type {false}

true when DDS native CDR serialisation is in use.

◆ is_discovery_enabled

bool vlink::NodeImpl::is_discovery_enabled {true}

Whether the node is reported to the discovery layer.

◆ is_security_type

bool vlink::NodeImpl::is_security_type {false}

true when an authenticated transport is enabled.

◆ profiler

std::unique_ptr<CpuProfiler> vlink::NodeImpl::profiler

Optional per-node CPU profiler activated under global profiling.

◆ schema_type

SchemaType vlink::NodeImpl::schema_type {SchemaType::kUnknown}

Coarse schema family reported to discovery and bag / proxy paths.

◆ security

std::unique_ptr<Security> vlink::NodeImpl::security

Installed per-node message-security context, or nullptr.

◆ ser_type

std::string vlink::NodeImpl::ser_type

Concrete serialisation type tag (e.g. "demo.proto.PointCloud").

◆ transport_type

TransportType vlink::NodeImpl::transport_type {TransportType::kUnknown}

Transport backend identifier for this node.

◆ url

std::string vlink::NodeImpl::url

Full URL string of the node, e.g. "dds://my/topic".


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