#include <singleton.h>
Inheritance diagram for Wt::Singleton< DERIVED >:
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 |
Definition at line 30 of file singleton.h.
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
Definition at line 71 of file singleton.h.
00071 { 00072 if (instance_) { 00073 throw Exception(); 00074 } 00075 instance_ = d; 00076 }
Wt::Singleton< DERIVED >::~Singleton | ( | ) | [inline, protected] |
static DERIVED* Wt::Singleton< DERIVED >::existingInstance | ( | ) | [inline, static] |
Definition at line 36 of file singleton.h.
Referenced by Wt::Application::exit(), Wt::Application::postEvent(), Wt::Application::sendEvent(), and Wt::Application::sendPostedEvents().
00036 { 00037 return instance_; 00038 }
static void Wt::Singleton< DERIVED >::init | ( | ) | [inline, static] |
Reimplemented in Wt::Application.
Definition at line 49 of file singleton.h.
Referenced by Wt::Application::Application().
00049 { 00050 if (!instance()) { 00051 assert(0); 00052 } 00053 }
static DERIVED* Wt::Singleton< DERIVED >::instance | ( | ) | [inline, static] |
instantiates the pointer compatible child of DERIVED aka grandchild
it is handy in driver like situations
Definition at line 43 of file singleton.h.
static DERIVED* Wt::Singleton< DERIVED >::instance | ( | ) | [inline, static] |
Definition at line 32 of file singleton.h.
Referenced by Wt::Audio::Audio(), Wt::Sound::available(), Wt::SDLMixer::Chunk::channel(), Wt::NullAudio::Chunk::channel(), Wt::SDLSurface::defaultDepth(), Wt::SDLInput::EventInfo::EventInfo(), Wt::Dialog::exec(), Wt::Widget::grabKeyboard(), Wt::Widget::grabMouse(), Wt::Audio::handleAudioEvent(), Wt::SDLInput::handleKeyEvent(), Wt::Singleton< Wt::Audio >::init(), Wt::SDLTimer::init(), Wt::Sound::isAvailable(), Wt::Widget::keyboardGrabber(), Wt::Audio::load(), Wt::Widget::mouseGrabber(), Wt::SDLMixer::onChannelFinish(), Wt::Audio::onChannelFinish(), Wt::Sound::play(), Wt::Singleton< Wt::Audio >::quit(), Wt::Widget::releaseKeyboard(), Wt::Widget::releaseMouse(), Wt::SDLInput::SDLInput(), Wt::SDLMixer::setMusicVolume(), Wt::SDLMixer::Channel::setVolume(), and Wt::SDLMixer::Chunk::setVolume().
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.
Definition at line 86 of file singleton.h.
static void Wt::Singleton< DERIVED >::quit | ( | ) | [inline, static] |
Reimplemented in Wt::Application.
Definition at line 55 of file singleton.h.
Referenced by Wt::Application::~Application().
00055 { 00056 delete instance(); 00057 }
DERIVED * Wt::Singleton< DERIVED >::instance_ = 0 [static, protected] |
Definition at line 91 of file singleton.h.
Referenced by Wt::Singleton< Wt::Audio >::existingInstance(), Wt::Singleton< Wt::Audio >::instance(), Wt::Singleton< Wt::Audio >::load(), Wt::SDLDisplay::load(), Wt::Audio::load(), Wt::Singleton< Wt::Audio >::Singleton(), and Wt::Singleton< Wt::Audio >::~Singleton().
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.