Newer
Older
#ifndef BASEDAQ_H_
#define BASEDAQ_H_
#include <Base_Monitor.h>
#include <Base_Protocol.h>
#include <Base_Archiver.h>
#include <Base_Provider.h>
// FORWARD DECLARE
namespace inaf::oasbo::DAQ_observers {
class BaseDAQ_Observer;
}
Archivers::BaseArchiver *archiver = nullptr;
Providers::BaseProvider *provider = nullptr;
PacketMonitors::BasePacketMonitor *monitor = nullptr;
PacketLib::BasePacket *packet = nullptr;
std::vector<inaf::oasbo::DAQ_observers::BaseDAQ_Observer*> observers;
std::vector<inaf::oasbo::Configurators::BaseConfigurator*> configurations;
void setProtocol(ConnectionProtocols::BaseProtocol &socket) {
}
void setArchiver(Archivers::BaseArchiver &archiver) {
this->archiver = &archiver;
}
void setProvider(Providers::BaseProvider &provider) {
this->provider = &provider;
}
void setMonitor(PacketMonitors::BasePacketMonitor &monitor) {
this->monitor = &monitor;
}
void setPacket(PacketLib::BasePacket &packet) {
this->packet = &packet;
}
void setCurrentState(Status currentState) {
this->currentState = currentState;
}
void setNextState(Status nextState) {
this->nextState = nextState;
}
void setChangeStateFlag(bool flag) {
this->changeStateFlag = flag;
}
void registerObserver(
inaf::oasbo::DAQ_observers::BaseDAQ_Observer *observer) {
void removeObserver(
inaf::oasbo::DAQ_observers::BaseDAQ_Observer *observer) {
observers.erase(
std::remove(observers.begin(), observers.end(), observer),
observers.end());
}
}
Archivers::BaseArchiver* getArchiverPtr() {
return this->archiver;
}
Providers::BaseProvider* getProviderPtr() {
return this->provider;
}
PacketMonitors::BasePacketMonitor* getMonitorPtr() {
return this->monitor;
}
PacketLib::BasePacket* getPacketPrt() {
return this->packet;
}
Status getCurrentState() {
return this->currentState;
}
Status getNextState() {
return this->nextState;
}
int getChangeStateFlag() {
return this->changeStateFlag;
}
delete provider;
delete archiver;
delete monitor;
for (auto ob : observers) {
observers.erase(std::remove(observers.begin(), observers.end(), ob),
observers.end());
}