Improve const correctness

This commit is contained in:
Carles Fernandez 2019-06-29 22:04:03 +02:00
parent dd3b2f11db
commit b6e9ba5877
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
12 changed files with 12 additions and 12 deletions

View File

@ -35,7 +35,7 @@
#include <sstream>
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool protobuf_enabled) : socket{io_context}
{
for (const auto& address : addresses)
{

View File

@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service;
class Monitor_Pvt_Udp_Sink
{
public:
Monitor_Pvt_Udp_Sink(std::vector<std::string> addresses, const uint16_t &port, bool protobuf_enabled);
Monitor_Pvt_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t &port, bool protobuf_enabled);
bool write_monitor_pvt(const Monitor_Pvt &monitor_pvt);
private:

View File

@ -283,7 +283,7 @@ bool Nmea_Printer::Print_Nmea_Line(const std::shared_ptr<Rtklib_Solver>& pvt_dat
}
char Nmea_Printer::checkSum(std::string sentence)
char Nmea_Printer::checkSum(const std::string& sentence)
{
char check = 0;
// iterate over the string, XOR each byte with the total sum:

View File

@ -83,7 +83,7 @@ private:
std::string get_UTC_NMEA_time(boost::posix_time::ptime d_position_UTC_time);
std::string longitude_to_hm(double longitude);
std::string latitude_to_hm(double lat);
char checkSum(std::string sentence);
char checkSum(const std::string& sentence);
bool print_avg_pos;
bool d_flag_nmea_output_file;
};

View File

@ -64,7 +64,7 @@ int INIReader::ParseError()
}
std::string INIReader::Get(const std::string& section, const std::string& name, std::string default_value)
std::string INIReader::Get(const std::string& section, const std::string& name, const std::string& default_value)
{
std::string key = MakeKey(section, name);
return _values.count(key) ? _values[key] : default_value;

View File

@ -67,7 +67,7 @@ public:
//! Get a string value from INI file, returning default_value if not found.
std::string Get(const std::string& section, const std::string& name,
std::string default_value);
const std::string& default_value);
//! Get an integer (long) value from INI file, returning default_value if not found.
int64_t GetInteger(const std::string& section, const std::string& name, int64_t default_value);

View File

@ -35,7 +35,7 @@
#include <iostream>
#include <sstream>
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf) : socket{io_context}
Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf) : socket{io_context}
{
use_protobuf = enable_protobuf;
if (enable_protobuf)

View File

@ -53,7 +53,7 @@ using b_io_context = boost::asio::io_service;
class Gnss_Synchro_Udp_Sink
{
public:
Gnss_Synchro_Udp_Sink(std::vector<std::string> addresses, const uint16_t& port, bool enable_protobuf);
Gnss_Synchro_Udp_Sink(const std::vector<std::string>& addresses, const uint16_t& port, bool enable_protobuf);
bool write_gnss_synchro(const std::vector<Gnss_Synchro>& stocks);
private:

View File

@ -1511,7 +1511,7 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what)
}
void GNSSFlowgraph::priorize_satellites(std::vector<std::pair<int, Gnss_Satellite>> visible_satellites)
void GNSSFlowgraph::priorize_satellites(const std::vector<std::pair<int, Gnss_Satellite>>& visible_satellites)
{
size_t old_size;
Gnss_Signal gs;

View File

@ -142,7 +142,7 @@ public:
/*!
* \brief Priorize visible satellites in the specified vector
*/
void priorize_satellites(std::vector<std::pair<int, Gnss_Satellite>> visible_satellites);
void priorize_satellites(const std::vector<std::pair<int, Gnss_Satellite>>& visible_satellites);
private:
void init(); // Populates the SV PRN list available for acquisition and tracking

View File

@ -128,7 +128,7 @@ void InMemoryConfiguration::set_property(std::string property_name, std::string
}
void InMemoryConfiguration::supersede_property(std::string property_name, std::string value)
void InMemoryConfiguration::supersede_property(const std::string& property_name, const std::string& value)
{
properties_.erase(property_name);
properties_.insert(std::make_pair(property_name, value));

View File

@ -66,7 +66,7 @@ public:
float property(std::string property_name, float default_value);
double property(std::string property_name, double default_value);
void set_property(std::string property_name, std::string value);
void supersede_property(std::string property_name, std::string value);
void supersede_property(const std::string& property_name, const std::string& value);
bool is_present(const std::string& property_name);
private: