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