|
rlmm::singleton< Client, Lock > Struct Template Reference
[Utilities]
#include <rlmm/util.hh>
Inheritance diagram for rlmm::singleton< Client, Lock >:
[legend]Collaboration diagram for rlmm::singleton< Client, Lock >:
[legend]List of all members.
Detailed Description
template<template< typename > class Client, typename Lock = single_thread>
struct rlmm::singleton< Client, Lock >
Utility class to implement singletons.
Sub classes will be singletons. In sub classes, the constructor should preferable be protected (or even private) - which, however, requires that the sub-class befriends this class template: template <typename Lock>
class only : singleton<only,Lock>
{
template <template <typename> class C,typename L>
friend class singleton;
only() {}
only(const only& o) {}
only& operator=(const only& o) { return *this; }
...
};
- Parameters:
-
| Client | The sub class template |
| Lock | The lock type. |
Member Typedef Documentation
template<template< typename > class Client, typename Lock = single_thread> |
typedef Client<Lock> rlmm::singleton< Client, Lock >::client_type [protected] |
|
template<template< typename > class Client, typename Lock = single_thread> |
typedef guard<Lock> rlmm::singleton< Client, Lock >::guard_type [protected] |
|
template<template< typename > class Client, typename Lock = single_thread> |
typedef Lock rlmm::singleton< Client, Lock >::lock_type [protected] |
|
Constructor & Destructor Documentation
template<template< typename > class Client, typename Lock = single_thread> |
rlmm::singleton< Client, Lock >::singleton |
( |
|
) |
[inline, protected] |
|
template<template< typename > class Client, typename Lock = single_thread> |
rlmm::singleton< Client, Lock >::singleton |
( |
const singleton< Client, Lock > & |
o |
) |
[inline, protected] |
|
|
Protected copy constructor.
|
template<template< typename > class Client, typename Lock = single_thread> |
virtual rlmm::singleton< Client, Lock >::~singleton |
( |
|
) |
[inline, virtual] |
|
|
Destructor.
Removes the singleton. |
Member Function Documentation
template<template< typename > class Client, typename Lock = single_thread> |
static client_type& rlmm::singleton< Client, Lock >::instance |
( |
|
) |
[inline, static] |
|
|
- Returns:
- A reference to the singleton. Client code should only access the class using this static member function
|
template<template< typename > class Client, typename Lock = single_thread> |
singleton& rlmm::singleton< Client, Lock >::operator= |
( |
const singleton< Client, Lock > & |
o |
) |
[inline, protected] |
|
|
Protected assignment operator.
|
Member Data Documentation
template<template< typename > class Client, typename Lock = single_thread> |
Client< Lock > * rlmm::singleton< Client, Lock >::_instance = 0 [static, protected] |
|
template<template< typename > class Client, typename Lock = single_thread> |
Lock rlmm::singleton< Client, Lock >::_lock [static, protected] |
|
The documentation for this struct was generated from the following file:
Top of page
Last update Fri Aug 26 15:19:53 2005
Christian Holm
Created by DoxyGen 1.4.4
|