Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::SingletonHolder< S > Class Template Reference

#include <SingletonHolder.h>

+ Collaboration diagram for Poco::SingletonHolder< S >:

Public Member Functions

 SingletonHolder ()
 
 ~SingletonHolder ()
 
S * get ()
 
void reset ()
 Deletes the singleton object.
 

Private Attributes

S * _pS
 
FastMutex _m
 

Detailed Description

template<class S>
class Poco::SingletonHolder< S >

This is a helper template class for managing singleton objects allocated on the heap. The class ensures proper deletion (including calling of the destructor) of singleton objects when the application that created them terminates.

Definition at line 29 of file SingletonHolder.h.

Constructor & Destructor Documentation

◆ SingletonHolder()

template<class S >
Poco::SingletonHolder< S >::SingletonHolder ( )
inline

Definition at line 37 of file SingletonHolder.h.

◆ ~SingletonHolder()

template<class S >
Poco::SingletonHolder< S >::~SingletonHolder ( )
inline

Destroys the SingletonHolder and the singleton object that it holds.

Definition at line 43 of file SingletonHolder.h.

Member Function Documentation

◆ get()

template<class S >
S * Poco::SingletonHolder< S >::get ( )
inline

Returns a pointer to the singleton object hold by the SingletonHolder. The first call to get will create the singleton.

Definition at line 50 of file SingletonHolder.h.

◆ reset()

template<class S >
void Poco::SingletonHolder< S >::reset ( )
inline

Deletes the singleton object.

Definition at line 60 of file SingletonHolder.h.

Member Data Documentation

◆ _m

template<class S >
FastMutex Poco::SingletonHolder< S >::_m
private

Definition at line 70 of file SingletonHolder.h.

◆ _pS

template<class S >
S* Poco::SingletonHolder< S >::_pS
private

Definition at line 69 of file SingletonHolder.h.


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