table: StrategyInfoHost stores StrategyInfo as unique_ptr
refs #3205
Change-Id: Ia194ca94717347848d257096549cfec5df1ba6c9
diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp
index c56eef4..f1a888a 100644
--- a/daemon/fw/ncc-strategy.cpp
+++ b/daemon/fw/ncc-strategy.cpp
@@ -54,7 +54,7 @@
return;
}
- shared_ptr<PitEntryInfo> pitEntryInfo = pitEntry->insertStrategyInfo<PitEntryInfo>();
+ PitEntryInfo* pitEntryInfo = pitEntry->insertStrategyInfo<PitEntryInfo>().first;
bool isNewPitEntry = !hasPendingOutRecords(*pitEntry);
if (!isNewPitEntry) {
return;
@@ -118,7 +118,7 @@
}
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
- shared_ptr<PitEntryInfo> pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
+ PitEntryInfo* pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
// pitEntryInfo is guaranteed to exist here, because doPropagate is triggered
// from a timer set by NccStrategy.
BOOST_ASSERT(pitEntryInfo != nullptr);
@@ -199,7 +199,7 @@
measurementsEntry = this->getMeasurements().getParent(*measurementsEntry);
}
- shared_ptr<PitEntryInfo> pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
+ PitEntryInfo* pitEntryInfo = pitEntry->getStrategyInfo<PitEntryInfo>();
if (pitEntryInfo != nullptr) {
scheduler::cancel(pitEntryInfo->propagateTimer);
@@ -223,14 +223,13 @@
NccStrategy::getMeasurementsEntryInfo(measurements::Entry* entry)
{
BOOST_ASSERT(entry != nullptr);
- shared_ptr<MeasurementsEntryInfo> info = entry->getStrategyInfo<MeasurementsEntryInfo>();
- if (info != nullptr) {
+ MeasurementsEntryInfo* info = nullptr;
+ bool isNew = false;
+ std::tie(info, isNew) = entry->insertStrategyInfo<MeasurementsEntryInfo>();
+ if (!isNew) {
return *info;
}
- info = make_shared<MeasurementsEntryInfo>();
- entry->setStrategyInfo(info);
-
measurements::Entry* parentEntry = this->getMeasurements().getParent(*entry);
if (parentEntry != nullptr) {
MeasurementsEntryInfo& parentInfo = this->getMeasurementsEntryInfo(parentEntry);