added manager singleton logic
This commit is contained in:
@@ -2,4 +2,13 @@
|
|||||||
// Created by black on 12.06.25.
|
// 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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,11 +4,24 @@
|
|||||||
|
|
||||||
#ifndef MANAGER_H
|
#ifndef MANAGER_H
|
||||||
#define 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.
|
/// Die Manager Instanz sorgt für die Koordination von user input, Datei einlesen, code execution und anderen Aktionen.
|
||||||
|
|
||||||
class Manager {
|
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:
|
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);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user