Mbed OS Reference
|
Utility class for creating and using a singleton. More...
#include <SingletonPtr.h>
Public Member Functions | |
T * | get () const |
Get a pointer to the underlying singleton. More... | |
T * | operator-> () const |
Get a pointer to the underlying singleton. More... | |
T & | operator* () const |
Get a reference to the underlying singleton. More... | |
T * | get_no_init () const |
Get a pointer to the underlying singleton. More... | |
void | destroy () |
Destroy the underlying singleton. More... | |
Utility class for creating and using a singleton.
Definition at line 88 of file SingletonPtr.h.
T * get | ( | ) | const |
Get a pointer to the underlying singleton.
Definition at line 101 of file SingletonPtr.h.
T * operator-> | ( | ) | const |
Get a pointer to the underlying singleton.
Definition at line 124 of file SingletonPtr.h.
T & operator* | ( | ) | const |
Get a reference to the underlying singleton.
Definition at line 134 of file SingletonPtr.h.
T * get_no_init | ( | ) | const |
Get a pointer to the underlying singleton.
Gets a pointer without initialization - can be used as an optimization when it is known that initialization must have already occurred.
Definition at line 149 of file SingletonPtr.h.
void destroy | ( | ) |
Destroy the underlying singleton.
The underlying singleton is never automatically destroyed; this is a potential optimization to avoid destructors being pulled into an embedded image on the exit path, which should never occur. The destructor can be manually invoked via this call.
Unlike construction, this is not thread-safe. After this call, no further operations on the object are permitted.
Is a no-op if the object has not been constructed.
Definition at line 167 of file SingletonPtr.h.