Newer
Older
#ifndef BASEDAQ_H_
#define BASEDAQ_H_
#include <Base_Monitor.h>
#include <Base_Protocol.h>
#include <Base_Archiver.h>
#include <Base_Provider.h>
namespace inaf::oasbo::DAQ{
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;
ConnectionProtocols::BaseProtocol *socket;
Archivers::BaseArchiver *archiver;
Providers::BaseProvider *provider;
Monitors::BaseMonitor *monitor;
void setProtocol(ConnectionProtocols::BaseProtocol &socket){this->socket = &socket;}
void setArchiver(Archivers::BaseArchiver &archiver){this->archiver = &archiver;}
void setProvider(Providers::BaseProvider &provider){this->provider = &provider;}
void setMonitor(Monitors::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;}
ConnectionProtocols::BaseProtocol * getSocketPtr(){return this->socket;}
Archivers::BaseArchiver *getArchiverPtr(){return this->archiver;}
Providers::BaseProvider * getProviderPtr(){return this->provider;}
Monitors::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,PacketLib::BasePacket &) = 0;
virtual void stop() = 0;
virtual void switchState(const int) = 0;
virtual ~BaseDAQ(){
delete socket;
delete provider;
delete archiver;
delete monitor;
}
};