From: Marcin Siodelski Date: Fri, 20 Jul 2012 19:05:00 +0000 (+0200) Subject: [1958] Prefer const iterators and pointers where possible. X-Git-Tag: trac2351_base~113^2~20^2~1^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a14dd1bb813a03e9cedecc44b237c24fc0dbe08e;p=thirdparty%2Fkea.git [1958] Prefer const iterators and pointers where possible. --- diff --git a/tests/tools/perfdhcp/stats_mgr.h b/tests/tools/perfdhcp/stats_mgr.h index 3c12286cd6..cae102930b 100644 --- a/tests/tools/perfdhcp/stats_mgr.h +++ b/tests/tools/perfdhcp/stats_mgr.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -132,7 +131,7 @@ public: class ExchangeStats { public: - static uint32_t transid_hash(boost::shared_ptr packet) { + static uint32_t transid_hash(const boost::shared_ptr packet) { return packet->getTransid() & 1023; } @@ -156,12 +155,12 @@ public: > PktList; /// Packet list iterator for sequencial access to elements. - typedef typename PktList::iterator PktListIterator; + typedef typename PktList::const_iterator PktListIterator; /// Packet list index to search packets using transaction id. typedef typename PktList::template nth_index<1>::type PktListTransidIndex; /// Packet list iterator to access packets using transaction id. - typedef typename PktListTransidIndex::iterator PktListTransidIterator; + typedef typename PktListTransidIndex::const_iterator PktListTransidIterator; /// \brief Constructor /// @@ -209,8 +208,8 @@ public: /// \param sent_packet sent packet /// \param rcvd_packet received packet /// \throw isc::Unexpected if failed to calculate timestamps - void updateDelays(const boost::shared_ptr sent_packet, - const boost::shared_ptr rcvd_packet) { + void updateDelays(const boost::shared_ptr sent_packet, + const boost::shared_ptr rcvd_packet) { boost::posix_time::ptime sent_time = sent_packet->getTimestamp(); boost::posix_time::ptime rcvd_time = rcvd_packet->getTimestamp(); @@ -496,7 +495,7 @@ public: /// Map containing custom counters. typedef typename std::map CustomCountersMap; /// Iterator for \ref CustomCountersMap. - typedef typename CustomCountersMap::iterator CustomCountersMapIterator; + typedef typename CustomCountersMap::const_iterator CustomCountersMapIterator; /// \brief Constructor. StatsMgr()