soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SSingleton< T > Class Template Reference

Singleton Template. More...

#include <SSingleton.h>

Public Member Functions

 SSingleton (void)
 Constructor for SSingleton.
 
virtual ~SSingleton (void)
 Destructor for SSingleton.
 

Static Public Member Functions

static T & getSingleton (void)
 Gets the singleton instance.
 
static T * getSingletonPtr (void)
 Gets the pointer to the singleton instance.
 

Static Protected Attributes

static T * ms_Singleton
 Static pointer to the singleton instance.
 

Detailed Description

template<typename T>
class SSingleton< T >

Singleton Template.

Description: Implements the Singleton design pattern, ensuring that a class has only one instance and providing a global point of access to it.

Template Parameters
TType of the class that will be made a singleton.

Definition at line 30 of file SSingleton.h.

Constructor & Destructor Documentation

◆ SSingleton()

template<typename T>
SSingleton< T >::SSingleton ( void )
inline

Constructor for SSingleton.

Note
Asserts that no instance already exists.

Definition at line 42 of file SSingleton.h.

◆ ~SSingleton()

template<typename T>
virtual SSingleton< T >::~SSingleton ( void )
inlinevirtual

Destructor for SSingleton.

Note
Asserts that an instance exists and sets the singleton pointer to null.

Definition at line 52 of file SSingleton.h.

Member Function Documentation

◆ getSingleton()

template<typename T>
static T & SSingleton< T >::getSingleton ( void )
inlinestatic

Gets the singleton instance.

Returns
Reference to the singleton instance.
Note
Asserts that the singleton instance exists.

Definition at line 63 of file SSingleton.h.

◆ getSingletonPtr()

template<typename T>
static T * SSingleton< T >::getSingletonPtr ( void )
inlinestatic

Gets the pointer to the singleton instance.

Returns
Pointer to the singleton instance.

Definition at line 73 of file SSingleton.h.

Member Data Documentation

◆ ms_Singleton

template<typename T>
T* SSingleton< T >::ms_Singleton
staticprotected

Static pointer to the singleton instance.

Definition at line 35 of file SSingleton.h.


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