management: ensure Element::Error inherits from tlv::Error

Add static asserts to ensure ndn::nfd::*::Error are subclasses of tlv::Error.

Add WireEncodable and WireDecodable concept checks to
ndn::nfd::* classes that represent TLV abstraction.

Move definition of ChannelStatus, FibEntry, ForwarderStatus,
StrategyChoice methods into .cpp.

Move declaration of FaceScope, FacePersistency, LinkType
into encoding/nfd-constants.hpp.

Eliminate duplicate RibFlags declaration.

refs #1983

Change-Id: I207bae479aa6da54a581a7cca5b2a13743827ff0
diff --git a/src/management/nfd-strategy-choice.hpp b/src/management/nfd-strategy-choice.hpp
index 2d9bbd5..6fc2f18 100644
--- a/src/management/nfd-strategy-choice.hpp
+++ b/src/management/nfd-strategy-choice.hpp
@@ -22,9 +22,7 @@
 #ifndef NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_HPP
 #define NDN_MANAGEMENT_NFD_STRATEGY_CHOICE_HPP
 
-#include "../encoding/tlv-nfd.hpp"
-#include "../encoding/encoding-buffer.hpp"
-#include "../encoding/block-helpers.hpp"
+#include "../encoding/block.hpp"
 #include "../name.hpp"
 
 namespace ndn {
@@ -48,15 +46,10 @@
     }
   };
 
-  StrategyChoice()
-  {
-  }
+  StrategyChoice();
 
   explicit
-  StrategyChoice(const Block& payload)
-  {
-    this->wireDecode(payload);
-  }
+  StrategyChoice(const Block& payload);
 
   template<bool T>
   size_t
@@ -76,12 +69,7 @@
   }
 
   StrategyChoice&
-  setName(const Name& name)
-  {
-    m_wire.reset();
-    m_name = name;
-    return *this;
-  }
+  setName(const Name& name);
 
   const Name&
   getStrategy() const
@@ -90,12 +78,7 @@
   }
 
   StrategyChoice&
-  setStrategy(const Name& strategy)
-  {
-    m_wire.reset();
-    m_strategy = strategy;
-    return *this;
-  }
+  setStrategy(const Name& strategy);
 
 private:
   Name m_name; // namespace
@@ -104,70 +87,6 @@
   mutable Block m_wire;
 };
 
-
-template<bool T>
-inline size_t
-StrategyChoice::wireEncode(EncodingImpl<T>& encoder) const
-{
-  size_t totalLength = 0;
-
-  totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
-  totalLength += m_name.wireEncode(encoder);
-
-  totalLength += encoder.prependVarNumber(totalLength);
-  totalLength += encoder.prependVarNumber(tlv::nfd::StrategyChoice);
-  return totalLength;
-}
-
-inline const Block&
-StrategyChoice::wireEncode() const
-{
-  if (m_wire.hasWire())
-    return m_wire;
-
-  EncodingEstimator estimator;
-  size_t estimatedSize = wireEncode(estimator);
-
-  EncodingBuffer buffer(estimatedSize, 0);
-  wireEncode(buffer);
-
-  m_wire = buffer.block();
-  return m_wire;
-}
-
-inline void
-StrategyChoice::wireDecode(const Block& block)
-{
-  if (block.type() != tlv::nfd::StrategyChoice) {
-    throw Error("expecting StrategyChoice block");
-  }
-  m_wire = block;
-  m_wire.parse();
-  Block::element_const_iterator val = m_wire.elements_begin();
-
-  if (val != m_wire.elements_end() && val->type() == tlv::Name) {
-    m_name.wireDecode(*val);
-    ++val;
-  }
-  else {
-    throw Error("missing required Name field");
-  }
-
-  if (val != m_wire.elements_end() && val->type() == tlv::nfd::Strategy) {
-    val->parse();
-    if (val->elements().empty()) {
-      throw Error("expecting Strategy/Name");
-    }
-    else {
-      m_strategy.wireDecode(*val->elements_begin());
-    }
-    ++val;
-  }
-  else {
-    throw Error("missing required Strategy field");
-  }
-}
-
 } // namespace nfd
 } // namespace ndn