| MetriVis | Overview | Download | User Manual | Development |
| Reference | Overview | Design Documentation | Reference Backend | Reference Frontend |
#include <Singleton.h>
Static Public Member Functions | |
| static T & | Instance () |
| Interface function to fetch the singleton instance. | |
| static void | Destroy () |
| Frees the the singleton memory. | |
Private Member Functions | |
| Singleton (const Singleton &singleton) | |
| Singleton & | operator= (const Singleton &singleton) |
Static Private Attributes | |
| static T *volatile | singleton_instance_ = 0 |
| The singleton instance. | |
| static boost::mutex | instance_mutex_ |
| Mutex locks creation process. | |
Template can be used to define singleton classes. It's a very simplified singleton implementation. Doesn't implement the dead reference problem, so be sure to delete the singletons in the correct way. Is thread save.
| T & metrivis::Singleton< T >::Instance | ( | ) | [inline, static] |
Interface function to fetch the singleton instance.
| void metrivis::Singleton< T >::Destroy | ( | ) | [inline, static] |
Frees the the singleton memory.
Deletes the singleton object and the mutex.
1.5.3