ddt  0.1
ddtDataProducer.hpp
Go to the documentation of this file.
1 // @copyright
2 // (c) Copyright ESO 2020
3 // All Rights Reserved
4 // ESO (eso.org) is an Intergovernmental Organization, and therefore special
5 // legal conditions apply.
6 //
7 // @file ddtDataProducer.hpp
8 // @brief Data Producer.
9 //
10 // This class provides the functionality to publish data over network
11 // and enables sending new data notifications.
12 //
13 // @author Matthias Grimm, CGI
14 // @since 2020/01/16
15 //
16 
17 #ifndef DDTDATAPRODUCER_HPP_
18 #define DDTDATAPRODUCER_HPP_
19 
21 
22 namespace mal = ::elt::mal;
23 namespace datatransfer = ::elt::ddt::datatransfer;
24 
25 static const std::chrono::milliseconds PUBLISH_TIMEOUT{450};
26 
27 namespace ddt {
28 
34  public:
38  explicit DdtDataProducer(DdtLogger* logger);
39 
43  DdtDataProducer(const std::string& data_stream_identifier,
44  const int32_t latency, const int32_t deadline,
45  const std::string publishing_uri, DdtLogger* logger);
46 
50  ~DdtDataProducer() override;
51 
55  void Publish(DataPacket data_packet);
56 
61  void Notify(const NotificationType type) override;
62 
66  std::string get_publishing_uri() const;
67 
68  private:
72  void Initialize(const std::string& data_stream_identifier,
73  const int32_t latency, const int32_t deadline,
74  const std::string pub_uri, DdtLogger* ddt_logger);
75 
79  std::string CreatePublishingUri(
80  const std::string& data_stream_identifier) const;
81 
82  std::unique_ptr<mal::ps::InstancePublisher<datatransfer::DataPacket>,
83  std::default_delete<
84  mal::ps::InstancePublisher<datatransfer::DataPacket> > >
85  data_publisher;
86  std::shared_ptr<datatransfer::DataPacket> ddt_data_packet;
87 
88  double timestamp_prev;
89  std::string publishing_uri;
90 };
91 
92 } // namespace ddt
93 
94 #endif /* DDTDATAPRODUCER_HPP_ */
ddt::DdtDataProducer::Publish
void Publish(DataPacket data_packet)
Definition: ddtDataProducer.cpp:70
ddt::DdtDataProducer
Definition: ddtDataProducer.hpp:33
ddt::DdtLogger
Definition: ddtLogger.hpp:48
ddt
Definition: ddtClient.hpp:36
ddtProducerConsumerBase.hpp
ddt::DataPacket
Definition: ddtMemoryAccessor.hpp:212
ddt::DdtProducerConsumerBase::NotificationType
NotificationType
Definition: ddtProducerConsumerBase.hpp:59
ddt::DdtDataProducer::DdtDataProducer
DdtDataProducer(DdtLogger *logger)
Definition: ddtDataProducer.cpp:21
ddt::DdtProducerConsumerBase
Definition: ddtProducerConsumerBase.hpp:40
ddt::DdtDataProducer::~DdtDataProducer
~DdtDataProducer() override
ddt::DdtProducerConsumerBase::logger
DdtLogger * logger
Definition: ddtProducerConsumerBase.hpp:123
ddt::DdtDataProducer::Notify
void Notify(const NotificationType type) override
Definition: ddtDataProducer.cpp:114
ddt::DdtDataProducer::get_publishing_uri
std::string get_publishing_uri() const
Definition: ddtDataProducer.cpp:153