/* * PacketLib.h * * Created on: Nov 24, 2022 * Author: valerio */ #ifndef INCLUDE_INAF_OAS_PACKET_STRUCTURE_JSON_H_ #define INCLUDE_INAF_OAS_PACKET_STRUCTURE_JSON_H_ #include <Base_Packet.h> #include <fstream> #include <fifo_map.hpp> #include <nlohmann/json.hpp> using namespace nlohmann; // A workaround to give to use fifo_map as map, we are just ignoring the 'less' compare template<class K, class V, class dummy_compare, class A> using my_workaround_fifo_map = fifo_map<K, V, fifo_map_compare<K>, A>; using my_json = basic_json<my_workaround_fifo_map>; namespace inaf::oasbo::Packets { class PacketStructureJson : public inaf::oasbo::PacketLib::BasePacketStructure { protected: std::vector<std::tuple<uint, std::string, uint>> convertToTupleVector(const my_json &data, uint &count); public: std::vector<std::tuple<uint, std::string, uint>> readStructureFromSource( std::string source) override; PacketStructureJson(std::string source) : BasePacketStructure(source){ updateStructure(this->source); } PacketStructureJson(const BasePacketStructure &other) : BasePacketStructure(other){ } }; } #endif /* INCLUDE_INAF_OAS_PACKET_STRUCTURE_JSON_H_ */