Static Public Member Functions | |
| static TYPE * | Instance (void) | 
| Singleton dynamic creation using the default builder.  More... | |
| static bool | IsAlreadyExisting (void) | 
| returns True if the singleton is already existing  More... | |
| static int | Destruction (void) | 
| destroys the Singleton before the end of the application process  More... | |
Definition
A singleton is a data which is created and deleted only once in the application. The C++ compiler allow the user to create static data before the first executable statement. They are deleted after the last statement.statement.
The SINGLETON_ template class deals with dynamic singleton. It is useful for functor objects. For example, an object which, when created, connects the application to a system and disconnects the application at deletion.
Usage
To create a single instance a POINT_ object :
... ptrPoint = SINGLETON_<POINT_>::Instance() ;
Design description
 -# the user creates an object of class TYPE By using a class method : SINGLETON_<TYPE>::Instance() which
    returns a pointer to the single object ;
 -# this class method uses the default constructor to create an object ;
 -# at the same time, this class method reate a destructor object which is added to the generic list
    of destructors objects to be executed at the end of the application (atexit) ;
 -# at the end of the application process all the deletions are performed by the Nettoyage() C function
    which execute the destructions objects then deletes the destructions objects themselves ;
 -# the Nettoyage() C function is recorded using atexit() C function through the creation of a static
    single object ATEXIT_(). 
      
  | 
  static | 
Singleton dynamic creation using the default builder.
The class method Instance :
Note that the two created objects are deleted at the end of the process in the function Nettoyage().
      
  | 
  static | 
returns True if the singleton is already existing
      
  | 
  static | 
destroys the Singleton before the end of the application process
The method SINGLETON_<TYPE>::Destruction can be called by the user. If it is not the function nettoyage() calls it atexit.
N.B. : the singleton objects are destroyed in the reverse order of there creation.