IPM
Singleton Class Reference

General class to extend to add a "singleton" interface to any registered or persistent class. More...

Inheritance diagram for Singleton:
Inheritance graph

Public Member Functions

_.Library.Status OnClose ()
 Removes the OREF of this instance from PPG. More...
 
_.Library.Status OnNew ()
 Tracks the OREF of this instance in a PPG for later reference. More...
 

Static Public Attributes

 NAMESPACESCOPE = None
 If set to 1, calls to Get must return an instance of this class created in the current namespace; a new instance will be created if none exists.
 
 PPG = None
 PPG in which to track references to the instance of this class.
 

Static Private Member Functions

_.IPM.General.Singleton Get (_.Library.Status pSC)
 Return the single per-process/namespace instance of this class, or create a new one. More...
 
_.IPM.General.Singleton __GetInMemoryInstance ()
 This method finds the existing instance of an object of a current class (created in the namespace if ..NAMESPACESCOPE is 1) if it exists in the current process. More...
 

Detailed Description

General class to extend to add a "singleton" interface to any registered or persistent class.

For persistent classes, requires that the class has a unique index defined on a read-only property with an InitialExpression.

Member Function Documentation

◆ Get()

_.IPM.General.Singleton Get ( _.Library.Status  pSC)
staticprivate

Return the single per-process/namespace instance of this class, or create a new one.

For persistent classes, may open the existing single record by its unique index.

◆ OnClose()

_.Library.Status OnClose ( )

Removes the OREF of this instance from PPG.

Subclasses of IPM.General.Singleton that override this method MUST call ##super().

Reimplemented in TempFileManager, and LogManager.

◆ OnNew()

_.Library.Status OnNew ( )

Tracks the OREF of this instance in a PPG for later reference.

Subclasses of IPM.General.Singleton that override this method MUST call ##super().

Reimplemented in Manager.

◆ __GetInMemoryInstance()

_.IPM.General.Singleton __GetInMemoryInstance ( )
staticprivate

This method finds the existing instance of an object of a current class (created in the namespace if ..NAMESPACESCOPE is 1) if it exists in the current process.

Exceptions are caught by calling code.