ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
Singleton< TDerivedClass > Class Template Reference


template<typename TDerivedClass>
class alib::singletons::Singleton< TDerivedClass >

This class implements the "singleton pattern" for C++ using a common templated approach. In case of Windows OS and DLL usage, the class overcomes the problem of having a global data segment per DLL in addition to the one associated with the process that is using the DLL.

All details about implementation and usage of this class is provided in the module's Programmer's Manual.

Template Parameters
TDerivedClassTemplate parameter that denotes the name of the class that implements the singleton.

Definition at line 50 of file singleton.hpp.

#include <singleton.hpp>

Inheritance diagram for Singleton< TDerivedClass >:

Public Static Method Index:

static TDerivedClass & GetSingleton ()

Public Method Index:

virtual ~Singleton ()

Field Details:

◆ singleton

template<typename TDerivedClass >
TDerivedClass * singleton = nullptr

A pointer to the one and only singleton.

Definition at line 54 of file singleton.hpp.

Constructor(s) / Destructor Details::

◆ ~Singleton()

template<typename TDerivedClass >
virtual ~Singleton ( )

Virtual destructor.

Definition at line 97 of file singleton.hpp.

Method Details:

◆ GetSingleton()

template<typename TDerivedClass >
static TDerivedClass & GetSingleton ( )

Creates (if not done, yet) and returns the singleton of type TDerivedClass .

The singleton instance.

Definition at line 61 of file singleton.hpp.

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