61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <list>
|
|
#include <vector>
|
|
|
|
#include "Game/GameInstance.h"
|
|
|
|
class CoreInstance {
|
|
struct Module {
|
|
const char* name;
|
|
void* handler;
|
|
};
|
|
|
|
#pragma region Key words for main config
|
|
const char* key_base_world= "base_world";
|
|
const char* key_modules = "modules";
|
|
#pragma endregion
|
|
|
|
#pragma region config parameters
|
|
const char* main_config = "main_config.conf";
|
|
std::string base_world;
|
|
std::vector<std::string> modules_names;
|
|
#pragma endregion
|
|
|
|
int countCPU;
|
|
unsigned long long memorySize;
|
|
std::list<Module> modules;
|
|
|
|
GameInstance* game = nullptr;
|
|
public:
|
|
CoreInstance();
|
|
~CoreInstance();
|
|
|
|
void start();
|
|
|
|
int getCountCPU() const { return countCPU; }
|
|
unsigned long long getMemorySize() const { return memorySize; }
|
|
|
|
/**
|
|
* @throws std::runtime_error if module isn't enabled
|
|
* @throws std::runtime_error if module not found
|
|
* @return module handler
|
|
*/
|
|
void* getHandlerModule(const char* name) const noexcept(false);
|
|
/**
|
|
* @throws std::runtime_error if the module already enabled
|
|
* @throws std::runtime_error if the module isn't found
|
|
* @throws std::runtime_error if the module doesn't contain InitModule or StartModule
|
|
* @retuen module handler
|
|
*/
|
|
void* enableModule(const char* name) noexcept(false);
|
|
/**
|
|
* @throws std::runtime_error if the module isn't found
|
|
* @throws std::runtime_error module isn't contain QuitModule function
|
|
*/
|
|
void disableModule(const char* name) noexcept(false);
|
|
|
|
const std::string& getBaseWorldName() const { return base_world; }
|
|
};
|