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

Per-topic registry of NodeImpl instances and their associated callbacks. 更多...

#include <abstract_factory.h>

类 vlink::AbstractObject< FilterT > 继承关系图:
vlink::AbstractObject< FilterT > 的协作图:

Public 类型

using ImplList = std::unordered_set<NodeImpl*>
 Set of registered impl pointers.
using ConnectCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::ConnectCallback>
 Per-impl connect callbacks.
using ReqRespCallbackMap
 Per-impl req/resp callbacks.
using MsgCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::MsgCallback>
 Per-impl message callbacks.
using IntraMsgCallbackMap
 Per-impl intra-msg callbacks.
using StatusCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::StatusCallback>
 Per-impl status callbacks.
using FindConnectCallback
 Traversal visitor for connect callbacks.
using FindReqRespCallback
 Traversal visitor for req/resp callbacks.
using FindMsgCallback
 Traversal visitor for message callbacks.
using FindIntraMsgCallback
 Traversal visitor for intra-msg callbacks.
using FindStatusCallback
 Traversal visitor for status callbacks.

Public 成员函数

bool add_impl (NodeImpl *impl)
 Registers a NodeImpl instance with this topic object.
bool remove_impl (NodeImpl *impl)
 Unregisters a NodeImpl instance and removes all its callbacks.
NodeImplget_first_impl () const
 Returns the most recently added NodeImpl pointer.
bool is_contains_impl (NodeImpl *impl) const
 Returns true if impl is currently registered with this object.
bool has_impl () const
 Returns true if at least one NodeImpl is currently registered.
bool register_server_connect_callback (NodeImpl *impl, NodeImpl::ConnectCallback &&callback)
 Registers a server-side connect-change callback for impl.
bool register_sub_connect_callback (NodeImpl *impl, NodeImpl::ConnectCallback &&callback)
 Registers a subscriber-side connect-change callback for impl.
bool register_req_resp_callback (NodeImpl *impl, NodeImpl::ReqRespCallback &&callback)
 Registers a request/response callback for impl.
bool register_msg_callback (NodeImpl *impl, NodeImpl::MsgCallback &&callback)
 Registers a serialised-message receive callback for impl.
bool register_intra_msg_callback (NodeImpl *impl, NodeImpl::IntraMsgCallback &&callback)
 Registers an in-process zero-copy message callback for impl.
bool register_status_callback (NodeImpl *impl, NodeImpl::StatusCallback &&callback)
 Registers a transport-status callback for impl.
bool server_connect_map_is_empty () const
 Returns true if no server-connect callbacks are registered.
bool sub_connect_map_is_empty () const
 Returns true if no subscriber-connect callbacks are registered.
bool req_resp_map_is_empty () const
 Returns true if no request/response callbacks are registered.
bool msg_map_is_empty () const
 Returns true if no message callbacks are registered.
bool status_map_is_empty () const
 Returns true if no status callbacks are registered.
void traverse_server_connect_callback (const FindConnectCallback &callback)
 Invokes callback for each registered server-connect callback.
void traverse_sub_connect_callback (const FindConnectCallback &callback)
 Invokes callback for each registered subscriber-connect callback.
void traverse_req_resp_callback (const FindReqRespCallback &callback)
 Invokes callback for each registered request/response callback.
void traverse_msg_callback (const FindMsgCallback &callback)
 Invokes callback for each registered serialised-message callback.
void traverse_intra_msg_callback (const FindIntraMsgCallback &callback)
 Invokes callback for each registered in-process message callback.
void traverse_status_callback (const FindStatusCallback &callback)
 Invokes callback for each registered status callback.

Protected 成员函数

 AbstractObject ()
 ~AbstractObject () override
bool has_called () const
void ignore_called ()

详细描述

template<typename FilterT>
class vlink::AbstractObject< FilterT >

Per-topic registry of NodeImpl instances and their associated callbacks.

Maintains an unordered set of active NodeImpl* pointers and six separate callback maps (server-connect, subscriber-connect, req/resp, msg, intra-msg, status). All mutations and traversals are protected by a std::recursive_mutex to allow safe use from multiple threads.

模板参数
FilterTKey type used by the owning AbstractFactory to look up this object (typically a topic URL string).

成员类型定义说明

◆ ConnectCallbackMap

template<typename FilterT>
using vlink::AbstractObject< FilterT >::ConnectCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::ConnectCallback>

Per-impl connect callbacks.

◆ FindConnectCallback

template<typename FilterT>
using vlink::AbstractObject< FilterT >::FindConnectCallback
初始值:
std::function<void(NodeImpl*, const NodeImpl::ConnectCallback&)>

Traversal visitor for connect callbacks.

◆ FindIntraMsgCallback

template<typename FilterT>
using vlink::AbstractObject< FilterT >::FindIntraMsgCallback
初始值:
std::function<void(

Traversal visitor for intra-msg callbacks.

◆ FindMsgCallback

template<typename FilterT>
using vlink::AbstractObject< FilterT >::FindMsgCallback
初始值:
std::function<void(NodeImpl*, const NodeImpl::MsgCallback&)>

Traversal visitor for message callbacks.

◆ FindReqRespCallback

template<typename FilterT>
using vlink::AbstractObject< FilterT >::FindReqRespCallback
初始值:
std::function<void(NodeImpl*, const NodeImpl::ReqRespCallback&)>

Traversal visitor for req/resp callbacks.

◆ FindStatusCallback

template<typename FilterT>
using vlink::AbstractObject< FilterT >::FindStatusCallback
初始值:
std::function<void(NodeImpl*, const NodeImpl::StatusCallback&)>

Traversal visitor for status callbacks.

◆ ImplList

template<typename FilterT>
using vlink::AbstractObject< FilterT >::ImplList = std::unordered_set<NodeImpl*>

Set of registered impl pointers.

◆ IntraMsgCallbackMap

template<typename FilterT>
using vlink::AbstractObject< FilterT >::IntraMsgCallbackMap
初始值:
std::unordered_map<NodeImpl*, NodeImpl::IntraMsgCallback>

Per-impl intra-msg callbacks.

◆ MsgCallbackMap

template<typename FilterT>
using vlink::AbstractObject< FilterT >::MsgCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::MsgCallback>

Per-impl message callbacks.

◆ ReqRespCallbackMap

template<typename FilterT>
using vlink::AbstractObject< FilterT >::ReqRespCallbackMap
初始值:
std::unordered_map<NodeImpl*, NodeImpl::ReqRespCallback>

Per-impl req/resp callbacks.

◆ StatusCallbackMap

template<typename FilterT>
using vlink::AbstractObject< FilterT >::StatusCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::StatusCallback>

Per-impl status callbacks.

构造及析构函数说明

◆ AbstractObject()

template<typename FilterT>
vlink::AbstractObject< FilterT >::AbstractObject ( )
inlineprotecteddefault

◆ ~AbstractObject()

template<typename FilterT>
vlink::AbstractObject< FilterT >::~AbstractObject ( )
inlineoverrideprotecteddefault

成员函数说明

◆ add_impl()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::add_impl ( NodeImpl * impl)
inline

Registers a NodeImpl instance with this topic object.

Details

Inserts impl into the active implementation set and updates the cached first_impl_ pointer. Thread-safe.

参数
implNon-owning pointer to the NodeImpl to register.
返回
true if impl was newly inserted; false if it was already present.

◆ get_first_impl()

template<typename FilterT>
NodeImpl * vlink::AbstractObject< FilterT >::get_first_impl ( ) const
nodiscard

Returns the most recently added NodeImpl pointer.

The "first" impl is set to the last value passed to add_impl(). If the current first impl is removed via remove_impl(), it is reassigned to an arbitrary remaining impl, or nullptr if the set is empty.

返回
Pointer to the most recently registered NodeImpl, or nullptr.

◆ has_called()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::has_called ( ) const
inlinenodiscardprotected

◆ has_impl()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::has_impl ( ) const
inlinenodiscard

Returns true if at least one NodeImpl is currently registered.

返回
true if the active implementation set is non-empty.

◆ ignore_called()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::ignore_called ( )
inlineprotected

◆ is_contains_impl()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::is_contains_impl ( NodeImpl * impl) const
inlinenodiscard

Returns true if impl is currently registered with this object.

参数
implPointer to check.
返回
true if impl is in the active set; false otherwise.

◆ msg_map_is_empty()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::msg_map_is_empty ( ) const
inlinenodiscard

Returns true if no message callbacks are registered.

返回
true when the message callback map is empty.

◆ register_intra_msg_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_intra_msg_callback ( NodeImpl * impl,
NodeImpl::IntraMsgCallback && callback )
inline

Registers an in-process zero-copy message callback for impl.

参数
implThe NodeImpl this callback belongs to.
callbackCallable void(const IntraData&) invoked on each intra message.
返回
true if inserted; false if already registered.

◆ register_msg_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_msg_callback ( NodeImpl * impl,
NodeImpl::MsgCallback && callback )
inline

Registers a serialised-message receive callback for impl.

参数
implThe NodeImpl this callback belongs to.
callbackCallable void(const Bytes&) invoked on each message.
返回
true if inserted; false if already registered.

◆ register_req_resp_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_req_resp_callback ( NodeImpl * impl,
NodeImpl::ReqRespCallback && callback )
inline

Registers a request/response callback for impl.

参数
implThe NodeImpl this callback belongs to.
callbackCallable invoked for each incoming RPC request.
返回
true if inserted; false if already registered.

◆ register_server_connect_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_server_connect_callback ( NodeImpl * impl,
NodeImpl::ConnectCallback && callback )
inline

Registers a server-side connect-change callback for impl.

Stores the callback in the server-connect map keyed by impl. A subsequent call to traverse_server_connect_callback() will invoke this callback.

参数
implThe NodeImpl this callback belongs to.
callbackCallable void(bool) invoked on client-presence changes.
返回
true if the callback was inserted; false if one was already registered for impl.

◆ register_status_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_status_callback ( NodeImpl * impl,
NodeImpl::StatusCallback && callback )
inline

Registers a transport-status callback for impl.

参数
implThe NodeImpl this callback belongs to.
callbackCallable invoked on transport status changes.
返回
true if inserted; false if already registered.

◆ register_sub_connect_callback()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::register_sub_connect_callback ( NodeImpl * impl,
NodeImpl::ConnectCallback && callback )
inline

Registers a subscriber-side connect-change callback for impl.

Stores the callback in the subscriber-connect map keyed by impl.

参数
implThe NodeImpl this callback belongs to.
callbackCallable void(bool) invoked on subscriber-presence changes.
返回
true if the callback was inserted; false if already set.

◆ remove_impl()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::remove_impl ( NodeImpl * impl)
inline

Unregisters a NodeImpl instance and removes all its callbacks.

Erases impl from the active set and removes its entries from all six callback maps. Thread-safe.

参数
implNon-owning pointer to the NodeImpl to unregister.
返回
true if impl was found and removed; false otherwise.

◆ req_resp_map_is_empty()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::req_resp_map_is_empty ( ) const
inlinenodiscard

Returns true if no request/response callbacks are registered.

返回
true when the req/resp callback map is empty.

◆ server_connect_map_is_empty()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::server_connect_map_is_empty ( ) const
inlinenodiscard

Returns true if no server-connect callbacks are registered.

返回
true when the server-connect callback map is empty.

◆ status_map_is_empty()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::status_map_is_empty ( ) const
inlinenodiscard

Returns true if no status callbacks are registered.

返回
true when the status callback map is empty.

◆ sub_connect_map_is_empty()

template<typename FilterT>
bool vlink::AbstractObject< FilterT >::sub_connect_map_is_empty ( ) const
inlinenodiscard

Returns true if no subscriber-connect callbacks are registered.

返回
true when the subscriber-connect callback map is empty.

◆ traverse_intra_msg_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_intra_msg_callback ( const FindIntraMsgCallback & callback)
inline

Invokes callback for each registered in-process message callback.

参数
callbackVisitor called for each intra-msg entry.

◆ traverse_msg_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_msg_callback ( const FindMsgCallback & callback)
inline

Invokes callback for each registered serialised-message callback.

参数
callbackVisitor called for each message callback entry.

◆ traverse_req_resp_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_req_resp_callback ( const FindReqRespCallback & callback)
inline

Invokes callback for each registered request/response callback.

参数
callbackVisitor called for each req/resp entry.

◆ traverse_server_connect_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_server_connect_callback ( const FindConnectCallback & callback)
inline

Invokes callback for each registered server-connect callback.

Iterates over all entries in the server-connect map while holding the mutex. The visitor receives the NodeImpl* and the stored ConnectCallback. Iteration can be short-circuited by calling ignore_called() inside the visitor.

参数
callbackVisitor called as callback(impl, stored_callback) for each entry.

◆ traverse_status_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_status_callback ( const FindStatusCallback & callback)
inline

Invokes callback for each registered status callback.

参数
callbackVisitor called for each status entry.

◆ traverse_sub_connect_callback()

template<typename FilterT>
void vlink::AbstractObject< FilterT >::traverse_sub_connect_callback ( const FindConnectCallback & callback)
inline

Invokes callback for each registered subscriber-connect callback.

参数
callbackVisitor called for each subscriber-connect entry.

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