Skip to content
Snippets Groups Projects
Commit adbe74d6 authored by David Trattnig's avatar David Trattnig
Browse files

Engine as singleton. #43 #44

parent f8bd8fd3
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,7 @@ class Engine():
"""
The Engine.
"""
instance = None
engine_time_offset = 0.0
logger = None
......@@ -68,6 +69,9 @@ class Engine():
Args:
config (AuraConfig): The configuration
"""
if Engine.instance:
raise Exception("Engine is already running!")
Engine.instance = self
self.config = config
self.plugins = dict()
self.logger = logging.getLogger("AuraEngine")
......@@ -178,6 +182,14 @@ class Engine():
return SU.timestamp() + Engine.engine_time_offset
@staticmethod
def get_instance():
"""
Returns the one and only engine.
"""
return Engine.instance
def terminate(self):
"""
Terminates the engine and all related processes.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment