From 077990faa8cea8ee8edeaac61622f064fa6a9180 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Apr 2021 14:47:36 +0200 Subject: [PATCH] Pass bits by reference --- .../beidou_dnav_navigation_message.cc | 6 +++--- .../system_parameters/beidou_dnav_navigation_message.h | 6 +++--- src/core/system_parameters/galileo_cnav_message.cc | 10 +++++----- src/core/system_parameters/galileo_cnav_message.h | 10 +++++----- src/core/system_parameters/galileo_fnav_message.cc | 6 +++--- src/core/system_parameters/galileo_fnav_message.h | 6 +++--- .../glonass_gnav_navigation_message.cc | 8 ++++---- .../glonass_gnav_navigation_message.h | 8 ++++---- .../system_parameters/gps_cnav_navigation_message.cc | 8 ++++---- .../system_parameters/gps_cnav_navigation_message.h | 8 ++++---- src/core/system_parameters/gps_navigation_message.cc | 6 +++--- src/core/system_parameters/gps_navigation_message.h | 6 +++--- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.cc b/src/core/system_parameters/beidou_dnav_navigation_message.cc index 6653e96b2..bcd32f639 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.cc +++ b/src/core/system_parameters/beidou_dnav_navigation_message.cc @@ -45,7 +45,7 @@ void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(uint32_t BEIDOU_wor bool Beidou_Dnav_Navigation_Message::read_navigation_bool( - std::bitset bits, + const std::bitset& bits, const std::vector>& parameter) const { bool value; @@ -63,7 +63,7 @@ bool Beidou_Dnav_Navigation_Message::read_navigation_bool( uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned( - std::bitset bits, + const std::bitset& bits, const std::vector>& parameter) const { uint64_t value = 0ULL; @@ -84,7 +84,7 @@ uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned( int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed( - std::bitset bits, + const std::bitset& bits, const std::vector>& parameter) const { int64_t value = 0; diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.h b/src/core/system_parameters/beidou_dnav_navigation_message.h index b9f93c9da..775094c14 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.h +++ b/src/core/system_parameters/beidou_dnav_navigation_message.h @@ -138,9 +138,9 @@ public: } private: - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const; - int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter) const; - bool read_navigation_bool(std::bitset bits, const std::vector>& parameter) const; + uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; + int64_t read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const; + bool read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const; void print_beidou_word_bytes(uint32_t BEIDOU_word) const; // broadcast orbit 1 diff --git a/src/core/system_parameters/galileo_cnav_message.cc b/src/core/system_parameters/galileo_cnav_message.cc index 5d869a0d5..5c170b729 100644 --- a/src/core/system_parameters/galileo_cnav_message.cc +++ b/src/core/system_parameters/galileo_cnav_message.cc @@ -26,7 +26,7 @@ using CRC_Galileo_CNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; -bool Galileo_Cnav_Message::CRC_test(std::bitset bits, uint32_t checksum) const +bool Galileo_Cnav_Message::CRC_test(const std::bitset& bits, uint32_t checksum) const { CRC_Galileo_CNAV_type CRC_Galileo; @@ -568,7 +568,7 @@ void Galileo_Cnav_Message::read_MT1_body(const std::string& message_string) } -uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(std::bitset bits, const std::pair& parameter) const +uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(const std::bitset& bits, const std::pair& parameter) const { uint8_t value = 0U; for (int j = 0; j < parameter.second; j++) @@ -583,7 +583,7 @@ uint8_t Galileo_Cnav_Message::read_has_page_header_parameter(std::bitset bits, const std::pair& parameter) const +uint8_t Galileo_Cnav_Message::read_has_message_header_parameter_uint8(const std::bitset& bits, const std::pair& parameter) const { uint8_t value = 0U; for (int j = 0; j < parameter.second; j++) @@ -598,7 +598,7 @@ uint8_t Galileo_Cnav_Message::read_has_message_header_parameter_uint8(std::bitse } -uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(std::bitset bits, const std::pair& parameter) const +uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(const std::bitset& bits, const std::pair& parameter) const { uint16_t value = 0U; for (int j = 0; j < parameter.second; j++) @@ -613,7 +613,7 @@ uint16_t Galileo_Cnav_Message::read_has_message_header_parameter_uint16(std::bit } -bool Galileo_Cnav_Message::read_has_message_header_parameter_bool(std::bitset bits, const std::pair& parameter) const +bool Galileo_Cnav_Message::read_has_message_header_parameter_bool(const std::bitset& bits, const std::pair& parameter) const { bool value = false; if (static_cast(bits[GALILEO_CNAV_MT1_HEADER_BITS - parameter.first]) == 1) diff --git a/src/core/system_parameters/galileo_cnav_message.h b/src/core/system_parameters/galileo_cnav_message.h index c557185f2..4d0b8bead 100644 --- a/src/core/system_parameters/galileo_cnav_message.h +++ b/src/core/system_parameters/galileo_cnav_message.h @@ -67,17 +67,17 @@ public: } private: - bool CRC_test(std::bitset bits, uint32_t checksum) const; + bool CRC_test(const std::bitset& bits, uint32_t checksum) const; void read_HAS_page_header(const std::string& page_string); void process_HAS_page(const std::string& page_string); void read_MT1_header(const std::string& message_string); void read_MT1_body(const std::string& message_string); int decode_message_type1(); - uint8_t read_has_page_header_parameter(std::bitset bits, const std::pair& parameter) const; - uint8_t read_has_message_header_parameter_uint8(std::bitset bits, const std::pair& parameter) const; - uint16_t read_has_message_header_parameter_uint16(std::bitset bits, const std::pair& parameter) const; - bool read_has_message_header_parameter_bool(std::bitset bits, const std::pair& parameter) const; + uint8_t read_has_page_header_parameter(const std::bitset& bits, const std::pair& parameter) const; + uint8_t read_has_message_header_parameter_uint8(const std::bitset& bits, const std::pair& parameter) const; + uint16_t read_has_message_header_parameter_uint16(const std::bitset& bits, const std::pair& parameter) const; + bool read_has_message_header_parameter_bool(const std::bitset& bits, const std::pair& parameter) const; uint8_t read_has_message_body_uint8(const std::string& bits) const; uint16_t read_has_message_body_uint16(const std::string& bits) const; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index d09f7e066..9877269a0 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -50,7 +50,7 @@ void Galileo_Fnav_Message::split_page(const std::string& page_string) } -bool Galileo_Fnav_Message::_CRC_test(std::bitset bits, uint32_t checksum) const +bool Galileo_Fnav_Message::_CRC_test(const std::bitset& bits, uint32_t checksum) const { CRC_Galileo_FNAV_type CRC_Galileo; @@ -279,7 +279,7 @@ void Galileo_Fnav_Message::decode_page(const std::string& data) } -uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +uint64_t Galileo_Fnav_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const { uint64_t value = 0ULL; const int num_of_slices = parameter.size(); @@ -298,7 +298,7 @@ uint64_t Galileo_Fnav_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +int64_t Galileo_Fnav_Message::read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const { int64_t value = 0LL; const int num_of_slices = parameter.size(); diff --git a/src/core/system_parameters/galileo_fnav_message.h b/src/core/system_parameters/galileo_fnav_message.h index eac37f256..7b3ce0b55 100644 --- a/src/core/system_parameters/galileo_fnav_message.h +++ b/src/core/system_parameters/galileo_fnav_message.h @@ -138,10 +138,10 @@ public: } private: - bool _CRC_test(std::bitset bits, uint32_t checksum) const; + bool _CRC_test(const std::bitset& bits, uint32_t checksum) const; void decode_page(const std::string& data); - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const; - int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter) const; + uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; + int64_t read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const; std::string omega0_1{}; // std::string omega0_2{}; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 58c6249a8..d6469898d 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -36,7 +36,7 @@ Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message() } -bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset bits) const +bool Glonass_Gnav_Navigation_Message::CRC_test(const std::bitset& bits) const { uint32_t sum_bits = 0; int32_t sum_hamming = 0; @@ -133,7 +133,7 @@ bool Glonass_Gnav_Navigation_Message::CRC_test(std::bitset bits, const std::vector>& parameter) const +bool Glonass_Gnav_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const { bool value; @@ -149,7 +149,7 @@ bool Glonass_Gnav_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector>& parameter) const +uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const { uint64_t value = 0ULL; const int32_t num_of_slices = parameter.size(); @@ -168,7 +168,7 @@ uint64_t Glonass_Gnav_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +int64_t Glonass_Gnav_Navigation_Message::read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const { int64_t value = 0LL; int64_t sign = 0LL; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.h b/src/core/system_parameters/glonass_gnav_navigation_message.h index 0c69ba903..fcad9c79f 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.h +++ b/src/core/system_parameters/glonass_gnav_navigation_message.h @@ -55,7 +55,7 @@ public: * \brief Compute CRC for GLONASS GNAV strings * \param bits Bits of the string message where to compute CRC */ - bool CRC_test(std::bitset bits) const; + bool CRC_test(const std::bitset& bits) const; /*! * \brief Computes the frame number being decoded given the satellite slot number @@ -170,9 +170,9 @@ public: } private: - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const; - int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter) const; - bool read_navigation_bool(std::bitset bits, const std::vector>& parameter) const; + uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; + int64_t read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const; + bool read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const; Glonass_Gnav_Ephemeris gnav_ephemeris{}; // Ephemeris information decoded Glonass_Gnav_Utc_Model gnav_utc_model{}; // UTC model information diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index 69276a37a..d1513191c 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -34,7 +34,7 @@ Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message() } -bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector>& parameter) const +bool Gps_CNAV_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const { bool value; @@ -50,7 +50,7 @@ bool Gps_CNAV_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector>& parameter) const +uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const { uint64_t value = 0ULL; const int32_t num_of_slices = parameter.size(); @@ -69,7 +69,7 @@ uint64_t Gps_CNAV_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const { int64_t value = 0LL; const int32_t num_of_slices = parameter.size(); @@ -100,7 +100,7 @@ int64_t Gps_CNAV_Navigation_Message::read_navigation_signed(std::bitset data_bits) +void Gps_CNAV_Navigation_Message::decode_page(const std::bitset& data_bits) { int32_t page_type; bool alert_flag; diff --git a/src/core/system_parameters/gps_cnav_navigation_message.h b/src/core/system_parameters/gps_cnav_navigation_message.h index 017eca10c..3c48fdc9e 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.h +++ b/src/core/system_parameters/gps_cnav_navigation_message.h @@ -49,7 +49,7 @@ public: */ Gps_CNAV_Navigation_Message(); - void decode_page(std::bitset data_bits); + void decode_page(const std::bitset& data_bits); /*! * \brief Obtain a GPS SV Ephemeris class filled with current SV data @@ -82,9 +82,9 @@ public: bool have_new_ephemeris(); private: - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const; - int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter) const; - bool read_navigation_bool(std::bitset bits, const std::vector>& parameter) const; + uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; + int64_t read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const; + bool read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const; Gps_CNAV_Ephemeris ephemeris_record{}; Gps_CNAV_Iono iono_record{}; diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 4f3f087d2..ad4f58fe2 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -46,7 +46,7 @@ void Gps_Navigation_Message::print_gps_word_bytes(uint32_t GPS_word) const } -bool Gps_Navigation_Message::read_navigation_bool(std::bitset bits, const std::vector>& parameter) const +bool Gps_Navigation_Message::read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const { bool value; @@ -62,7 +62,7 @@ bool Gps_Navigation_Message::read_navigation_bool(std::bitset } -uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +uint64_t Gps_Navigation_Message::read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const { uint64_t value = 0ULL; const int32_t num_of_slices = parameter.size(); @@ -81,7 +81,7 @@ uint64_t Gps_Navigation_Message::read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const +int64_t Gps_Navigation_Message::read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const { int64_t value = 0LL; const int32_t num_of_slices = parameter.size(); diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 9c423f554..278425738 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -135,9 +135,9 @@ public: bool satellite_validation(); private: - uint64_t read_navigation_unsigned(std::bitset bits, const std::vector>& parameter) const; - int64_t read_navigation_signed(std::bitset bits, const std::vector>& parameter) const; - bool read_navigation_bool(std::bitset bits, const std::vector>& parameter) const; + uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; + int64_t read_navigation_signed(const std::bitset& bits, const std::vector>& parameter) const; + bool read_navigation_bool(const std::bitset& bits, const std::vector>& parameter) const; void print_gps_word_bytes(uint32_t GPS_word) const; std::map almanacHealth; //!< Map that stores the health information stored in the almanac