StrokeSegLab
Loading...
Searching...
No Matches
singleton.SingletonMeta Class Reference
Inheritance diagram for singleton.SingletonMeta:

Public Member Functions

 __call__ (cls, *args, **kwargs)
 

Static Protected Attributes

dict _instances = {}
 

Detailed Description

Metaclass that ensures only one instance of a class exists (Singleton pattern)

Member Function Documentation

◆ __call__()

singleton.SingletonMeta.__call__ ( cls,
* args,
** kwargs )
Each time a class using this metaclass is instantiated, this method is called. It checks if an instance of the class already exists in the _instances dictionary:
- If no instance exists, it creates a new one by calling the superclass __call__, stores it in _instances, and returns it
- If an instance already exists, it returns the stored instance instead of creating a new one

The documentation for this class was generated from the following file: