Rename corelogic->hcore, add simulator skeleton classes
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
#ifndef _SCENE_H
|
||||
#define _SCENE_H
|
||||
|
||||
class Scene
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef CANVAS_H
|
||||
#define CANVAS_H
|
||||
|
||||
#include <simulator/scene.h>
|
||||
|
||||
namespace canvas {
|
||||
|
||||
class Canvas {
|
||||
public:
|
||||
Canvas();
|
||||
~Canvas();
|
||||
|
||||
SceneId loadScene(Scene &scene);
|
||||
|
||||
private:
|
||||
// Add private members here
|
||||
};
|
||||
|
||||
} // namespace canvas
|
||||
|
||||
#endif // CANVAS_H
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef SIMULATOR_COMMANDLIST_H
|
||||
#define SIMULATOR_COMMANDLIST_H
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <mentalEntity.h>
|
||||
|
||||
namespace scene {
|
||||
|
||||
/**
|
||||
* @brief Base class for all commands, storing a reference to a mental entity ID.
|
||||
*
|
||||
* Derived classes can extend this to include additional command-specific
|
||||
* data and behavior.
|
||||
*/
|
||||
class Command
|
||||
{
|
||||
public:
|
||||
Command(const MentalEntity::Id menty) : menty(menty) {}
|
||||
|
||||
public:
|
||||
const MentalEntity::Id menty;
|
||||
};
|
||||
|
||||
class CommandList
|
||||
{
|
||||
public:
|
||||
CommandList() = default;
|
||||
|
||||
/**
|
||||
* @brief Used by Scene to point to the currently executing command.
|
||||
*
|
||||
* scene::Scene maintains an internal cursor. As it executes commands from
|
||||
* its internal command list, it advances the cursor to the current command
|
||||
* before executing it.
|
||||
*/
|
||||
class Cursor
|
||||
{
|
||||
public:
|
||||
Cursor(CommandList& commandList)
|
||||
: commandList(commandList), iter(commandList.commands.begin())
|
||||
{}
|
||||
|
||||
void reset() { iter = commandList.commands.begin(); }
|
||||
bool hasNext() const { return iter != commandList.commands.end(); }
|
||||
Cursor next() { return Cursor(commandList, ++iter); }
|
||||
|
||||
private:
|
||||
Cursor(
|
||||
CommandList& commandList,
|
||||
std::vector<Command>::iterator iter)
|
||||
: commandList(commandList), iter(iter)
|
||||
{}
|
||||
|
||||
public:
|
||||
CommandList& commandList;
|
||||
std::vector<Command>::iterator iter;
|
||||
};
|
||||
|
||||
Cursor getCursor() { return Cursor(*this); }
|
||||
void addCommand(const Command& command)
|
||||
{
|
||||
commands.push_back(command);
|
||||
}
|
||||
|
||||
public:
|
||||
std::vector<Command> commands;
|
||||
};
|
||||
|
||||
} // namespace scene
|
||||
|
||||
#endif // SIMULATOR_COMMANDLIST_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef _SCENE_H
|
||||
#define _SCENE_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <mentalEntity.h>
|
||||
#include <simulator/commandList.h>
|
||||
|
||||
namespace scene {
|
||||
|
||||
class Scene
|
||||
{
|
||||
public:
|
||||
using Id = uint32_t;
|
||||
|
||||
Scene();
|
||||
~Scene();
|
||||
|
||||
bool hasMentalEntity(const MentalEntity::Id menty) const;
|
||||
MentalEntity::Id addMentalEntity(const MentalEntity& menty);
|
||||
void replaceMentalEntity(const MentalEntity::Id menty, const MentalEntity& newMenty);
|
||||
void removeMentalEntity(const MentalEntity::Id menty);
|
||||
|
||||
void executeInd(void);
|
||||
CommandList::Cursor haltInd(void);
|
||||
|
||||
private:
|
||||
std::map<MentalEntity::Id, MentalEntity &> menties;
|
||||
CommandList commands;
|
||||
CommandList::Cursor cursor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef SIMULATOR_H
|
||||
#define SIMULATOR_H
|
||||
|
||||
#include <simulator/canvas.h>
|
||||
|
||||
namespace simulator {
|
||||
|
||||
class Simulator {
|
||||
public:
|
||||
Simulator();
|
||||
~Simulator();
|
||||
|
||||
void initialize();
|
||||
void run();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
bool isRunning;
|
||||
Canvas canvas;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SIMULATOR_H
|
||||
Reference in New Issue
Block a user