Template support for singleton pattern. More...
#include <Singleton.h>
  
 Static Public Member Functions | |
| static T & | getInstance () | 
| It returns a reference to the singleton instance.  More... | |
Protected Member Functions | |
| Singleton () | |
| The singleton constructor is protected.  More... | |
| virtual | ~Singleton () | 
| This will avoid clients trying to release pointers to base class.  More... | |
Private Member Functions | |
| Singleton & | operator= (const Singleton &other) | 
| Singleton (const Singleton &other) | |
Template support for singleton pattern.
In TerraLib, classes that manage resources like DataSourceManager and ProjectManager are singletons. The basic interface of a singleton is defined by this singleton class. If you want to get access to the singleton instance you can write a code like:
or
If you want to use this template class in order to create your singleton class, the type T must satisfy the following requirements:
You can create a singleton class as follow:
Definition at line 100 of file Singleton.h.
      
  | 
  inlineprotected | 
The singleton constructor is protected.
Definition at line 133 of file Singleton.h.
      
  | 
  inlineprotectedvirtual | 
This will avoid clients trying to release pointers to base class.
Definition at line 137 of file Singleton.h.
      
  | 
  private | 
      
  | 
  inlinestatic | 
It returns a reference to the singleton instance.
Definition at line 126 of file Singleton.h.
      
  | 
  private |