CARMA C++
Singleton.h File Reference

Carma Singleton Adaptor class. More...

#include <stdexcept>
#include <typeinfo>
#include "carma/util/demangle.h"
#include "carma/util/PthreadMutex.h"
#include "carma/util/ScopedPthreadMutexLock.h"

Go to the source code of this file.

Classes

class  carma::util::CreateStaticPolicy< TYPE >
 Singleton creation policy which causes instances to be created in function local static memory. More...
 
class  carma::util::CreateStaticPolicy< TYPE >
 Singleton creation policy which causes instances to be created in function local static memory. More...
 
class  carma::util::CreateWithNewPolicy< TYPE >
 Singleton creation policy which causes instances to be allocated with new (on the heap). More...
 
class  carma::util::CreateWithNewPolicy< TYPE >
 Singleton creation policy which causes instances to be allocated with new (on the heap). More...
 
class  carma::util::CreateWithNewUnmanagedPolicy< TYPE >
 Singleton creation policy which causes instances to be allocated with new (on the heap) but which provides no deletion of memory. More...
 
class  carma::util::CreateWithNewUnmanagedPolicy< TYPE >
 Singleton creation policy which causes instances to be allocated with new (on the heap) but which provides no deletion of memory. More...
 
class  carma::util::Singleton< TYPE, InstantiationPolicy >
 Thread-safe, templatized Singleton class with policy based creation. More...
 
class  carma::util::Singleton< TYPE, InstantiationPolicy >
 Thread-safe, templatized Singleton class with policy based creation. More...
 

Namespaces

module  carma
 IDL for bima Rx Control, inherits from antenna::common::RxControl.
 
 carma::util
 Utility classes.
 

Detailed Description

Carma Singleton Adaptor class.

Initial motivation was provided by work done by Eric Crahen on the ZThreads library. Based strongly on Loki::Singleton by Andrei Alexandrescu and somewhat on the ACE_Singleton by Doug Shmidt and others. The Loki and ACE implementations are far superior to what I've provide here, however, using either of these would have required bringing in the whole package AND coding paradigm. In general, these packages threading models would interfere with Carma thread constructs so I've opted for a minimal homegrown implementation that should satisfy most common uses.

References:

  1. J. Vlissides, "To Kill A Singleton" C++ Report "Pattern Hatching" column for June 1996.
  2. D. Shmidt, T. Harrison, "Double-Checked Locking" Pattern Languages of Program Design 3. Addison Wesley, 1997.
Author
Andy Beard
Revision:
1.23
Date:
2005/02/22 21:29:15
Id:
Singleton.h,v 1.23 2005/02/22 21:29:15 tcosta Exp

Definition in file Singleton.h.