Embedded Template Library 1.0

Classes

class  etl::singleton< TObject >
 Creates . More...
 

Detailed Description

Templated version of the singleton pattern.


Class Documentation

◆ etl::singleton

class etl::singleton
template<typename TObject>
class etl::singleton< TObject >

Creates .

Singleton pattern base class.

Public Types

typedef T type
 

Static Public Member Functions

static TObject & get_instance ()
 
static void create ()
 Constructs the instance of the singleton type.
 
template<typename T1 >
static void create (const T1 &p1)
 
template<typename T1 , typename T2 >
static void create (const T1 &p1, const T2 &p2)
 
template<typename T1 , typename T2 , typename T3 >
static void create (const T1 &p1, const T2 &p2, const T3 &p3)
 
template<typename T1 , typename T2 , typename T3 , typename T4 >
static void create (const T1 &p1, const T2 &p2, const T3 &p3, const T4 &p4)
 
static void destroy ()
 Destructs the instance of the singleton type.
 
static T & instance ()
 
static bool is_valid ()
 Checks the validity of the singleton.
 

Static Protected Attributes

static TObject * p_instance
 

Member Function Documentation

◆ create() [1/4]

template<typename TObject >
template<typename T1 >
static void etl::singleton< TObject >::create ( const T1 &  p1)
inlinestatic

Constructs the instance of the singleton type. 1 parameter.

◆ create() [2/4]

template<typename TObject >
template<typename T1 , typename T2 >
static void etl::singleton< TObject >::create ( const T1 &  p1,
const T2 &  p2 
)
inlinestatic

Constructs the instance of the singleton type. 2 parameters.

◆ create() [3/4]

template<typename TObject >
template<typename T1 , typename T2 , typename T3 >
static void etl::singleton< TObject >::create ( const T1 &  p1,
const T2 &  p2,
const T3 &  p3 
)
inlinestatic

Constructs the instance of the singleton type. 3 parameters.

◆ create() [4/4]

template<typename TObject >
template<typename T1 , typename T2 , typename T3 , typename T4 >
static void etl::singleton< TObject >::create ( const T1 &  p1,
const T2 &  p2,
const T3 &  p3,
const T4 &  p4 
)
inlinestatic

Constructs the instance of the singleton type. 4 parameters.

◆ instance()

template<typename TObject >
static T & etl::singleton< TObject >::instance ( )
inlinestatic

Returns a reference to the instance. Asserts an etl::singleton_not_created if create has not been called.

Returns
A reference to the instance.