Files
aman-es/include/aman/com/AircraftReporter.h
2021-08-19 08:20:20 +02:00

54 lines
1.4 KiB
C++

/*
* @brief Defines the aircraft reporter module to communicate with the backend
* @file aman/com/AircraftReporter.h
* @author Sven Czarnian <devel@svcz.de>
* @copyright Copyright 2021 Sven Czarnian
* @license This project is published under the GNU General Public License v3 (GPLv3)
*/
#pragma once
#include <zmq.hpp>
#include <aman/types/Communication.h>
namespace aman {
/**
* @brief Defines the base class for all file formats
* @ingroup format
*
* The base class provides error information, etc.
*/
class AircraftReporter {
private:
std::unique_ptr<zmq::socket_t> m_socket;
AircraftReporter() noexcept;
template <typename T>
bool setSocketKey(const std::string& key, T entry) {
try {
this->m_socket->set(entry, key);
return true;
}
catch (std::exception&) {
return false;
}
}
public:
AircraftReporter(const AircraftReporter&) = delete;
AircraftReporter(AircraftReporter&&) = delete;
AircraftReporter& operator=(const AircraftReporter&) = delete;
AircraftReporter& operator=(AircraftReporter&&) = delete;
bool initialize(const Communication& configuration);
bool deinitialize();
bool send(zmq::message_t& message);
static AircraftReporter& instance();
bool send(const aman::AircraftReport& report);
};
}