Carna Version 3.3.3
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
Carna::base::Singleton< InstanceType > Class Template Reference

Singleton base class More...

#include <Singleton.h>

Public Types

typedef InstanceType Instance
 Denotes the class, that is derived from this class template.
 

Public Member Functions

virtual ~Singleton ()
 Denotes that the instance was deleted.
 

Static Public Member Functions

static InstanceTypeinstance ()
 Returns the only instance from class InstanceType.
 
static bool exists ()
 Tells whether the instance from class InstanceType currently exists.
 

Protected Member Functions

 Singleton ()
 Denotes that the instance was created. Default constructor is hidden.
 

Static Protected Member Functions

static void reset ()
 Deletes the only instance from class InstanceType.
 

Detailed Description

template<typename InstanceType>
class Carna::base::Singleton< InstanceType >

Singleton base class

Parameters
InstanceTypeNames the class, which derives from this class.

Example of usage:

class Config : public Carna::base::Singleton< Config >
{
protected:
Config();
};
Represents an association.
Definition Association.h:45
Singleton base class
Definition Singleton.h:60

If you do require a special implementation of the default constructor, than there is no need for the friend class declaration.

Author
Leonid Kostrykin
Date
2.3.11 - 16.3.15

Definition at line 59 of file Singleton.h.

Member Typedef Documentation

◆ Instance

Denotes the class, that is derived from this class template.

Definition at line 96 of file Singleton.h.

Constructor & Destructor Documentation

◆ Singleton()

template<typename InstanceType >
Carna::base::Singleton< InstanceType >::Singleton ( )
inlineprotected

Denotes that the instance was created. Default constructor is hidden.

Definition at line 74 of file Singleton.h.

◆ ~Singleton()

Denotes that the instance was deleted.

Definition at line 101 of file Singleton.h.

Member Function Documentation

◆ exists()

template<typename InstanceType >
static bool Carna::base::Singleton< InstanceType >::exists ( )
inlinestatic

Tells whether the instance from class InstanceType currently exists.

Definition at line 117 of file Singleton.h.

◆ instance()

template<typename InstanceType >
static InstanceType & Carna::base::Singleton< InstanceType >::instance ( )
inlinestatic

Returns the only instance from class InstanceType.

Definition at line 109 of file Singleton.h.

◆ reset()

template<typename InstanceType >
static void Carna::base::Singleton< InstanceType >::reset ( )
inlinestaticprotected

Deletes the only instance from class InstanceType.

Definition at line 83 of file Singleton.h.


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