table: don't share Strategy instance among StrategyChoice entries

For a Strategy type registered in the strategy registry,
a new instance is created for each StrategyChoice entry that uses it.

StrategyChoice::install is deprecated. An installed strategy instance
is still shared among StrategyChoice entries that use it. This will
be removed after unit tests switch to use the strategy registry.

refs #3868

Change-Id: Ibca685e6b6668f64fa1a503e3575867e8babdfe1
diff --git a/daemon/table/strategy-choice-entry.cpp b/daemon/table/strategy-choice-entry.cpp
index 365fd20..f5d9551 100644
--- a/daemon/table/strategy-choice-entry.cpp
+++ b/daemon/table/strategy-choice-entry.cpp
@@ -32,15 +32,35 @@
 
 Entry::Entry(const Name& prefix)
   : m_prefix(prefix)
-  , m_strategy(nullptr)
+  , m_strategyPtr(nullptr)
   , m_nameTreeEntry(nullptr)
 {
 }
 
+Entry::~Entry() = default;
+
 const Name&
 Entry::getStrategyName() const
 {
-  return m_strategy->getName();
+  return this->getStrategy().getName();
+}
+
+void
+Entry::setStrategy(fw::Strategy& strategy)
+{
+  /// \todo #3868
+  /// Every entry should have its own Strategy instance in unique_ptr;
+  /// m_strategyPtr and this overload should be eliminated.
+
+  m_strategy.reset();
+  m_strategyPtr = &strategy;
+}
+
+void
+Entry::setStrategy(unique_ptr<fw::Strategy> strategy)
+{
+  m_strategy = std::move(strategy);
+  m_strategyPtr = m_strategy.get();
 }
 
 } // namespace strategy_choice