From 081c559fc5f2aff0fb5a8c195d5173c7c80b22da Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Wed, 29 May 2013 17:44:27 -0400 Subject: [PATCH] [Positioner] Fix a few small issues Fix three minor performance issues signaled by cppcheck and a couple of problems with Doxygen. --- owlps-positioner/src/positioningalgorithm.hh | 2 +- owlps-positioner/src/request.cc | 6 +++--- owlps-positioner/src/request.hh | 2 +- owlps-positioner/src/stock.cc | 1 - owlps-positioner/src/timestamp.cc | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/owlps-positioner/src/positioningalgorithm.hh b/owlps-positioner/src/positioningalgorithm.hh index 3cc865a..aee5f5b 100644 --- a/owlps-positioner/src/positioningalgorithm.hh +++ b/owlps-positioner/src/positioningalgorithm.hh @@ -26,7 +26,7 @@ protected: const std::string name ; public: - PositioningAlgorithm(const std::string _name = "UnknownAlgorithm"): + PositioningAlgorithm(const std::string &_name = "UnknownAlgorithm"): name(_name) {} virtual ~PositioningAlgorithm(void) {} diff --git a/owlps-positioner/src/request.cc b/owlps-positioner/src/request.cc index fe9fc92..e904cb0 100644 --- a/owlps-positioner/src/request.cc +++ b/owlps-positioner/src/request.cc @@ -30,7 +30,7 @@ using std::tr1::unordered_map ; Request::Request( const Mobile *_mobile, const Timestamp &_time_sent, - const std::tr1::unordered_map &_measurements + const std::tr1::unordered_map &_measurements ): type(OWL_REQUEST_UNDEFINED), nb_packets(1), mobile(const_cast(_mobile)), time_sent(_time_sent), @@ -40,7 +40,7 @@ Request::Request( } -Request::Request(const std::tr1::unordered_map +Request::Request(const std::tr1::unordered_map &_measurements): type(OWL_REQUEST_UNDEFINED), nb_packets(1), mobile(NULL), measurements(_measurements), real_position(NULL) @@ -51,7 +51,7 @@ Request::Request(const std::tr1::unordered_map Request::Request( const Timestamp &_time_sent, - const std::tr1::unordered_map &_measurements + const std::tr1::unordered_map &_measurements ): type(OWL_REQUEST_UNDEFINED), nb_packets(1), mobile(NULL), time_sent(_time_sent), diff --git a/owlps-positioner/src/request.hh b/owlps-positioner/src/request.hh index 1c7a28f..ddf7242 100644 --- a/owlps-positioner/src/request.hh +++ b/owlps-positioner/src/request.hh @@ -241,7 +241,7 @@ inline Request::operator bool() const return mobile != NULL || time_sent || - measurements.size() > 0 ; + ! measurements.empty() ; } diff --git a/owlps-positioner/src/stock.cc b/owlps-positioner/src/stock.cc index 679390e..e42bd71 100644 --- a/owlps-positioner/src/stock.cc +++ b/owlps-positioner/src/stock.cc @@ -289,7 +289,6 @@ void Stock::update_all_friis_indexes() for (unordered_map::iterator ap = aps.begin() ; ap != aps.end() ; ++ap) { - string ap_mac = ap->second.get_mac_addr() ; double friis_idx_sum = 0 ; int nb_friis_idx = 0 ; diff --git a/owlps-positioner/src/timestamp.cc b/owlps-positioner/src/timestamp.cc index c1f4957..c16fad4 100644 --- a/owlps-positioner/src/timestamp.cc +++ b/owlps-positioner/src/timestamp.cc @@ -109,8 +109,8 @@ Timestamp Timestamp::get_current_time() /** - * @source A pointer to the new time. If NULL, #current_time is updated - * to the current time. + * @arg source A pointer to the new time. If NULL, #current_time is + * updated to the current time. */ void Timestamp::update_current_time(const Timestamp &source) {