SMTK
@SMTK_VERSION@
Simulation Modeling Tool Kit
|
plugin::Clients are static objects that live in a plugin. More...
#include <Client.h>
Static Public Member Functions | |
static std::shared_ptr< ClientBase > | create () |
Additional Inherited Members | |
Public Member Functions inherited from smtk::plugin::detail::Client< Registrar, Manager > | |
bool | registerPluginTo (const std::shared_ptr< Manager > &) override |
bool | unregisterPluginFrom (const std::shared_ptr< Manager > &) override |
Public Member Functions inherited from smtk::plugin::detail::Client< Registrar, T > | |
bool | registerPluginTo (const std::shared_ptr< T > &) override |
bool | unregisterPluginFrom (const std::shared_ptr< T > &) override |
plugin::Clients are static objects that live in a plugin.
Their lifetime is therefore confined to the lifetime to the plugin's own scope. Upon creation, a Client adds a weak pointer to itself to the singleton PluginManager. The PluginManager has an API for registering/unregistering Managers to/from each of its available Clients. When a Manager is registered to a Client, a Registry object is created; it tethers the manager instance's extensions imbued by the plugin to its own lifetime. These registry objects are held by the Client, guaranteeing that they go out of scope when the Client goes out of scope.
A Client is a composition of detail::Clients, one for each Manager the plugin can augment. To facilitate the registration of managers to a Client without explicitly referring to the plugin's Registrar, the Manager-specific API is separated from the implementation that uses the Registrar to perform the actual registration.
Both gcc and clang are savvy to template class descriptions using parameter packs. MSVC isn't quite there yet. The following code is bifurcated according to compiler type because, even though the two code paths produce functionally equivalent code, the first implementation does so with much less compile-time (and library size) overhead. Eventually, only the first implementation should be used.