mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-12 15:56:02 +00:00
Move receiver_type from PVT/adapters to PVT/libs, make it buildable with pre C++17
This commit is contained in:
@@ -10,14 +10,12 @@ if(USE_CMAKE_TARGET_SOURCES)
|
|||||||
target_sources(pvt_adapters
|
target_sources(pvt_adapters
|
||||||
PRIVATE
|
PRIVATE
|
||||||
rtklib_pvt.cc
|
rtklib_pvt.cc
|
||||||
receiver_type.cc
|
|
||||||
PUBLIC
|
PUBLIC
|
||||||
rtklib_pvt.h
|
rtklib_pvt.h
|
||||||
receiver_type.h
|
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
source_group(Headers FILES rtklib_pvt.h receiver_type.h)
|
source_group(Headers FILES rtklib_pvt.h)
|
||||||
add_library(pvt_adapters rtklib_pvt.cc rtklib_pvt.h receiver_type.h receiver_type.cc)
|
add_library(pvt_adapters rtklib_pvt.cc rtklib_pvt.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(pvt_adapters
|
target_link_libraries(pvt_adapters
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "galileo_almanac.h" // for Galileo_Almanac
|
#include "galileo_almanac.h" // for Galileo_Almanac
|
||||||
#include "galileo_ephemeris.h" // for Galileo_Ephemeris
|
#include "galileo_ephemeris.h" // for Galileo_Ephemeris
|
||||||
#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version
|
#include "gnss_sdr_flags.h" // for FLAGS_RINEX_version
|
||||||
|
#include "gnss_sdr_string_literals.h" // for std::string_literals in C++11
|
||||||
#include "gps_almanac.h" // for Gps_Almanac
|
#include "gps_almanac.h" // for Gps_Almanac
|
||||||
#include "gps_ephemeris.h" // for Gps_Ephemeris
|
#include "gps_ephemeris.h" // for Gps_Ephemeris
|
||||||
#include "pvt_conf.h" // for Pvt_Conf
|
#include "pvt_conf.h" // for Pvt_Conf
|
||||||
|
@@ -24,6 +24,7 @@ set(PVT_LIB_SOURCES
|
|||||||
has_simple_printer.cc
|
has_simple_printer.cc
|
||||||
geohash.cc
|
geohash.cc
|
||||||
pvt_kf.cc
|
pvt_kf.cc
|
||||||
|
receiver_type.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PVT_LIB_HEADERS
|
set(PVT_LIB_HEADERS
|
||||||
@@ -47,6 +48,7 @@ set(PVT_LIB_HEADERS
|
|||||||
has_simple_printer.h
|
has_simple_printer.h
|
||||||
geohash.h
|
geohash.h
|
||||||
pvt_kf.h
|
pvt_kf.h
|
||||||
|
receiver_type.h
|
||||||
)
|
)
|
||||||
|
|
||||||
list(SORT PVT_LIB_HEADERS)
|
list(SORT PVT_LIB_HEADERS)
|
||||||
@@ -159,6 +161,16 @@ if(Boost_VERSION_STRING VERSION_LESS 1.71.0)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if((CMAKE_CXX_STANDARD AND CMAKE_CXX_STANDARD VERSION_LESS 17) OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0") OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0") OR
|
||||||
|
(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10.0"))
|
||||||
|
target_compile_definitions(pvt_libs
|
||||||
|
PUBLIC
|
||||||
|
-DNO_FOLD_EXPRESSIONS=1
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_property(TARGET pvt_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
set_property(TARGET pvt_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
)
|
)
|
||||||
|
@@ -33,8 +33,15 @@ Signal_Enabled_Flags::Signal_Enabled_Flags(const ConfigurationInterface* configu
|
|||||||
{BDS_B1, "Channels_B1.count"},
|
{BDS_B1, "Channels_B1.count"},
|
||||||
{BDS_B3, "Channels_B3.count"}};
|
{BDS_B3, "Channels_B3.count"}};
|
||||||
|
|
||||||
|
#if NO_FOLD_EXPRESSIONS
|
||||||
|
for (const auto& pair_aux : signal_flag_to_prop)
|
||||||
|
{
|
||||||
|
auto flag = pair_aux.first;
|
||||||
|
auto prop = pair_aux.second;
|
||||||
|
#else
|
||||||
for (const auto& [flag, prop] : signal_flag_to_prop)
|
for (const auto& [flag, prop] : signal_flag_to_prop)
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
const auto enabled = configuration->property(prop, 0) > 0;
|
const auto enabled = configuration->property(prop, 0) > 0;
|
||||||
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
@@ -44,6 +51,7 @@ Signal_Enabled_Flags::Signal_Enabled_Flags(const ConfigurationInterface* configu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t get_type_of_receiver(const Signal_Enabled_Flags& signal_enabled_flags)
|
uint32_t get_type_of_receiver(const Signal_Enabled_Flags& signal_enabled_flags)
|
||||||
{
|
{
|
||||||
if (signal_enabled_flags.check_only_enabled(GPS_1C))
|
if (signal_enabled_flags.check_only_enabled(GPS_1C))
|
@@ -41,6 +41,31 @@ class Signal_Enabled_Flags
|
|||||||
public:
|
public:
|
||||||
explicit Signal_Enabled_Flags(const ConfigurationInterface* configuration);
|
explicit Signal_Enabled_Flags(const ConfigurationInterface* configuration);
|
||||||
|
|
||||||
|
#if NO_FOLD_EXPRESSIONS
|
||||||
|
template <typename T>
|
||||||
|
uint32_t or_all(const T& value) const
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename... Args>
|
||||||
|
uint32_t or_all(const T& first, const Args&... rest) const
|
||||||
|
{
|
||||||
|
return first | or_all(rest...);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
bool check_only_enabled(const Args&... args) const
|
||||||
|
{
|
||||||
|
return (flags_ ^ or_all(args...)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
bool check_any_enabled(const Args&... args) const
|
||||||
|
{
|
||||||
|
return (flags_ & or_all(args...)) > 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
bool check_only_enabled(const Args&... args) const
|
bool check_only_enabled(const Args&... args) const
|
||||||
{
|
{
|
||||||
@@ -52,6 +77,7 @@ public:
|
|||||||
{
|
{
|
||||||
return (flags_ & (args | ...)) > 0;
|
return (flags_ & (args | ...)) > 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t flags_;
|
uint32_t flags_;
|
Reference in New Issue
Block a user