This commit also deletes fib::Entry::set/getStrategy attribute. refs #1276 Change-Id: I57dfe842a8024e0ad9908ba8a9c415d5f4ac1bbe
41 lines
999 B
C++
41 lines
999 B
C++
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
|
/**
|
|
* Copyright (C) 2014 Named Data Networking Project
|
|
* See COPYING for copyright and distribution information.
|
|
*/
|
|
|
|
#include "measurements-accessor.hpp"
|
|
|
|
namespace nfd {
|
|
|
|
using fw::Strategy;
|
|
|
|
MeasurementsAccessor::MeasurementsAccessor(Measurements& measurements,
|
|
StrategyChoice& strategyChoice,
|
|
Strategy* strategy)
|
|
: m_measurements(measurements)
|
|
, m_strategyChoice(strategyChoice)
|
|
, m_strategy(strategy)
|
|
{
|
|
}
|
|
|
|
MeasurementsAccessor::~MeasurementsAccessor()
|
|
{
|
|
}
|
|
|
|
shared_ptr<measurements::Entry>
|
|
MeasurementsAccessor::filter(const shared_ptr<measurements::Entry>& entry)
|
|
{
|
|
if (!static_cast<bool>(entry)) {
|
|
return entry;
|
|
}
|
|
|
|
Strategy& effectiveStrategy = m_strategyChoice.findEffectiveStrategy(*entry);
|
|
if (&effectiveStrategy == m_strategy) {
|
|
return entry;
|
|
}
|
|
return shared_ptr<measurements::Entry>();
|
|
}
|
|
|
|
} // namespace nfd
|