57#include <shared_mutex>
151 [[nodiscard]]
virtual std::unique_ptr<class ServerImpl>
create_server()
const;
153 [[nodiscard]]
virtual std::unique_ptr<class ClientImpl>
create_client()
const;
159 [[nodiscard]]
virtual std::unique_ptr<class SetterImpl>
create_setter()
const;
161 [[nodiscard]]
virtual std::unique_ptr<class GetterImpl>
create_getter()
const;
165 template <
typename,
typename, SecurityType>
167 template <
typename,
typename, SecurityType>
169 template <
typename, SecurityType>
171 template <
typename, SecurityType>
173 template <
typename, SecurityType>
175 template <
typename, SecurityType>
199#define VLINK_DECLARE_CONF_FRIEND() \
200 template <typename, typename, SecurityType> \
201 friend class Server; \
202 template <typename, typename, SecurityType> \
203 friend class Client; \
204 template <typename, SecurityType> \
205 friend class Publisher; \
206 template <typename, SecurityType> \
207 friend class Subscriber; \
208 template <typename, SecurityType> \
209 friend class Setter; \
210 template <typename, SecurityType> \
227#define VLINK_CONF_IMPL(classname) \
229 VLINK_DECLARE_CONF_FRIEND() \
231 [[nodiscard]] bool parse_protocol(struct Protocol* protocol) override; \
233 [[nodiscard]] std::unique_ptr<class ServerImpl> create_server() const override; \
235 [[nodiscard]] std::unique_ptr<class ClientImpl> create_client() const override; \
237 [[nodiscard]] std::unique_ptr<class PublisherImpl> create_publisher() const override; \
239 [[nodiscard]] std::unique_ptr<class SubscriberImpl> create_subscriber() const override; \
241 [[nodiscard]] std::unique_ptr<class SetterImpl> create_setter() const override; \
243 [[nodiscard]] std::unique_ptr<class GetterImpl> create_getter() const override; \
245 VLINK_EXPORT friend std::ostream& operator<<(std::ostream& ostream, const classname& conf) noexcept; \
248 classname() = default; \
250 ~classname() = default; \
252 [[nodiscard]] bool is_valid() const override;
268#define VLINK_ALLOW_IMPL_TYPE(type) \
270 [[nodiscard]] static constexpr int get_allow_impl_type() { return type; }
292#define VLINK_DECLARE_GLOBAL_PROPERTY() \
294 static size_t thread_count_; \
295 static PropertiesMap global_properties_; \
296 static std::shared_mutex global_mtx_; \
299 [[nodiscard]] static size_t get_thread_count() { return thread_count_; } \
301 static void set_thread_count(size_t thread_count) { thread_count_ = thread_count; } \
303 static void set_global_property(const std::string& prop, const std::string& value) { \
304 std::lock_guard lock(global_mtx_); \
305 global_properties_[prop] = value; \
308 [[nodiscard]] static std::string get_global_property(const std::string& prop) { \
309 std::shared_lock lock(global_mtx_); \
310 auto iter = global_properties_.find(prop); \
311 return iter != global_properties_.end() ? iter->second : std::string(); \
314 [[nodiscard]] static PropertiesMap get_global_all_properties() { \
315 std::shared_lock lock(global_mtx_); \
316 return global_properties_; \
319 static void global_init();
332#define VLINK_DEFINE_GLOBAL_PROPERTY(classname) \
333 size_t classname::thread_count_{1}; \
334 Conf::PropertiesMap classname::global_properties_; \
335 std::shared_mutex classname::global_mtx_;
Platform-independent macro definitions for the VLink library.
#define VLINK_EXPORT
Definition macros.h:85
TransportType
Enumeration of all supported transport backends.
Definition types.h:107
ImplType
Bitmask identifying the role of a VLink node implementation.
Definition types.h:89
@ kUnknownImplType
Type not yet determined.
Definition types.h:90
virtual ImplType get_impl_type() const
Returns the most recently parsed ImplType.
friend class Server
Definition conf.h:166
virtual bool parse_protocol(struct Protocol *protocol)
friend class Subscriber
Definition conf.h:172
friend struct Url
Definition conf.h:164
virtual std::unique_ptr< class GetterImpl > create_getter() const
uint32_t hash_code
Hash of the URL string; used for fast URL lookup in caches.
Definition conf.h:144
virtual std::unique_ptr< class PublisherImpl > create_publisher() const
std::map< std::string, std::string > PropertiesMap
Key/value property map type.
Definition conf.h:92
virtual std::unique_ptr< class SetterImpl > create_setter() const
virtual bool parse(ImplType impl_type) const
Validates the conf for the given node role and caches the type.
virtual bool is_valid() const
Returns true when the configuration holds valid, usable data.
virtual TransportType get_transport_type() const
Returns the transport backend this configuration represents.
virtual std::unique_ptr< class ServerImpl > create_server() const
virtual std::unique_ptr< class ClientImpl > create_client() const
virtual std::unique_ptr< class SubscriberImpl > create_subscriber() const
virtual ~Conf()
Virtual destructor.
friend class Getter
Definition conf.h:176
friend class Client
Definition conf.h:168
friend class Setter
Definition conf.h:174
friend class Publisher
Definition conf.h:170
Parsed URL components used to select and configure a transport Conf.
Definition url.h:121
Core type definitions shared across all VLink node implementations.