Singleton< T > Class Template Reference

#include <cddefines.h>

Inherited by t_ADfA, t_debug, t_fe2ovr_la, t_lfact, t_version, and t_yield.

Inheritance diagram for Singleton< T >:

Inheritance graph
[legend]

Static Public Member Functions

static T & Inst ()

Detailed Description

template<typename T>
class Singleton< T >

Singleton: template to construct classes where a single instance can be accessed across the entire program. Construct your class as follows:

class t_myclass : public Singleton<t_myclass> { friend class Singleton<t_myclass>; protected: t_myclass(); // make sure the contructor is protected! public: long myfunc() const { return 43; } };

and use as follows throughout the code:

long l = t_myclass::Inst().myfunc();

NB NB - This implementation is not threadsafe !!

Definition at line 103 of file cddefines.h.


Member Function Documentation

template<typename T>
static T& Singleton< T >::Inst (  )  [inline, static]

Definition at line 106 of file cddefines.h.

Referenced by cdDate(), cdVersion(), debugtrace< lgTrace >::debugtrace(), GammaBnPL(), GammaPrtShells(), HCSAR_interp(), hlike_radrecomb_from_cross_section(), InitBinAugerData(), ion_collis(), ion_photo(), ion_recom_calculate(), ipShells(), iso_collisional_ionization(), iso_create(), iso_radiative_recomb(), iso_recomb_setup(), lfactorial(), lines(), mie_write_opc(), Opacity_iso_photo_cs(), OpacityCreate1Element(), pah1_fun(), ParseDont(), ParsePrint(), ParsePunch(), ParseSet(), PrtComment(), PrtFinal(), ShowMe(), writeCloudyDetails(), zero(), and debugtrace< lgTrace >::~debugtrace().


The documentation for this class was generated from the following file:
Generated on Mon Feb 16 12:14:26 2009 for cloudy by  doxygen 1.4.7