template class Poco::SingletonHolder

Overview

This is a helper template class for managing singleton objects allocated on the heap. Moreā€¦

#include <SingletonHolder.h>

template <class S>
class SingletonHolder
{
public:
    // methods

    S*
    get();

    void
    reset();
};

Detailed Documentation

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.

Construction

~SingletonHolder()

Destroys the SingletonHolder and the singleton object that it holds.

Methods

S*
get()

Returns a pointer to the singleton object hold by the SingletonHolder.

The first call to get will create the singleton.

void
reset()

Deletes the singleton object.