1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 20:20: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)
{
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 <iostream>
#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}
@ -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;
if (use_protobuf == false)
{
std::ostringstream archive_stream;
boost::archive::binary_oarchive oa{archive_stream};
oa << *monitor_pvt_.get();
oa << *monitor_pvt;
outbound_data = archive_stream.str();
}
else
{
outbound_data = serdes.createProtobuffer(monitor_pvt_);
outbound_data = serdes.createProtobuffer(monitor_pvt);
}
for (const auto& endpoint : endpoints)

View File

@ -38,7 +38,7 @@ class Monitor_Pvt_Udp_Sink
{
public:
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:
b_io_context io_context;
@ -46,7 +46,6 @@ private:
boost::system::error_code error;
std::vector<boost::asio::ip::udp::endpoint> endpoints;
Serdes_Monitor_Pvt serdes;
std::shared_ptr<Monitor_Pvt> monitor_pvt_;
bool use_protobuf;
};

View File

@ -71,7 +71,7 @@ public:
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();