-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataReaderServer.h
47 lines (39 loc) · 1.16 KB
/
DataReaderServer.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
#ifndef DATA_READER_SERVER_H
#define DATA_READER_SERVER_H
#include "Command.h"
#include "Modifier.h"
using namespace std;
class DataReaderServer : public Command {
map<string, string>* _pathToVar;
Modifier* _modifier;
int _sockID;
int _port;
public:
DataReaderServer(map<string,double>* symbolTable,
map<string, string>* pathToVar,
map<string, vector<string>>* bindedVarTable,
Modifier* modifier);
/*
* doCommand ->
* Opens a server on a different thread that the simulator connects to, and recieves messages from it
* at a given speed.
* */
virtual int doCommand(vector<string>& arguments, unsigned int index);
virtual ~DataReaderServer();
private:
/*
* opens a socket and waits for first signs from the simulator.
* */
void openSocket();
static void startServer(int new_socket,
unsigned int speed,
map<string,double>* symbolTable,
map<string, string>* pathToVar,
Modifier* modifier);
static void updateVars(vector<double> values,
Modifier* modifier,
map<string, string>* pathToVar,
vector<string>& names);
static vector<string> getNames();
};
#endif // !DATA_READER_SERVER_H