Singleton

Singleton classes are a design pattern that returns the same object for every call to create an instance. In the case of BACpypes there can only be one instance of a task.TaskManager and all of the tasks will be schedule through it. The design pattern “hides” all of the implementation details of the task manager behind its interface.

There are occasions when the task manager needs to provide additional functionality, or a derived class would like a change to intercept the methods. In this case the developer can create a subclass of TaskManager, then create an instance of it. Every subsequent call to get a task manager will return this special instance.

Classes

class singleton.Singleton

By inheriting from this class, all calls to build an object will return the same object.

class singleton.SingletonLogging

This special class binds together the metaclasses from both this singleton module and from the debugging.Logging. Python classes cannot inherit from two separate metaclasses at the same time, but this class takes advantage of Pythons ability to have multiple inheritance of metaclasses.