Implements the mechanism for the weak singleton pattern. More...
#include <WeakSingleton.h>
Public Types | |
| using | key_t = std::tuple< std::string, std::weak_ptr< Object >, Object * > |
Public Member Functions | |
| std::list< WeakSingleton< Profiler >::key_t > | m_register |
Static Public Member Functions | |
| template<typename... T> | |
| static std::shared_ptr< Object > | single (const std::string &key, T &&... constructor_args) |
| Creates an instance of Object or returns an already registered instance. More... | |
| static std::shared_ptr< Object > | single () |
| Access the last registered object. More... | |
| static void | erase (Object *obj) |
| Remove object from the register. This should be called in the destructor of class that exposes this pattern. More... | |
| static void | erase (const std::string &key) |
| Remove object registered under the name key. More... | |
| static void | clear () |
| Remove all registered objects. More... | |
Static Public Attributes | |
| static std::list< key_t > | m_register |
| stores all objects created by a call to single More... | |
Implements the mechanism for the weak singleton pattern.
| using molpro::profiler::WeakSingleton< Object >::key_t = std::tuple<std::string, std::weak_ptr<Object>, Object*> |
|
inlinestatic |
Remove all registered objects.
|
inlinestatic |
Remove object registered under the name key.
|
inlinestatic |
Remove object from the register. This should be called in the destructor of class that exposes this pattern.
| std::list< WeakSingleton< Profiler >::key_t > molpro::profiler::WeakSingleton< Profiler >::m_register |
|
inlinestatic |
Access the last registered object.
|
inlinestatic |
Creates an instance of Object or returns an already registered instance.
| constructor_args | arguments that should be passed to the constructor |
|
static |
stores all objects created by a call to single