BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
AbstractDistributor.h
1 #pragma once
2 
3 #include <vector>
4 
5 #include <Poco/SharedPtr.h>
6 
7 #include "core/Distributor.h"
8 #include "core/DistributorListener.h"
9 #include "util/EventSource.h"
10 #include "util/Loggable.h"
11 
12 namespace BeeeOn {
13 
14 class Exporter;
15 class SensorData;
16 
17 class AbstractDistributor : public Distributor, public Loggable {
18 public:
19  /*
20  * Register exporter. Received messages are resent to
21  * all registered exporters.
22  */
23  virtual void registerExporter(Poco::SharedPtr<Exporter> exporter);
24 
25  void registerListener(DistributorListener::Ptr listener);
26 
27  /*
28  * Set executor instance for asynchronous data transfer to
29  * listeners.
30  */
31  void setExecutor(AsyncExecutor::Ptr executor);
32 
33 protected:
34  /*
35  * Notify registered listeners by calling onExport() method.
36  * This is supposed to be called at the beginning of Distributor::export().
37  */
38  void notifyListeners(const SensorData &data);
39 
40  std::vector<Poco::SharedPtr<Exporter>> m_exporters;
42 };
43 
44 }
Definition: SensorData.h:20
EventSource implements common logic for firing events to listeners.
Definition: EventSource.h:24
Definition: AbstractDistributor.h:17
Definition: Loggable.h:19
Definition: Distributor.h:12