PicoScenes API Docs
 
Loading...
Searching...
No Matches
Singleton< T > Class Template Reference

A template class for creating singleton instances. More...

#include <Singleton.hxx>

Static Public Member Functions

template<typename... Args>
static T & getInstance (Args... args)
 Gets the singleton instance of the class.
 

Protected Member Functions

 Singleton ()
 Protected constructor to prevent direct instantiation.
 
 ~Singleton ()
 Protected destructor to prevent direct deletion.
 

Detailed Description

template<class T>
class Singleton< T >

A template class for creating singleton instances.

This class provides a mechanism to ensure that only one instance of a class is created. It is designed to be inherited by other classes that require singleton behavior.

Template Parameters
TThe type of the class to be made a singleton.

Definition at line 23 of file Singleton.hxx.

Constructor & Destructor Documentation

◆ Singleton()

template<class T >
Singleton< T >::Singleton ( )
protected

Protected constructor to prevent direct instantiation.

◆ ~Singleton()

template<class T >
Singleton< T >::~Singleton ( )
protected

Protected destructor to prevent direct deletion.

Member Function Documentation

◆ getInstance()

template<class T >
template<typename... Args>
static T & Singleton< T >::getInstance ( Args...  args)
inlinestatic

Gets the singleton instance of the class.

This method returns a reference to the singleton instance of the class. If the instance does not exist, it is created with the provided arguments.

Template Parameters
ArgsThe types of the arguments to pass to the constructor.
Parameters
argsThe arguments to pass to the constructor.
Returns
A reference to the singleton instance.

Definition at line 36 of file Singleton.hxx.

Referenced by AsyncPipeline< ObjectType >::startService().


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