fw: NccStrategy

refs #1242

Change-Id: I21f870728b7b361547adbde9d64357c93aeb1ed9
diff --git a/daemon/table/strategy-info-host.hpp b/daemon/table/strategy-info-host.hpp
index 41199b2..272177f 100644
--- a/daemon/table/strategy-info-host.hpp
+++ b/daemon/table/strategy-info-host.hpp
@@ -25,6 +25,14 @@
   shared_ptr<T>
   getStrategyInfo();
   
+  template<typename T>
+  shared_ptr<T>
+  getOrCreateStrategyInfo();
+  
+  template<typename T, typename T1>
+  shared_ptr<T>
+  getOrCreateStrategyInfo(T1& a1);
+  
   void
   clearStrategyInfo();
 
@@ -47,6 +55,30 @@
   return static_pointer_cast<T, fw::StrategyInfo>(m_strategyInfo);
 }
 
+template<typename T>
+shared_ptr<T>
+StrategyInfoHost::getOrCreateStrategyInfo()
+{
+  shared_ptr<T> info = this->getStrategyInfo<T>();
+  if (!static_cast<bool>(info)) {
+    info = make_shared<T>();
+    this->setStrategyInfo(info);
+  }
+  return info;
+}
+
+template<typename T, typename T1>
+shared_ptr<T>
+StrategyInfoHost::getOrCreateStrategyInfo(T1& a1)
+{
+  shared_ptr<T> info = this->getStrategyInfo<T>();
+  if (!static_cast<bool>(info)) {
+    info = make_shared<T>(boost::ref(a1));
+    this->setStrategyInfo(info);
+  }
+  return info;
+}
+
 } // namespace nfd
 
 #endif // NFD_TABLE_STRATEGY_INFO_HOST_HPP