Newer
Older
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
64
65
66
67
#ifndef BASEDAQ_H_
#define BASEDAQ_H_
#include <Base_Checker.h>
#include <Base_Monitor.h>
#include <Base_Protocol.h>
#include <Base_Archiver.h>
#include <Base_Provider.h>
class BaseDAQ{
public:
static const int STOP = -1;
static const int READY = 0;
static const int IDLE = 1;
static const int RUN = 2;
protected:
int currentState;
int nextState;
bool changeStateFlag = false;
BaseProtocol *socket;
BaseArchiver *archiver;
BaseProvider *provider;
BaseChecker *checker;
BasePacket *packet;
BaseMonitor *monitor;
public:
void setProtocol(BaseProtocol &socket){this->socket = &socket;}
void setArchiver(BaseArchiver &archiver){this->archiver = &archiver;}
void setProvider(BaseProvider &provider){this->provider = &provider;}
void setChecker(BaseChecker &checker){this->checker = &checker;}
void setPacket(BasePacket &packet){this->packet = &packet;}
void setMonitor(BaseMonitor &monitor){this->monitor = &monitor;}
void setCurrentState(int currentState){this->currentState = currentState;}
void setNextState(int nextState){this->nextState = nextState;}
void setChangeStateFlag(bool flag){this->changeStateFlag = flag;}
BaseProtocol * getSocketPtr(){return this->socket;}
BaseArchiver *getArchiverPtr(){return this->archiver;}
BaseProvider * getProviderPtr(){return this->provider;}
BaseChecker * getCheckerPtr(){return this->checker;}
BasePacket * getPacketPtr(){return this->packet;}
BaseMonitor * getMonitorPtr(){return this->monitor;}
int getCurrentState(){return this->currentState;}
int getNextState(){return this->nextState;}
int getChangeStateFlag(){return this->changeStateFlag;}
virtual void init() = 0;
virtual void start(int initialState) = 0;
virtual void stop() = 0;
virtual void switchState(const int) = 0;
virtual int deliverPacket() = 0;
virtual ~BaseDAQ(){
delete socket;
delete provider;
delete archiver;
delete checker;
delete packet;
delete monitor;
}
};
#endif /* BASEDAQ_H_ */