table: simplify Measurements with C++11 features
This commit also changes TableMeasurements test suite to use UnitTestTimeFixture.
refs #2100
Change-Id: I6af9fbae435fb50d26f6ec54abc7219680c8ade8
diff --git a/daemon/table/measurements.hpp b/daemon/table/measurements.hpp
index 7478c58..71d8db5 100644
--- a/daemon/table/measurements.hpp
+++ b/daemon/table/measurements.hpp
@@ -49,54 +49,56 @@
explicit
Measurements(NameTree& nametree);
- ~Measurements();
-
- /// find or insert a Measurements entry for name
+ /** \brief find or insert a Measurements entry for name
+ */
shared_ptr<measurements::Entry>
get(const Name& name);
- /// find or insert a Measurements entry for fibEntry->getPrefix()
+ /** \brief find or insert a Measurements entry for fibEntry->getPrefix()
+ */
shared_ptr<measurements::Entry>
get(const fib::Entry& fibEntry);
- /// find or insert a Measurements entry for pitEntry->getName()
+ /** \brief find or insert a Measurements entry for pitEntry->getName()
+ */
shared_ptr<measurements::Entry>
get(const pit::Entry& pitEntry);
- /** find or insert a Measurements entry for child's parent
- *
- * If child is the root entry, returns null.
+ /** \brief find or insert a Measurements entry for child's parent
+ * \retval nullptr if child is the root entry
*/
shared_ptr<measurements::Entry>
- getParent(shared_ptr<measurements::Entry> child);
+ getParent(const measurements::Entry& child);
- /// perform a longest prefix match
+ /** \brief perform a longest prefix match
+ */
shared_ptr<measurements::Entry>
findLongestPrefixMatch(const Name& name) const;
- /// perform an exact match
+ /** \brief perform an exact match
+ */
shared_ptr<measurements::Entry>
findExactMatch(const Name& name) const;
static time::nanoseconds
getInitialLifetime();
- /** extend lifetime of an entry
+ /** \brief extend lifetime of an entry
*
* The entry will be kept until at least now()+lifetime.
*/
void
- extendLifetime(shared_ptr<measurements::Entry> entry, const time::nanoseconds& lifetime);
+ extendLifetime(measurements::Entry& entry, const time::nanoseconds& lifetime);
size_t
size() const;
private:
void
- cleanup(shared_ptr<measurements::Entry> entry);
+ cleanup(measurements::Entry& entry);
shared_ptr<measurements::Entry>
- get(shared_ptr<name_tree::Entry> nameTreeEntry);
+ get(name_tree::Entry& nte);
private:
NameTree& m_nameTree;