1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Use lambda instead of boost::build when genenic lambdas are available in the compiler

This commit is contained in:
Carles Fernandez 2020-04-25 22:17:15 +02:00
parent fdb0f35116
commit 9c9a7b5bc6
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
16 changed files with 175 additions and 24 deletions

View File

@ -49,6 +49,21 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(pvt_gr_blocks
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(pvt_gr_blocks
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(pvt_gr_blocks

View File

@ -54,7 +54,6 @@
#include <boost/any.hpp> // for any_cast, any
#include <boost/archive/xml_iarchive.hpp> // for xml_iarchive
#include <boost/archive/xml_oarchive.hpp> // for xml_oarchive
#include <boost/bind/bind.hpp> // for bind_t, bind
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/exception.hpp>
#include <boost/serialization/map.hpp>
@ -75,6 +74,11 @@
#include <sys/ipc.h> // for IPC_CREAT
#include <sys/msg.h> // for msgctl
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#if HAS_STD_FILESYSTEM
#include <system_error>
namespace errorlib = std;
@ -186,8 +190,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
// GPS Ephemeris data message port in
this->message_port_register_in(pmt::mp("telemetry"));
this->set_msg_handler(pmt::mp("telemetry"), boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
this->set_msg_handler(pmt::mp("telemetry"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_telemetry(PH1); });
#else
boost::bind(&rtklib_pvt_gs::msg_handler_telemetry, this, _1));
#endif
// initialize kml_printer
std::string kml_dump_filename;
kml_dump_filename = d_dump_filename;

View File

@ -47,6 +47,21 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(channel_libs
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(channel_libs
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(channel_libs

View File

@ -20,13 +20,16 @@
#include "channel_msg_receiver_cc.h"
#include <boost/any.hpp>
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/gr_complex.h>
#include <gnuradio/io_signature.h>
#include <cstdint>
#include <utility>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat)
{
@ -37,7 +40,12 @@ channel_msg_receiver_cc_sptr channel_msg_receiver_make_cc(std::shared_ptr<Channe
channel_msg_receiver_cc::channel_msg_receiver_cc(std::shared_ptr<ChannelFsm> channel_fsm, bool repeat) : gr::block("channel_msg_receiver_cc", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
this->message_port_register_in(pmt::mp("events"));
this->set_msg_handler(pmt::mp("events"), boost::bind(&channel_msg_receiver_cc::msg_handler_events, this, _1));
this->set_msg_handler(pmt::mp("events"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_events(PH1); });
#else
boost::bind(&channel_msg_receiver_cc::msg_handler_events, this, _1));
#endif
d_channel_fsm = std::move(channel_fsm);
d_repeat = repeat;

View File

@ -53,6 +53,21 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(obs_gr_blocks
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(obs_gr_blocks
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(obs_gr_blocks

View File

@ -35,6 +35,11 @@
#include <limits> // for numeric_limits
#include <utility> // for move
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#if HAS_STD_FILESYSTEM
#include <system_error>
namespace errorlib = std;
@ -67,8 +72,12 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_) : gr::block(
{
// PVT input message port
this->message_port_register_in(pmt::mp("pvt_to_observables"));
this->set_msg_handler(pmt::mp("pvt_to_observables"), boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1));
this->set_msg_handler(pmt::mp("pvt_to_observables"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_pvt_to_observables(PH1); });
#else
boost::bind(&hybrid_observables_gs::msg_handler_pvt_to_observables, this, _1));
#endif
// Send Channel status to gnss_flowgraph
this->message_port_register_out(pmt::mp("status"));
d_conf = conf_;

View File

@ -115,6 +115,21 @@ if(ENABLE_ARMA_NO_DEBUG)
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(tracking_gr_blocks
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(tracking_gr_blocks
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(tracking_gr_blocks

View File

@ -60,6 +60,11 @@
#include <numeric>
#include <vector>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
@ -92,7 +97,13 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
// Telemetry message port input
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
this->set_msg_handler(pmt::mp("telemetry_to_trk"), boost::bind(&dll_pll_veml_tracking::msg_handler_telemetry_to_trk, this, _1));
this->set_msg_handler(
pmt::mp("telemetry_to_trk"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_telemetry_to_trk(PH1); });
#else
boost::bind(&dll_pll_veml_tracking::msg_handler_telemetry_to_trk, this, _1));
#endif
// initialize internal vars
d_dll_filt_history.set_capacity(1000);

View File

@ -51,6 +51,11 @@
#include <numeric>
#include <vector>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#if HAS_STD_FILESYSTEM
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
@ -83,8 +88,12 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
// Telemetry message port input
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
this->set_msg_handler(pmt::mp("telemetry_to_trk"), boost::bind(&dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk, this, _1));
this->set_msg_handler(pmt::mp("telemetry_to_trk"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_telemetry_to_trk(PH1); });
#else
boost::bind(&dll_pll_veml_tracking_fpga::msg_handler_telemetry_to_trk, this, _1));
#endif
// initialize internal vars
d_dll_filt_history.set_capacity(1000);
d_veml = false;

View File

@ -32,7 +32,6 @@
#include "gnss_sdr_flags.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -48,6 +47,10 @@
#include <utility>
#include <vector>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#define CN0_ESTIMATION_SAMPLES 10
@ -109,8 +112,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
#endif
this->message_port_register_out(pmt::mp("events"));
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
// initialize internal vars

View File

@ -32,7 +32,6 @@
#include "gnss_sdr_flags.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -46,6 +45,11 @@
#include <utility>
#include <vector>
#if HAS_GENERIC_LAMBDA
#else
#include <boost/bind.hpp>
#endif
#define CN0_ESTIMATION_SAMPLES 10
@ -105,7 +109,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
// Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
boost::bind(&glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
#endif
this->message_port_register_out(pmt::mp("events"));
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
// initialize internal vars

View File

@ -30,7 +30,6 @@
#include "gnss_sdr_flags.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -105,8 +104,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
boost::bind(&glonass_l2_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
#endif
this->message_port_register_out(pmt::mp("events"));
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
// initialize internal vars

View File

@ -30,7 +30,6 @@
#include "gnss_sdr_flags.h"
#include "lock_detectors.h"
#include "tracking_discriminators.h"
#include <boost/bind.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <matio.h>
@ -103,7 +102,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
// Telemetry bit synchronization message port input
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
#if HAS_GENERIC_LAMBDA
[this](auto &&PH1) { msg_handler_preamble_index(PH1); });
#else
boost::bind(&glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index, this, _1));
#endif
this->message_port_register_out(pmt::mp("events"));
this->message_port_register_in(pmt::mp("telemetry_to_trk"));
// initialize internal vars

View File

@ -71,6 +71,21 @@ if(GNURADIO_USES_STD_POINTERS)
)
endif()
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(core_libs
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(core_libs
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)
set_target_properties(core_libs

View File

@ -37,7 +37,12 @@ channel_status_msg_receiver_sptr channel_status_msg_receiver_make()
channel_status_msg_receiver::channel_status_msg_receiver() : gr::block("channel_status_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
{
this->message_port_register_in(pmt::mp("status"));
this->set_msg_handler(pmt::mp("status"), boost::bind(&channel_status_msg_receiver::msg_handler_events, this, _1));
this->set_msg_handler(pmt::mp("status"),
#if HAS_GENERIC_LAMBDA
[this](auto&& PH1) { msg_handler_events(PH1); });
#else
boost::bind(&channel_status_msg_receiver::msg_handler_events, this, _1));
#endif
d_pvt_status.RX_time = -1; // to indicate that the PVT is not available
}

View File

@ -76,13 +76,20 @@ target_compile_definitions(front-end-cal
PUBLIC -DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}"
)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(front-end-cal
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
if(CMAKE_VERSION VERSION_GREATER 3.1)
set(has_generic_lambdas HAS_GENERIC_LAMBDA=1)
set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0)
target_compile_definitions(front-end-cal
PRIVATE
"$<$<COMPILE_FEATURES:cxx_generic_lambdas>:${has_generic_lambdas}>"
"$<$<NOT:$<COMPILE_FEATURES:cxx_generic_lambdas>>:${no_has_generic_lambdas}>"
)
else()
target_compile_definitions(front-end-cal
PRIVATE
-DHAS_GENERIC_LAMBDA=0
)
endif()
if(ENABLE_CLANG_TIDY)
if(CLANG_TIDY_EXE)