Skip to content
Commits on Source (4)
......@@ -25,11 +25,7 @@
#include <Base_Packet.h>
#include <Base_Configurator.h>
#include <Base_Receiver.h>
// FORWARD DECLARE
namespace inaf::oasbo::DAQ_observers {
class BaseDAQ_Observer;
}
#include <Base_DAQ_Observer.h>
/**
* @brief The BaseDAQ class represents the base class for a Data Acquisition (DAQ) system.
......@@ -57,7 +53,7 @@ protected:
Providers::BaseProvider *provider = nullptr; /**< Pointer to the provider object. */
PacketMonitors::BasePacketMonitor *monitor = nullptr; /**< Pointer to the packet monitor object. */
Packets::BasePacket *packet = nullptr; /**< Pointer to the packet object. */
std::vector<inaf::oasbo::DAQ_observers::BaseDAQ_Observer*> observers; /**< Vector of observers. */
std::vector<inaf::oasbo::DAQ_Observers::BaseDAQ_Observer*> observers; /**< Vector of observers. */
std::vector<inaf::oasbo::Configurators::BaseConfigurator*> configurations; /**< Vector of configurations. */
public:
......@@ -139,17 +135,17 @@ public:
* @param observer The observer to register.
*/
void registerObserver(
inaf::oasbo::DAQ_observers::BaseDAQ_Observer *observer) {
inaf::oasbo::DAQ_Observers::BaseDAQ_Observer *observer) {
observers.push_back(observer);
}
/**
* @brief Removes an observer from the DAQ system.
*
*
* @param observer The observer to remove.
*/
void removeObserver(
inaf::oasbo::DAQ_observers::BaseDAQ_Observer *observer) {
inaf::oasbo::DAQ_Observers::BaseDAQ_Observer *observer) {
observers.erase(
std::remove(observers.begin(), observers.end(), observer),
observers.end());
......
......@@ -19,7 +19,10 @@
*/
#pragma once
#include <Base_DAQ.h>
// FORWARD DECLARE
namespace inaf::oasbo::DAQ {
class BaseDAQ;
}
/**
* @brief The BaseDAQ_Observer class is an abstract base class for DAQ system observers.
......@@ -28,7 +31,7 @@
* Subclasses of BaseDAQ_Observer must implement the pure virtual functions defined in this class.
*
*/
namespace inaf::oasbo::DAQ_observers {
namespace inaf::oasbo::DAQ_Observers {
class BaseDAQ_Observer {
protected:
......@@ -40,15 +43,14 @@ public:
*
* @param dataAcquisition The BaseDAQ object to observe.
*/
BaseDAQ_Observer(inaf::oasbo::DAQ::BaseDAQ &dataAcquisition) {
this->dataAcquisition = &dataAcquisition;
BaseDAQ_Observer(inaf::oasbo::DAQ::BaseDAQ *dataAcquisition) {
this->dataAcquisition = dataAcquisition;
}
/**
* @brief Destroys the BaseDAQ_Observer object and removes itself from the observed BaseDAQ object.
*/
virtual ~BaseDAQ_Observer() {
this->dataAcquisition->removeObserver(this);
}
/**
......@@ -86,5 +88,6 @@ public:
*/
virtual void stop() = 0;
};
}