|
VLink 2.0.0
A high-performance communication middleware
|
Abstract transport configuration base class and associated helper macros. More...
#include <map>#include <memory>#include <shared_mutex>#include <string>#include <utility>#include "../base/macros.h"#include "./types.h"Go to the source code of this file.
Classes | |
| struct | vlink::Conf |
| Abstract base class for VLink transport configuration objects. More... | |
Namespaces | |
| namespace | vlink |
Macros | |
| #define | VLINK_DECLARE_CONF_FRIEND() |
| Macro Definitions. | |
| #define | VLINK_CONF_IMPL(classname) |
Standard boilerplate for concrete Conf subclass declarations. | |
| #define | VLINK_ALLOW_IMPL_TYPE(type) |
Declares a static constexpr bitmask of supported ImplType values. | |
| #define | VLINK_DECLARE_GLOBAL_PROPERTY() |
| Declares per-transport global state: thread count and property storage. | |
| #define | VLINK_DEFINE_GLOBAL_PROPERTY(classname) |
Provides definitions for the static members declared by VLINK_DECLARE_GLOBAL_PROPERTY. | |
Abstract transport configuration base class and associated helper macros.
Conf is the pure-virtual base for every transport backend configuration object (e.g. DdsConf, ShmConf, IntraConf). It acts as a bridge between the URL parsing layer and the concrete NodeImpl factories:
Url object parses the transport from the URL string and constructs the corresponding Conf subclass.Publisher<T> / Subscriber<T> / etc. calls init(), the node template calls Conf::parse(impl_type) followed by Conf::create_publisher() / create_subscriber() / etc. to obtain a transport-specific NodeImpl instance.NodeImpl carries out the actual IPC/DDS/SHM operations.Conf subclasses:| Macro | Purpose |
|---|---|
| VLINK_DECLARE_CONF_FRIEND() | Grants friendship to all six Node<> template specialisations. |
| VLINK_CONF_IMPL(classname) | Declares the private Conf interface inside a concrete class. |
| VLINK_ALLOW_IMPL_TYPE(type) | Declares which ImplType bitmask the Conf supports. |
| VLINK_DECLARE_GLOBAL_PROPERTY() | Declares per-class thread count and global property storage. |
| VLINK_DEFINE_GLOBAL_PROPERTY() | Defines the static members declared by the above macro. |
| #define VLINK_ALLOW_IMPL_TYPE | ( | type | ) |
Declares a static constexpr bitmask of supported ImplType values.
Expands to a public get_allow_impl_type() that returns type, allowing the Node<> template to assert at compile time that the conf supports the requested node role. Use bitwise-OR to combine multiple roles, e.g.:
| type | Bitmask of ImplType values this conf supports. |
| #define VLINK_CONF_IMPL | ( | classname | ) |
Standard boilerplate for concrete Conf subclass declarations.
Adds to the class:
VLINK_DECLARE_CONF_FRIEND() – friend access for Node<> templates.Conf factory methods.operator<<(ostream, classname) for debug printing.bool is_valid() const override – subclass must define the body.| classname | The name of the concrete Conf subclass. |
| #define VLINK_DECLARE_CONF_FRIEND | ( | ) |
Macro Definitions.
Declares all six VLink Node template specialisations as friends.
Placed inside a concrete Conf subclass declaration to allow Server<>, Client<>, Publisher<>, Subscriber<>, Setter<>, and Getter<> to access the protected create_*() factory methods and parse_protocol(). Use VLINK_CONF_IMPL(classname) which already expands this macro; only include this macro directly when you need friend access without the full VLINK_CONF_IMPL boilerplate.
| #define VLINK_DECLARE_GLOBAL_PROPERTY | ( | ) |
Declares per-transport global state: thread count and property storage.
Intended for use inside a concrete Conf subclass body. Declares:
thread_count_ – number of I/O threads for this transport.global_properties_ – default properties applied to every node of this transport.global_mtx_ – shared mutex protecting global_properties_.Also injects:
get_thread_count() – retrieve current thread count.set_thread_count() – set thread count (must be called before global_init()).set_global_property(prop, value) – set a default property for all nodes.get_global_property(prop) – retrieve a default property.get_global_all_properties() – retrieve a snapshot of all properties.global_init() declaration – must be defined by the subclass.Pair with VLINK_DEFINE_GLOBAL_PROPERTY(classname) in the .cc file.
| #define VLINK_DEFINE_GLOBAL_PROPERTY | ( | classname | ) |
Provides definitions for the static members declared by VLINK_DECLARE_GLOBAL_PROPERTY.
Place once in the .cc file of the corresponding Conf subclass. Initialises thread_count_ to 1, global_properties_ to an empty map, and default-constructs global_mtx_.
| classname | The name of the concrete Conf subclass. |