|
VLink
2.0.0
A high-performance communication middleware
|
Transport-configuration base contract and the supporting boilerplate 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 for every transport-specific configuration aggregate. More... | |
Namespaces | |
| vlink | |
Macros | |
| #define | VLINK_DECLARE_CONF_FRIEND() |
| Macro Definitions. More... | |
| #define | VLINK_CONF_IMPL(classname) |
| Convenience macro that emits the standard concrete conf boilerplate. More... | |
| #define | VLINK_ALLOW_IMPL_TYPE(type) |
Records the bitmask of ImplType values supported by a conf. More... | |
| #define | VLINK_DECLARE_GLOBAL_PROPERTY() |
| Declares per-transport static configuration storage and access helpers. More... | |
| #define | VLINK_DEFINE_GLOBAL_PROPERTY(classname) |
Provides storage for the statics declared by VLINK_DECLARE_GLOBAL_PROPERTY. More... | |
Transport-configuration base contract and the supporting boilerplate macros.
This is an internal implementation header used by the public node templates and by every transport-specific *Conf class; user code should never include it directly. The Conf base struct is the bridge between the URL parsing layer and the concrete factories that produce NodeImpl instances. A typical node construction follows the chain Url -> concrete Conf -> Conf::create_xxx() -> NodeImpl subclass.
| Method | Default behaviour | Subclass responsibility |
|---|---|---|
parse(impl_type) | Caches impl_type; rejects kUnknown. | Validate transport-specific data. |
is_valid() | Returns false. | Report readiness for factories. |
get_impl_type() | Returns the cached value from parse(). | Usually inherited unchanged. |
get_transport_type() | Returns TransportType::kUnknown. | Return the backend identifier. |
parse_protocol(protocol) | Returns false. | Pull URL fields into the conf. |
create_publisher() / etc. | Returns nullptr. | Allocate the matching NodeImpl. |
| Macro | Purpose |
|---|---|
VLINK_DECLARE_CONF_FRIEND | Grants friend access to all six public Node<> templates. |
VLINK_CONF_IMPL(classname) | Bundles friend grant + standard override declarations + ostream op. |
VLINK_ALLOW_IMPL_TYPE(type) | Records which ImplType bits a conf may serve, for compile checks. |
VLINK_DECLARE_GLOBAL_PROPERTY | Declares static thread-count and global-property storage in a conf. |
VLINK_DEFINE_GLOBAL_PROPERTY | Provides the storage definitions for the declaration above. |
| #define VLINK_ALLOW_IMPL_TYPE | ( | type | ) |
Records the bitmask of ImplType values supported by a conf.
Expands to a public get_allow_impl_type() that returns type so the Node<> template can validate at compile time that the conf supports the requested node role. Combine roles with bitwise OR, e.g.
| type | Bitmask of ImplType values supported by the conf. |
| #define VLINK_CONF_IMPL | ( | classname | ) |
Convenience macro that emits the standard concrete conf boilerplate.
Expands to the friend grant, the six factory overrides, an ostream insertion operator declaration, the default constructor / destructor and an is_valid() override declaration whose body the subclass must provide.
| classname | Subclass name being declared. |
| #define VLINK_DECLARE_CONF_FRIEND | ( | ) |
Macro Definitions.
Grants the six public Node<> templates friend access to the conf.
Inject this macro into a concrete Conf subclass to expose the protected factory methods to Server, Client, Publisher, Subscriber, Setter and Getter. VLINK_CONF_IMPL already expands it; use this macro on its own only when VLINK_CONF_IMPL is not suitable.
| #define VLINK_DECLARE_GLOBAL_PROPERTY | ( | ) |
Declares per-transport static configuration storage and access helpers.
Inject into a concrete Conf subclass body to expose:
thread_count_, global_properties_ and global_mtx_ static members.get_thread_count() / set_thread_count() accessors.set_global_property() / get_global_property() / get_global_all_properties().global_init() declaration whose definition the subclass supplies.Pair with VLINK_DEFINE_GLOBAL_PROPERTY in the matching translation unit.
| #define VLINK_DEFINE_GLOBAL_PROPERTY | ( | classname | ) |
Provides storage for the statics declared by VLINK_DECLARE_GLOBAL_PROPERTY.
Place once in the .cc file of the matching subclass. Sets thread_count_ to 1, default-constructs the property map, and default-initialises the shared mutex.
| classname | Subclass that owns the static members. |