retdec
Public Member Functions | Static Public Member Functions | List of all members
retdec::llvmir2hll::Singleton< T > Class Template Reference

Implementation of the Singleton design pattern. More...

#include <singleton.h>

Public Member Functions

 Singleton ()=delete
 
 Singleton (const Singleton &)=delete
 
 ~Singleton ()=delete
 
Singletonoperator= (const Singleton &)=delete
 

Static Public Member Functions

static T & getInstance ()
 Returns the instance of the object being held. More...
 

Detailed Description

template<class T>
class retdec::llvmir2hll::Singleton< T >

Implementation of the Singleton design pattern.

This template is especially suited to be used to make object factories singletons. For example, the following code snippet shows how to define a singleton factory:

using FactoryWriter = Singleton<
Factory<
// Type of the basic product.
Writer,
// Type of the object's identifier.
std::string
>
>;
Template Parameters
TClass with only a single instance. It needs to have a public constructor.

Constructor & Destructor Documentation

◆ Singleton() [1/2]

template<class T >
retdec::llvmir2hll::Singleton< T >::Singleton ( )
delete

◆ Singleton() [2/2]

template<class T >
retdec::llvmir2hll::Singleton< T >::Singleton ( const Singleton< T > &  )
delete

◆ ~Singleton()

template<class T >
retdec::llvmir2hll::Singleton< T >::~Singleton ( )
delete

Member Function Documentation

◆ getInstance()

template<class T >
static T& retdec::llvmir2hll::Singleton< T >::getInstance ( )
inlinestatic

Returns the instance of the object being held.

This function always returns a reference to the same object. The object is created upon the first call of this function.

◆ operator=()

template<class T >
Singleton& retdec::llvmir2hll::Singleton< T >::operator= ( const Singleton< T > &  )
delete

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