VLink  2.0.0
A high-performance communication middleware
vlink::SchemaPluginManager Class Referencefinal

Singleton accessor that owns a lazily loaded SchemaPluginInterface plugin. More...

#include <schema_plugin_manager.h>

Collaboration diagram for vlink::SchemaPluginManager:

Public Member Functions

bool is_valid () const
 Reports whether a plugin was successfully loaded. More...
 
std::shared_ptr< SchemaPluginInterfaceget_interface () const
 Returns the shared plugin instance, or nullptr when the manager is invalid. More...
 

Static Public Member Functions

static SchemaPluginManagerget (const std::string &schema_plugin_path="")
 Returns the process-wide manager, building it on the first call. More...
 

Detailed Description

Singleton accessor that owns a lazily loaded SchemaPluginInterface plugin.

Subsequent get() invocations are cheap and return the cached singleton regardless of the argument passed; the very first call wins. The destructor releases the contained interface before tearing down the Plugin loader, ensuring the shared object outlives any dependent global objects inside it.

Member Function Documentation

◆ get()

static SchemaPluginManager& vlink::SchemaPluginManager::get ( const std::string &  schema_plugin_path = "")
static

Returns the process-wide manager, building it on the first call.

Parameters
schema_plugin_pathAbsolute path to the plugin shared object. Empty means fall back to the VLINK_SCHEMA_PLUGIN environment variable.
Returns
Reference to the singleton instance.

◆ get_interface()

std::shared_ptr<SchemaPluginInterface> vlink::SchemaPluginManager::get_interface ( ) const

Returns the shared plugin instance, or nullptr when the manager is invalid.

Returns
Shared pointer to the loaded SchemaPluginInterface implementation.

◆ is_valid()

bool vlink::SchemaPluginManager::is_valid ( ) const

Reports whether a plugin was successfully loaded.

Returns
true when get_interface() will yield a non-null pointer.

The documentation for this class was generated from the following file: