PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
PSingleton< Type, GuardType > Class Template Reference

Template class for a simple singleton object. More...

`#include <object.h>`

Inheritance diagram for PSingleton< Type, GuardType >:
[legend]

## Public Member Functions
| PSingleton ()
Type * | operator-> () const
Type & | operator* () const

## Protected Attributes
Type * | m_instance

## Detailed Description

### template<class Type, typename GuardType = unsigned>
class PSingleton< Type, GuardType >

Template class for a simple singleton object.

     Usage is typically like:

            typedef PSingleton<MyClass> MySingleton;
            MySingleton()->DoSomething();

Default is not thread safe, however the following is:

            typedef PSingleton<MyClass, PAtomicInteger> MySafeSingleton;
            MySafeSingleton()->DoSomething();

## Constructor & Destructor Documentation

template<class Type, typename GuardType = unsigned>

PSingleton< Type, GuardType >::PSingleton | ( |  | ) |
| inline

## Member Function Documentation

template<class Type, typename GuardType = unsigned>

Type& PSingleton< Type, GuardType >::operator* | ( |  | ) | const
| inline

template<class Type, typename GuardType = unsigned>

Type* PSingleton< Type, GuardType >::operator-> | ( |  | ) | const
| inline

## Member Data Documentation

template<class Type, typename GuardType = unsigned>

Type* PSingleton< Type, GuardType >::m_instance
| protected

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

- object.h