-
Notifications
You must be signed in to change notification settings - Fork 0
/
CommandEngine.h
63 lines (54 loc) · 2.14 KB
/
CommandEngine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef _COMMAND_ENGINE_
#define _COMMAND_ENGINE_
#include <iostream>
#include <memory>
#include "GameManager.h"
#include "InterpretationEngine.h"
/******************* COMMAND ENGINE *******************/
//resolve circular dependencies
class GameManager;
struct PCmdEng {
std::shared_ptr<GameManager> gameManager_;
std::shared_ptr<InterpretationEngine> intEngine_;
};
class CommandEngine {
private:
CommandEngine();
static std::shared_ptr<CommandEngine> cmdEngine_; //singleton global obj
std::shared_ptr<PCmdEng> PCmdEng_; //private implement
//SMFs
CommandEngine(const CommandEngine&) = delete;
CommandEngine& operator= (const CommandEngine&) = delete;
//CORE FUNCTIONS
//any primitive operations (grouped in helper functions) are hosted here and
//called on determination of command type as given by commands_ member variable
void executeCmd(std::deque<std::string>); //parent method to determine which function to execute based on cmd
void executeCLA(std::deque<std::string>); //parent method to determine which function to execute from CLAs
//command family functions
void moveBlock(std::string);
void dropBlock();
void rotateBlock(std::string);
void levelAdjustement(std::string);
void setRandom(bool, std::string = "");
void executeSequence(std::string);
void blockOverride(std::string);
void restart();
void generateHint();
void renameCommand(std::string, std::string);
//CLA functions
void setTextOnly();
void setSeed(std::string);
void setScriptfile(std::string);
void setStartLevel(std::string);
void disableBonus();
//POST command functions
void initiatePostMove();
void terminateProgram();
public:
static std::shared_ptr<CommandEngine> instance(); //get global Command Engine instance
//OPERATOR OVERLOADS
//not quite sure how to use input overload
void processCommands(std::istream&);
void processCLAs(int, char**);
};
#endif