table: MeasurementsAccessor findLongestPrefixMatch & findExactMatch
This commit also improves unit testing of MeasurementsAccessor,
and changes signature of MeasurementsAccessor constructor.
refs #2314
Change-Id: Ie0494628c6d3faac0473bc4cfb21998f89270aaf
diff --git a/daemon/table/measurements-accessor.cpp b/daemon/table/measurements-accessor.cpp
index 81b1432..47b4fe2 100644
--- a/daemon/table/measurements-accessor.cpp
+++ b/daemon/table/measurements-accessor.cpp
@@ -1,12 +1,12 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis
+ * Copyright (c) 2014-2015, Regents of the University of California,
+ * Arizona Board of Regents,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University,
+ * Washington University in St. Louis,
+ * Beijing Institute of Technology,
+ * The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
@@ -30,11 +30,11 @@
using fw::Strategy;
MeasurementsAccessor::MeasurementsAccessor(Measurements& measurements,
- StrategyChoice& strategyChoice,
- Strategy* strategy)
+ const StrategyChoice& strategyChoice,
+ const Strategy& strategy)
: m_measurements(measurements)
, m_strategyChoice(strategyChoice)
- , m_strategy(strategy)
+ , m_strategy(&strategy)
{
}
@@ -43,9 +43,9 @@
}
shared_ptr<measurements::Entry>
-MeasurementsAccessor::filter(const shared_ptr<measurements::Entry>& entry)
+MeasurementsAccessor::filter(const shared_ptr<measurements::Entry>& entry) const
{
- if (!static_cast<bool>(entry)) {
+ if (entry == nullptr) {
return entry;
}