SingletonInterface
Source locationmrx/core/SingletonInterface.hpp
Provides lazy singleton construction for service-style classes.
To use this helper, the target type T should:
- inherit from
SingletonInterface<T> - keep its constructors private to enforce singleton-only construction
- declare
friend class SingletonInterface<T>;so the helper can instantiate it
Service types are also expected to inherit QObject so they cooperate correctly with the Qt ownership and pointer patterns used throughout the SDK.
Template Parameters
Section titled “Template Parameters”TConcrete singleton service type managed by this helper.
Public Static Methods
Section titled “Public Static Methods”| Return | Name | Description |
|---|---|---|
T* | instance static inline | Returns the singleton instance for the concrete service type. |
static inline
instance
Section titled “instance”Source locationmrx/core/SingletonInterface.hpp
Returns the singleton instance for the concrete service type.
The instance is constructed on first use and then reused for the remainder of the process lifetime, subject to the lifetime semantics of the static shared pointer.
Returns
Section titled “Returns”Pointer to the shared singleton instance.
Protected Methods
Section titled “Protected Methods”| Return | Name | Description |
|---|---|---|
SingletonInterface inline explicit | Constructs the singleton base portion of the derived service type. |
inline explicit
SingletonInterface
Section titled “SingletonInterface”Source locationmrx/core/SingletonInterface.hpp
Constructs the singleton base portion of the derived service type.
The constructor is protected so only derived singleton service classes can create instances through SingletonInterface<T>.