1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Raw pointer interface for the Monitor_Pvt sink

This commit is contained in:
Carles Fernandez 2020-06-18 20:40:53 +02:00
parent c237f72a51
commit b08082e1be
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 6 additions and 9 deletions

View File

@ -4288,7 +4288,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
if (flag_monitor_pvt_enabled) if (flag_monitor_pvt_enabled)
{ {
udp_sink_ptr->write_monitor_pvt(monitor_pvt); udp_sink_ptr->write_monitor_pvt(monitor_pvt.get());
} }
} }
} }

View File

@ -22,7 +22,6 @@
#include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_oarchive.hpp>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <utility>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context} Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
@ -41,20 +40,19 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addre
} }
bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt) bool Monitor_Pvt_Udp_Sink::write_monitor_pvt(const Monitor_Pvt* monitor_pvt)
{ {
monitor_pvt_ = std::move(monitor_pvt);
std::string outbound_data; std::string outbound_data;
if (use_protobuf == false) if (use_protobuf == false)
{ {
std::ostringstream archive_stream; std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream}; boost::archive::binary_oarchive oa{archive_stream};
oa << *monitor_pvt_.get(); oa << *monitor_pvt;
outbound_data = archive_stream.str(); outbound_data = archive_stream.str();
} }
else else
{ {
outbound_data = serdes.createProtobuffer(monitor_pvt_); outbound_data = serdes.createProtobuffer(monitor_pvt);
} }
for (const auto& endpoint : endpoints) for (const auto& endpoint : endpoints)

View File

@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{ {
public: public:
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled); Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled);
bool write_monitor_pvt(std::shared_ptr<Monitor_Pvt> monitor_pvt); bool write_monitor_pvt(const Monitor_Pvt* monitor_pvt);
private: private:
b_io_context io_context; b_io_context io_context;
@ -46,7 +46,6 @@ private:
boost::system::error_code error; boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints; std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes; Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
bool use_protobuf; bool use_protobuf;
}; };

View File

@ -71,7 +71,7 @@ public:
return *this; return *this;
} }
inline std::string createProtobuffer(std::shared_ptr<Monitor_Pvt> monitor) //!< Serialization into a string inline std::string createProtobuffer(const Monitor_Pvt* monitor) //!< Serialization into a string
{ {
monitor_.Clear(); monitor_.Clear();