libpsynth 0.2.1
Public Types | Static Public Member Functions
psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy > Class Template Reference

This is a generic singleton implementation. More...

#include <singleton.hpp>

Inheritance diagram for psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy >:
Inheritance graph
[legend]
Collaboration diagram for psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef T type

Static Public Member Functions

static T & self ()
 Access the singleton only instance.

Detailed Description

template<class T, template< class > class CreationPolicy = create_with_new, template< class > class LifetimePolicy = lifetime_atexit, template< class > class ThreadingPolicy = PSYNTH_DEFAULT_NONOBJ_THREADING>
class psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy >

This is a generic singleton implementation.

Note that you should not usually inherit from it but rather just typedef with T as desired implementation of the singleton class. It can be parametrized with varied policies:

Parameters:
CreationPolicySpecifies the allocation policy to use.
LifetimePolicySpecifies the order of singleton creation and other related issues
ThreadingPolicyWether you want the implementation to be thread-safe or not.

Member Typedef Documentation

template<class T, template< class > class CreationPolicy = create_with_new, template< class > class LifetimePolicy = lifetime_atexit, template< class > class ThreadingPolicy = PSYNTH_DEFAULT_NONOBJ_THREADING>
typedef T psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy >::type

Member Function Documentation

template<class T, template< class > class CreationPolicy = create_with_new, template< class > class LifetimePolicy = lifetime_atexit, template< class > class ThreadingPolicy = PSYNTH_DEFAULT_NONOBJ_THREADING>
static T& psynth::base::singleton_holder< T, CreationPolicy, LifetimePolicy, ThreadingPolicy >::self ( ) [static]

Access the singleton only instance.

Returns:
The singleton instance.

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