ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Static Methods | Public Methods | Protected Static Fields | List of all members
Singleton< TDerivedClass > Class Template Reference

#include <singleton.hpp>

Inheritance diagram for Singleton< TDerivedClass >:
[legend]

Class Description

template<typename TDerivedClass>
class aworx::lib::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 62 of file singleton.hpp.

Public Static Methods

static TDerivedClass & GetSingleton ()
 

Public Methods

virtual ~Singleton ()
 

Protected Static Fields

static TDerivedClass * singleton = nullptr
 

Constructor & Destructor Documentation

◆ ~Singleton()

virtual ~Singleton ( )
inlinevirtual

Virtual destructor.

Definition at line 109 of file singleton.hpp.

Member Function Documentation

◆ GetSingleton()

static TDerivedClass& GetSingleton ( )
inlinestatic

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

Returns
The singleton instance.

Definition at line 73 of file singleton.hpp.

Member Data Documentation

◆ singleton

TDerivedClass * singleton = nullptr
staticprotected

A pointer to the one and only singleton.

Definition at line 66 of file singleton.hpp.


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