|
VLink 2.0.0
A high-performance communication middleware
|
Per-topic registry of NodeImpl instances and their associated callbacks.
More...
#include <abstract_factory.h>
Public Types | |
| 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 Member Functions | |
| 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. | |
| NodeImpl * | get_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. | |
| Public Member Functions inherited from vlink::AbstractNode | |
| virtual std::any | get_native_handle () const |
Returns the underlying native transport handle wrapped in std::any. | |
Protected Member Functions | |
| AbstractObject () | |
| ~AbstractObject () override | |
| bool | has_called () const |
| void | ignore_called () |
| Protected Member Functions inherited from vlink::AbstractNode | |
| AbstractNode () | |
| virtual | ~AbstractNode () |
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.
| FilterT | Key type used by the owning AbstractFactory to look up this object (typically a topic URL string). |
| using vlink::AbstractObject< FilterT >::ConnectCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::ConnectCallback> |
Per-impl connect callbacks.
| using vlink::AbstractObject< FilterT >::FindConnectCallback |
Traversal visitor for connect callbacks.
| using vlink::AbstractObject< FilterT >::FindIntraMsgCallback |
Traversal visitor for intra-msg callbacks.
| using vlink::AbstractObject< FilterT >::FindMsgCallback |
Traversal visitor for message callbacks.
| using vlink::AbstractObject< FilterT >::FindReqRespCallback |
Traversal visitor for req/resp callbacks.
| using vlink::AbstractObject< FilterT >::FindStatusCallback |
Traversal visitor for status callbacks.
| using vlink::AbstractObject< FilterT >::ImplList = std::unordered_set<NodeImpl*> |
Set of registered impl pointers.
| using vlink::AbstractObject< FilterT >::IntraMsgCallbackMap |
Per-impl intra-msg callbacks.
| using vlink::AbstractObject< FilterT >::MsgCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::MsgCallback> |
Per-impl message callbacks.
| using vlink::AbstractObject< FilterT >::ReqRespCallbackMap |
Per-impl req/resp callbacks.
| using vlink::AbstractObject< FilterT >::StatusCallbackMap = std::unordered_map<NodeImpl*, NodeImpl::StatusCallback> |
Per-impl status callbacks.
|
inlineprotecteddefault |
|
inlineoverrideprotecteddefault |
|
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.
| impl | Non-owning pointer to the NodeImpl to register. |
true if impl was newly inserted; false if it was already present.
|
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.
NodeImpl, or nullptr.
|
inlinenodiscardprotected |
|
inlinenodiscard |
Returns true if at least one NodeImpl is currently registered.
true if the active implementation set is non-empty.
|
inlineprotected |
|
inlinenodiscard |
Returns true if impl is currently registered with this object.
| impl | Pointer to check. |
true if impl is in the active set; false otherwise.
|
inlinenodiscard |
Returns true if no message callbacks are registered.
true when the message callback map is empty.
|
inline |
Registers an in-process zero-copy message callback for impl.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable void(const IntraData&) invoked on each intra message. |
true if inserted; false if already registered.
|
inline |
Registers a serialised-message receive callback for impl.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable void(const Bytes&) invoked on each message. |
true if inserted; false if already registered.
|
inline |
Registers a request/response callback for impl.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable invoked for each incoming RPC request. |
true if inserted; false if already registered.
|
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.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable void(bool) invoked on client-presence changes. |
true if the callback was inserted; false if one was already registered for impl.
|
inline |
Registers a transport-status callback for impl.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable invoked on transport status changes. |
true if inserted; false if already registered.
|
inline |
Registers a subscriber-side connect-change callback for impl.
Stores the callback in the subscriber-connect map keyed by impl.
| impl | The NodeImpl this callback belongs to. |
| callback | Callable void(bool) invoked on subscriber-presence changes. |
true if the callback was inserted; false if already set.
|
inline |
|
inlinenodiscard |
Returns true if no request/response callbacks are registered.
true when the req/resp callback map is empty.
|
inlinenodiscard |
Returns true if no server-connect callbacks are registered.
true when the server-connect callback map is empty.
|
inlinenodiscard |
Returns true if no status callbacks are registered.
true when the status callback map is empty.
|
inlinenodiscard |
Returns true if no subscriber-connect callbacks are registered.
true when the subscriber-connect callback map is empty.
|
inline |
Invokes callback for each registered in-process message callback.
| callback | Visitor called for each intra-msg entry. |
|
inline |
Invokes callback for each registered serialised-message callback.
| callback | Visitor called for each message callback entry. |
|
inline |
Invokes callback for each registered request/response callback.
| callback | Visitor called for each req/resp entry. |
|
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.
| callback | Visitor called as callback(impl, stored_callback) for each entry. |
|
inline |
Invokes callback for each registered status callback.
| callback | Visitor called for each status entry. |
|
inline |
Invokes callback for each registered subscriber-connect callback.
| callback | Visitor called for each subscriber-connect entry. |