-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDataCommands.cpp
More file actions
55 lines (46 loc) · 1.99 KB
/
DataCommands.cpp
File metadata and controls
55 lines (46 loc) · 1.99 KB
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
#include "DataCommands.h"
#include "DataBinds.h"
#include "DataVars.h"
#include "OpenDataServerCommand.h"
#include "BindCommand.h"
#include "IfCommand.h"
#include "EqualCommand.h"
#include "WhileCommand.h"
#include "EntercCommand.h"
#include "VarCommand.h"
#include "ConnectCommand.h"
#include "PrintCommand.h"
#include "SleepCommand.h"
DataCommands::DataCommands(vector<string> &separated) {
this->index = 0;
this->separated = separated;
DataVars *dataVars;
dataVars = new DataVars();
DataBinds *dataBinds;
dataBinds = new DataBinds();
pthread_mutex_init(&this->mutex, nullptr);
this->stringsToCommands.insert(
pair<string, Command *>("openDataServer", new OpenDataServerCommand(this, dataBinds, dataVars, mutex)));
this->stringsToCommands.insert(
pair<string, Command *>("connect", new ConnectCommand(this, dataBinds, dataVars, mutex)));
this->stringsToCommands.insert(pair<string, Command *>("var", new VarCommand(this, dataVars)));
this->stringsToCommands.insert(pair<string, Command *>("bind", new BindCommand(this, dataBinds)));
this->stringsToCommands.insert(pair<string, Command *>("while", new WhileCommand(this, dataVars)));
this->stringsToCommands.insert(pair<string, Command *>("if", new IfCommand(this, dataVars)));
this->stringsToCommands.insert(pair<string, Command *>("print", new PrintCommand(this, dataVars)));
this->stringsToCommands.insert(pair<string, Command *>("=", new EqualCommand(this, dataVars)));
this->stringsToCommands.insert(pair<string, Command *>("enterc", new EntercCommand(this)));
this->stringsToCommands.insert(pair<string, Command *>("sleep", new SleepCommand(this, dataVars)));
}
unsigned long DataCommands::getIndex() {
return index;
}
vector<string> DataCommands::getSeparated() {
return separated;
}
void DataCommands::setIndex(unsigned long index) {
this->index = index;
}
unordered_map<string, Command *> DataCommands::getStringsToCommands() {
return stringsToCommands;
}