Wt::Singleton< DERIVED > Class Template Reference

#include <singleton.h>

Inherited by Wt::Application, Wt::Audio, Wt::SDLDisplay, Wt::SDLEvent, and Wt::SDLInput.

List of all members.

Static Public Member Functions

static DERIVED * instance ()
static DERIVED * existingInstance ()
template<class GRANDCHILD>
static DERIVED * instance ()
 instantiates the pointer compatible child of DERIVED aka grandchild
static void init ()
static void quit ()

Protected Member Functions

 Singleton (DERIVED *d)
 Derived class public constructor.
 ~Singleton ()

Static Protected Member Functions

static DERIVED * load ()
 try to load the instance

Static Protected Attributes

static DERIVED * instance_ = 0

Classes

class  Exception

template<class DERIVED>
class Wt::Singleton< DERIVED >


Constructor & Destructor Documentation

template<class DERIVED>
Wt::Singleton< DERIVED >::Singleton ( DERIVED *  d  )  [inline, protected]

Derived class public constructor.

if the constructor of the derived class is public we have to call this constructor to properly set the instance

template<class DERIVED>
Wt::Singleton< DERIVED >::~Singleton (  )  [inline, protected]


Member Function Documentation

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::existingInstance (  )  [inline, static]

template<class DERIVED>
static void Wt::Singleton< DERIVED >::init (  )  [inline, static]

Note:
cannot fail

template<class DERIVED>
template<class GRANDCHILD>
static DERIVED* Wt::Singleton< DERIVED >::instance (  )  [inline, static]

instantiates the pointer compatible child of DERIVED aka grandchild

it is handy in driver like situations

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::instance (  )  [inline, static]

template<class DERIVED>
static DERIVED* Wt::Singleton< DERIVED >::load (  )  [inline, static, protected]

try to load the instance

if it fails return NULL if it succeeds must return the newly created object

Reimplemented in Wt::Audio, Wt::NullAudio, and Wt::SDLMixer.

template<class DERIVED>
static void Wt::Singleton< DERIVED >::quit (  )  [inline, static]

Reimplemented in Wt::Application.


Member Data Documentation

template<class DERIVED>
DERIVED * Wt::Singleton< DERIVED >::instance_ = 0 [static, protected]


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

Generated Fri Jul 28 19:22:39 2006.
Copyright © 1998-2003 by the respective authors.

This document is licensed under the terms of the GNU Free Documentation License and may be freely distributed under the conditions given by this license.