Definition More...
#include <Utils_SINGLETON.hxx>
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... | |
Private Member Functions | |
| SINGLETON_ (void) | |
| ~SINGLETON_ () | |
Private Attributes | |
| TYPE | _Instance | 
Static Private Attributes | |
| static SINGLETON_ * | PtrSingleton =NULL | 
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_(). 
      
  | 
  private | 
      
  | 
  private | 
      
  | 
  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.
References DESTRUCTEUR_GENERIQUE_::Destructeurs.
      
  | 
  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().
Referenced by Connexion(), getGlobalORB(), SALOMEDS_StudyManager::init_orb(), SALOMEDS_SObject::init_orb(), SALOMEDS_StudyBuilder::init_orb(), SALOMEDS_Study::init_orb(), main(), NOTIFICATION_channel(), LifeCycleCORBATest::setUp(), SALOMEDSTest::setUp(), NamingServiceTest::setUp(), and SALOMEDSTest_Embedded::setUp().
      
  | 
  static | 
returns True if the singleton is already existing
      
  | 
  private | 
      
  | 
  staticprivate |