Prepare for boost::any to std::any transition

This commit is contained in:
Carles Fernandez 2022-06-11 13:55:12 +02:00
parent 56d44335c2
commit 5ec7548886
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
7 changed files with 43 additions and 27 deletions

View File

@ -1212,7 +1212,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->gps_iono = *gps_iono;
}
DLOG(INFO) << "New IONO record has arrived ";
DLOG(INFO) << "New IONO record has arrived";
}
else if (msg_type_hash_code == d_gps_utc_model_sptr_type_hash_code)
{
@ -1223,7 +1223,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->gps_utc_model = *gps_utc_model;
}
DLOG(INFO) << "New UTC record has arrived ";
DLOG(INFO) << "New UTC record has arrived";
}
else if (msg_type_hash_code == d_gps_cnav_ephemeris_sptr_type_hash_code)
{
@ -1263,7 +1263,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
<< " does not report a healthy status in the CNAV message,"
<< " use PVT solutions at your own risk.\n";
}
DLOG(INFO) << "New GPS CNAV ephemeris record has arrived ";
DLOG(INFO) << "New GPS CNAV ephemeris record has arrived";
}
else if (msg_type_hash_code == d_gps_cnav_iono_sptr_type_hash_code)
{
@ -1274,7 +1274,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->gps_cnav_iono = *gps_cnav_iono;
}
DLOG(INFO) << "New CNAV IONO record has arrived ";
DLOG(INFO) << "New CNAV IONO record has arrived";
}
else if (msg_type_hash_code == d_gps_cnav_utc_model_sptr_type_hash_code)
{
@ -1284,7 +1284,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model;
}
DLOG(INFO) << "New CNAV UTC record has arrived ";
DLOG(INFO) << "New CNAV UTC record has arrived";
}
else if (msg_type_hash_code == d_gps_almanac_sptr_type_hash_code)
@ -1296,7 +1296,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->gps_almanac_map[gps_almanac->PRN] = *gps_almanac;
}
DLOG(INFO) << "New GPS almanac record has arrived ";
DLOG(INFO) << "New GPS almanac record has arrived";
}
// *********************** Galileo telemetry ***********************
@ -1359,7 +1359,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->galileo_iono = *galileo_iono;
}
DLOG(INFO) << "New IONO record has arrived ";
DLOG(INFO) << "New IONO record has arrived";
}
else if (msg_type_hash_code == d_galileo_utc_model_sptr_type_hash_code)
{
@ -1370,7 +1370,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->galileo_utc_model = *galileo_utc_model;
}
DLOG(INFO) << "New UTC record has arrived ";
DLOG(INFO) << "New UTC record has arrived";
}
else if (msg_type_hash_code == d_galileo_almanac_helper_sptr_type_hash_code)
{
@ -1404,7 +1404,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
d_user_pvt_solver->galileo_almanac_map[sv3.PRN] = sv3;
}
}
DLOG(INFO) << "New Galileo Almanac data have arrived ";
DLOG(INFO) << "New Galileo Almanac data have arrived";
}
else if (msg_type_hash_code == d_galileo_almanac_sptr_type_hash_code)
{
@ -1467,7 +1467,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->glonass_gnav_utc_model = *glonass_gnav_utc_model;
}
DLOG(INFO) << "New GLONASS GNAV UTC record has arrived ";
DLOG(INFO) << "New GLONASS GNAV UTC record has arrived";
}
else if (msg_type_hash_code == d_glonass_gnav_almanac_sptr_type_hash_code)
{
@ -1478,7 +1478,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->glonass_gnav_almanac = *glonass_gnav_almanac;
}
DLOG(INFO) << "New GLONASS GNAV Almanac has arrived "
DLOG(INFO) << "New GLONASS GNAV Almanac has arrived"
<< ", GLONASS GNAV Slot Number =" << glonass_gnav_almanac->d_n_A;
}
@ -1535,7 +1535,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->beidou_dnav_iono = *bds_dnav_iono;
}
DLOG(INFO) << "New BeiDou DNAV IONO record has arrived ";
DLOG(INFO) << "New BeiDou DNAV IONO record has arrived";
}
else if (msg_type_hash_code == d_beidou_dnav_utc_model_sptr_type_hash_code)
{
@ -1546,7 +1546,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->beidou_dnav_utc_model = *bds_dnav_utc_model;
}
DLOG(INFO) << "New BeiDou DNAV UTC record has arrived ";
DLOG(INFO) << "New BeiDou DNAV UTC record has arrived";
}
else if (msg_type_hash_code == d_beidou_dnav_almanac_sptr_type_hash_code)
{
@ -1557,7 +1557,7 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
{
d_user_pvt_solver->beidou_dnav_almanac_map[bds_dnav_almanac->PRN] = *bds_dnav_almanac;
}
DLOG(INFO) << "New BeiDou DNAV almanac record has arrived ";
DLOG(INFO) << "New BeiDou DNAV almanac record has arrived";
}
else
{
@ -1968,7 +1968,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{
if (pmt::any_ref(it.value).type().hash_code() == typeid(const std::shared_ptr<GnssTime>).hash_code())
{
const auto timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
const auto timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
// std::cout << "PVT timetag: " << timetag->rx_time << '\n';
d_TimeChannelTagTimestamps.push(*timetag);
}
@ -1977,7 +1977,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
std::cout << "hash code not match\n";
}
}
catch (const boost::bad_any_cast& e)
catch (const wht::bad_any_cast& e)
{
std::cout << "msg Bad any_cast: " << e.what();
}

View File

@ -34,6 +34,7 @@ target_link_libraries(obs_gr_blocks
Gflags::gflags
Glog::glog
Matio::matio
Gnuradio::pmt
)
if(GNURADIO_USES_SPDLOG)

View File

@ -26,6 +26,7 @@
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
#include <pmt/pmt.h>
#include <algorithm> // for std::min
#include <array>
#include <cmath> // for round
@ -694,7 +695,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
{
if (pmt::any_ref(it.value).type().hash_code() == typeid(const std::shared_ptr<GnssTime>).hash_code())
{
const auto timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
const auto timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
// std::cout << "[Time ch ] timetag: " << timetag->rx_time << "\n";
d_TimeChannelTagTimestamps.push(*timetag);
}
@ -703,7 +704,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
std::cout << "hash code not match\n";
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
std::cout << "msg Bad any_cast: " << e.what();
}
@ -725,7 +726,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
// {
// if (pmt::any_ref(it->value).type().hash_code() == typeid(const std::shared_ptr<GnssTime>).hash_code())
// {
// const std::shared_ptr<GnssTime> timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it->value));
// const std::shared_ptr<GnssTime> timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it->value));
// //std::cout << "[ch " << n << "] timetag: " << timetag->rx_time << "\n";
// d_SourceTagTimestamps.at(n).push(*timetag);
// }
@ -734,7 +735,7 @@ int hybrid_observables_gs::general_work(int noutput_items __attribute__((unused)
// std::cout << "hash code not match\n";
// }
// }
// catch (const boost::bad_any_cast &e)
// catch (const wht::bad_any_cast &e)
// {
// std::cout << "msg Bad any_cast: " << e.what();
// }

View File

@ -51,6 +51,13 @@ auto rotl = [](uint32_t x, uint32_t n) { return (((x) << (n)) ^ ((x) >> (32 - (n
} // namespace my_rotl
#endif
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
gps_l1_ca_telemetry_decoder_gs_sptr
gps_l1_ca_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf)
@ -605,7 +612,7 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
{
if (pmt::any_ref(it.value).type().hash_code() == typeid(const std::shared_ptr<GnssTime>).hash_code())
{
const auto timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
const auto timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
// std::cout << "[" << this->nitems_written(0) + 1 << "] TLM RX TimeTag Week: " << timetag->week << ", TOW: " << timetag->tow_ms << " [ms], TOW fraction: " << timetag->tow_ms_fraction
// << " [ms], DELTA TLM TOW: " << static_cast<double>(timetag->tow_ms - current_symbol.TOW_at_current_symbol_ms) + timetag->tow_ms_fraction << " [ms] \n";
add_item_tag(0, this->nitems_written(0) + 1, pmt::mp("timetag"), pmt::make_any(timetag));
@ -615,12 +622,11 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
std::cout << "hash code not match\n";
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
std::cout << "msg Bad any_cast: " << e.what();
}
}
if (d_dump == true)
{
// MULTIPLEXED FILE RECORDING - Record results to file

View File

@ -2024,7 +2024,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
{
// std::cout << "ch[" << d_acquisition_gnss_synchro->Channel_ID << "] tracking time tag with offset " << it->offset << " vs. counter " << d_sample_counter << " vs. nread " << this->nitems_read(0) << " containing ";
// std::cout << "ch[" << d_acquisition_gnss_synchro->Channel_ID << "] tracking time tag with offset " << it->offset << " vs. nread " << this->nitems_read(0) << " containing ";
const auto last_timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
const auto last_timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
d_last_timetag = *last_timetag;
d_last_timetag_samplecounter = it.offset;
d_timetag_waiting = true;
@ -2034,7 +2034,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
std::cout << "hash code not match\n";
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
std::cout << "msg Bad any_cast: " << e.what();
}

View File

@ -83,6 +83,7 @@ endif()
target_link_libraries(core_libs
PUBLIC
Boost::headers
Gnuradio::blocks
Gnuradio::runtime
Gnuradio::pmt

View File

@ -27,6 +27,13 @@
#include <string> // for string
#include <vector>
#if PMT_USES_BOOST_ANY
#include <boost/any.hpp>
namespace wht = boost;
#else
#include <any>
namespace wht = std;
#endif
gnss_sdr_sample_counter::gnss_sdr_sample_counter(
double _fs,
@ -156,7 +163,7 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
{
// recompute timestamp to match the last sample in the consumed samples in this batch
int64_t diff_samplecount = uint64diff(out[0].Tracking_sample_counter, it.offset);
const auto last_timetag = boost::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
const auto last_timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
double intpart;
last_timetag->tow_ms_fraction += modf(1000.0 * static_cast<double>(diff_samplecount) / fs, &intpart);
@ -172,7 +179,7 @@ int gnss_sdr_sample_counter::work(int noutput_items __attribute__((unused)),
std::cout << "hash code not match\n";
}
}
catch (const boost::bad_any_cast &e)
catch (const wht::bad_any_cast &e)
{
std::cout << "msg Bad any_cast: " << e.what();
}