encoding: move most of Estimator methods inline and make constexpr

Change-Id: I5b7e1299a52217c824c54dc2eda6ddf3d70367ae
diff --git a/ndn-cxx/encoding/estimator.cpp b/ndn-cxx/encoding/estimator.cpp
index 5e3a31a..a6d0c24 100644
--- a/ndn-cxx/encoding/estimator.cpp
+++ b/ndn-cxx/encoding/estimator.cpp
@@ -25,42 +25,6 @@
 namespace encoding {
 
 size_t
-Estimator::prependVarNumber(uint64_t n) const noexcept
-{
-  return tlv::sizeOfVarNumber(n);
-}
-
-size_t
-Estimator::appendVarNumber(uint64_t n) const noexcept
-{
-  return tlv::sizeOfVarNumber(n);
-}
-
-size_t
-Estimator::prependNonNegativeInteger(uint64_t n) const noexcept
-{
-  return tlv::sizeOfNonNegativeInteger(n);
-}
-
-size_t
-Estimator::appendNonNegativeInteger(uint64_t n) const noexcept
-{
-  return tlv::sizeOfNonNegativeInteger(n);
-}
-
-size_t
-Estimator::prependByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept
-{
-  return tlv::sizeOfVarNumber(type) + tlv::sizeOfVarNumber(arraySize) + arraySize;
-}
-
-size_t
-Estimator::appendByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept
-{
-  return prependByteArrayBlock(type, array, arraySize);
-}
-
-size_t
 Estimator::prependBlock(const Block& block) const
 {
   if (block.hasWire()) {
@@ -71,11 +35,5 @@
   }
 }
 
-size_t
-Estimator::appendBlock(const Block& block) const
-{
-  return prependBlock(block);
-}
-
 } // namespace encoding
 } // namespace ndn
diff --git a/ndn-cxx/encoding/estimator.hpp b/ndn-cxx/encoding/estimator.hpp
index 5341ccd..9f43c1f 100644
--- a/ndn-cxx/encoding/estimator.hpp
+++ b/ndn-cxx/encoding/estimator.hpp
@@ -77,7 +77,7 @@
    * @brief Prepend bytes from the range [@p first, @p last)
    */
   template<class Iterator>
-  size_t
+  constexpr size_t
   prependRange(Iterator first, Iterator last) const noexcept
   {
     return std::distance(first, last);
@@ -87,7 +87,7 @@
    * @brief Append bytes from the range [@p first, @p last)
    */
   template<class Iterator>
-  size_t
+  constexpr size_t
   appendRange(Iterator first, Iterator last) const noexcept
   {
     return std::distance(first, last);
@@ -96,38 +96,56 @@
   /**
    * @brief Prepend @p n in VarNumber encoding
    */
-  size_t
-  prependVarNumber(uint64_t n) const noexcept;
+  constexpr size_t
+  prependVarNumber(uint64_t n) const noexcept
+  {
+    return tlv::sizeOfVarNumber(n);
+  }
 
   /**
    * @brief Append @p n in VarNumber encoding
    */
-  size_t
-  appendVarNumber(uint64_t n) const noexcept;
+  constexpr size_t
+  appendVarNumber(uint64_t n) const noexcept
+  {
+    return tlv::sizeOfVarNumber(n);
+  }
 
   /**
    * @brief Prepend @p n in NonNegativeInteger encoding
    */
-  size_t
-  prependNonNegativeInteger(uint64_t n) const noexcept;
+  constexpr size_t
+  prependNonNegativeInteger(uint64_t n) const noexcept
+  {
+    return tlv::sizeOfNonNegativeInteger(n);
+  }
 
   /**
    * @brief Append @p n in NonNegativeInteger encoding
    */
-  size_t
-  appendNonNegativeInteger(uint64_t n) const noexcept;
+  constexpr size_t
+  appendNonNegativeInteger(uint64_t n) const noexcept
+  {
+    return tlv::sizeOfNonNegativeInteger(n);
+  }
 
   /**
    * @brief Prepend TLV block of type @p type and value from buffer @p array of size @p arraySize
    */
-  size_t
-  prependByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept;
+  constexpr size_t
+  prependByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept
+  {
+    return tlv::sizeOfVarNumber(type) + tlv::sizeOfVarNumber(arraySize) + arraySize;
+  }
 
   /**
    * @brief Append TLV block of type @p type and value from buffer @p array of size @p arraySize
    */
-  size_t
-  appendByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept;
+  constexpr size_t
+  appendByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize) const noexcept
+  {
+    return tlv::sizeOfVarNumber(type) + tlv::sizeOfVarNumber(arraySize) + arraySize;
+  }
 
   /**
    * @brief Prepend TLV block @p block
@@ -139,7 +157,10 @@
    * @brief Append TLV block @p block
    */
   size_t
-  appendBlock(const Block& block) const;
+  appendBlock(const Block& block) const
+  {
+    return prependBlock(block);
+  }
 };
 
 } // namespace encoding