1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * @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:
- bool m_initialized;
- 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();
- };
- }
|