Files | |
| file | dummy.hh |
| Declaration of utilmm::singleton::dummy. | |
| file | server_fwd.hh |
Forward declaration of utilmm::singleton::server. | |
| file | wrapper.hh |
| Declaration of utilmm::singleton::wrapper. | |
| file | use.hh |
Declararation of utilmm::singleton::use class. | |
| file | use_fwd.hh |
Forward declaration of utilmm::singleton::use. | |
| file | wrapper_fwd.hh |
Forward declaration of utilmm::singleton::wrapper. | |
Namespaces | |
| namespace | utilmm::singleton |
| Singleton manipulation. | |
Classes | |
| class | utilmm::singleton::dummy |
base class for utilmm::singleton::wrapper More... | |
| class | utilmm::singleton::wrapper< Ty > |
| Wrapper for singleton instances. More... | |
| struct | utilmm::singleton::use< Ty > |
| Access point to singleton. More... | |
This module includes all the classes used to implement a phoenix singleton pattern design supporting shared libraires.
The phoenix singleton pattern design offers the possibility to have a special class with these properties :
utilmm::singleton::use class. This class will offer an acces to singleton instance and will manage the singleton life (it can be seen as a reference counting smart pointer.
For example if one class foo need to access to a singleton of type bar . User can code it asd this :
#include "utilmm/singleton/use.hh" class foo { private: utilmm::singleton::use<bar> bar_s; int value; public: foo():value(0) {} explicit foo(int v):value(v) {} ~foo() {} void send_to_bar() { bar_s.instance().send(value); // or bar_s->send(value); } };
utilmm::singleton::use ) one can follow this example :
#include "utilmm/singleton/wrapper_fwd.hh" class pure_singleton { public: // [...] private: pure_singleton(); ~pure_singleton(); // [...] friend class utilmm::singleton::wrapper<pure_singleton>; };
All the structors are defined as private then only firends (ie utilmm::singleton::wrapper) can create and destroy the instance then we have the guarantee that this class is a pure phoenix singleton.
1.5.3