added manager singleton logic

This commit is contained in:
black
2025-07-06 15:19:12 +02:00
parent 487621748e
commit 06af1ed6c6
2 changed files with 23 additions and 1 deletions

View File

@@ -2,4 +2,13 @@
// Created by black on 12.06.25.
//
#include "emulator/Manager.h"
#include "Manager.h"
#include <utility>
Manager::Manager(std::string path): m_path(std::move(path)) {}
Manager * Manager::getInstance(const std::string &program_path) {
static Manager instance{program_path};
return &instance;
}

View File

@@ -4,11 +4,24 @@
#ifndef MANAGER_H
#define MANAGER_H
#include <string>
/// Die Manager Instanz sorgt für die Koordination von user input, Datei einlesen, code execution und anderen Aktionen.
class Manager {
private:
/// Die Instanz des Managers soll mit einem immutable path zum Programm erstellt werden
explicit Manager(std::string path);
std::string m_path;
public:
/// Singleton Logik
Manager(const Manager &) = delete;
Manager(const Manager &&) = delete;
Manager &operator=(const Manager &) = delete;
Manager &operator=(const Manager &&) = delete;
~Manager() = default;
static Manager *getInstance(const std::string &program_path);
};