encoding: Improving structure and documentation of block helpers

This commit add several new helpers to simplify operations with
std::string:

- prependStringBlock
- makeStringBlock
- readString

The following functions are deprecated and their replacements:

- nonNegativeIntegerBlock (use makeNonNegativeIntegerBlock)
- prependBooleanBlock (use prependEmptyBlock)
- booleanBlock (use makeEmptyBlock)
- dataBlock (use makeBinaryBlock)
- nestedBlock (use makeNestedBlock)

Change-Id: Ic595ae64fc9c80c2c04e5fde1d8812e8b9debd60
Refs: #2951
diff --git a/src/data.cpp b/src/data.cpp
index 84dbbd6..9e5effe 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -22,12 +22,12 @@
 #include "data.hpp"
 #include "encoding/block-helpers.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Data>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Data>));
 static_assert(std::is_base_of<tlv::Error, Data::Error>::value,
               "Data::Error must inherit from tlv::Error");
@@ -94,11 +94,11 @@
 
 
 template size_t
-Data::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block,
+Data::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder,
                                        bool unsignedPortion) const;
 
 template size_t
-Data::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block,
+Data::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder,
                                          bool unsignedPortion) const;
 
 
@@ -230,10 +230,10 @@
 Data::getContent() const
 {
   if (m_content.empty())
-    m_content = dataBlock(tlv::Content, reinterpret_cast<const uint8_t*>(0), 0);
+    m_content = makeEmptyBlock(tlv::Content);
 
   if (!m_content.hasWire())
-      m_content.encode();
+    m_content.encode();
   return m_content;
 }
 
@@ -242,7 +242,7 @@
 {
   onChanged();
 
-  m_content = dataBlock(tlv::Content, content, contentLength);
+  m_content = makeBinaryBlock(tlv::Content, content, contentLength);
 
   return *this;
 }
diff --git a/src/data.hpp b/src/data.hpp
index b12061b..b5e1c02 100644
--- a/src/data.hpp
+++ b/src/data.hpp
@@ -91,7 +91,7 @@
   /**
    * @brief Fast encoding or block size estimation
    *
-   * @param block                   EncodingEstimator or EncodingBuffer instance
+   * @param encoder                 EncodingEstimator or EncodingBuffer instance
    * @param wantUnsignedPortionOnly Request only unsigned portion to be encoded in block.
    *                                If true, only Name, MetaInfo, Content, and SignatureInfo
    *                                blocks will be encoded into the block. Note that there
@@ -99,7 +99,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block, bool wantUnsignedPortionOnly = false) const;
+  wireEncode(EncodingImpl<TAG>& encoder, bool wantUnsignedPortionOnly = false) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/encoding/block-helpers.cpp b/src/encoding/block-helpers.cpp
new file mode 100644
index 0000000..594fc5c
--- /dev/null
+++ b/src/encoding/block-helpers.cpp
@@ -0,0 +1,161 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "block-helpers.hpp"
+
+namespace ndn {
+namespace encoding {
+
+template<Tag TAG>
+size_t
+prependNonNegativeIntegerBlock(EncodingImpl<TAG>& encoder, uint32_t type, uint64_t value)
+{
+  size_t valueLength = encoder.prependNonNegativeInteger(value);
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependNonNegativeIntegerBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder,
+                                             uint32_t type, uint64_t value);
+
+template size_t
+prependNonNegativeIntegerBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder,
+                                           uint32_t type, uint64_t value);
+
+
+Block
+makeNonNegativeIntegerBlock(uint32_t type, uint64_t value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependNonNegativeIntegerBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependNonNegativeIntegerBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+uint64_t
+readNonNegativeInteger(const Block& block)
+{
+  Buffer::const_iterator begin = block.value_begin();
+  return tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
+}
+
+////////
+
+template<Tag TAG>
+size_t
+prependEmptyBlock(EncodingImpl<TAG>& encoder, uint32_t type)
+{
+  size_t totalLength = encoder.prependVarNumber(0);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependEmptyBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder, uint32_t type);
+
+template size_t
+prependEmptyBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder, uint32_t type);
+
+
+Block
+makeEmptyBlock(uint32_t type)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependEmptyBlock(estimator, type);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependEmptyBlock(encoder, type);
+
+  return encoder.block();
+}
+
+////////
+
+template<Tag TAG>
+size_t
+prependStringBlock(EncodingImpl<TAG>& encoder, uint32_t type, const std::string& value)
+{
+  size_t valueLength = encoder.prependByteArray(reinterpret_cast<const uint8_t*>(value.data()),
+                                                value.size());
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+template size_t
+prependStringBlock<EstimatorTag>(EncodingImpl<EstimatorTag>& encoder,
+                                 uint32_t type, const std::string& value);
+
+template size_t
+prependStringBlock<EncoderTag>(EncodingImpl<EncoderTag>& encoder,
+                               uint32_t type, const std::string& value);
+
+
+Block
+makeStringBlock(uint32_t type, const std::string& value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependStringBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependStringBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+std::string
+readString(const Block& block)
+{
+  return std::string(reinterpret_cast<const char*>(block.value()), block.value_size());
+}
+
+////////
+
+Block
+makeBinaryBlock(uint32_t type, const uint8_t* value, size_t length)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = estimator.prependByteArrayBlock(type, value, length);
+
+  EncodingBuffer encoder(totalLength, 0);
+  encoder.prependByteArrayBlock(type, value, length);
+
+  return encoder.block();
+}
+
+Block
+makeBinaryBlock(uint32_t type, const char* value, size_t length)
+{
+  return makeBinaryBlock(type, reinterpret_cast<const uint8_t*>(value), length);
+}
+
+} // namespace encoding
+} // namespace ndn
diff --git a/src/encoding/block-helpers.hpp b/src/encoding/block-helpers.hpp
index e3e86f4..5f26b17 100644
--- a/src/encoding/block-helpers.hpp
+++ b/src/encoding/block-helpers.hpp
@@ -24,115 +24,90 @@
 
 #include "block.hpp"
 #include "encoding-buffer.hpp"
+#include "../util/concepts.hpp"
 
 #include <iterator>
 
 namespace ndn {
+namespace encoding {
 
 /**
- * @deprecated Use Encoder::prependBlock and Estimator::prependBlock instead
+ * @brief Helper to prepend TLV block type @p type containing non-negative integer @p value
+ * @see makeNonNegativeIntegerBlock, readNonNegativeInteger
  */
-template<bool P>
-inline size_t
-prependBlock(EncodingImpl<P>& encoder, const Block& block)
-{
-  return encoder.prependBlock(block);
-}
+template<Tag TAG>
+size_t
+prependNonNegativeIntegerBlock(EncodingImpl<TAG>& encoder, uint32_t type, uint64_t value);
 
 /**
- * @deprecated Use Encoder::prependByteArrayBlock and Estimator::prependByteArrayBlock instead
+ * @brief Create a TLV block type @p type containing non-negative integer @p value
+ * @see prependNonNegativeIntegerBlock, readNonNegativeInteger
  */
-template<bool P>
-inline size_t
-prependByteArrayBlock(EncodingImpl<P>& encoder,
-                      uint32_t type, const uint8_t* array, size_t arraySize)
-{
-  return encoder.prependByteArrayBlock(type, array, arraySize);
-}
+Block
+makeNonNegativeIntegerBlock(uint32_t type, uint64_t value);
 
-template<bool P>
-inline size_t
-prependNonNegativeIntegerBlock(EncodingImpl<P>& encoder, uint32_t type, uint64_t number)
-{
-  size_t valueLength = encoder.prependNonNegativeInteger(number);
-  size_t totalLength = valueLength;
-  totalLength += encoder.prependVarNumber(valueLength);
-  totalLength += encoder.prependVarNumber(type);
+/**
+ * @brief Helper to read a non-negative integer from a block
+ * @see prependNonNegativeIntegerBlock, makeNonNegativeIntegerBlock
+ * @throw tlv::Error if block does not contain a valid nonNegativeInteger
+ */
+uint64_t
+readNonNegativeInteger(const Block& block);
 
-  return totalLength;
-}
+////////
 
-template<bool P>
-inline size_t
-prependBooleanBlock(EncodingImpl<P>& encoder, uint32_t type)
-{
-  size_t totalLength = encoder.prependVarNumber(0);
-  totalLength += encoder.prependVarNumber(type);
+/**
+ * @brief Helper to prepend TLV block type @p type containing no value (i.e., a boolean block)
+ * @see makeEmptyBlock
+ */
+template<Tag TAG>
+size_t
+prependEmptyBlock(EncodingImpl<TAG>& encoder, uint32_t type);
 
-  return totalLength;
-}
+/**
+ * @brief Create a TLV block type @p type containing no value (i.e., a boolean block)
+ * @see prependEmptyBlock
+ */
+Block
+makeEmptyBlock(uint32_t type);
 
-template<bool P, class U>
-inline size_t
-prependNestedBlock(EncodingImpl<P>& encoder, uint32_t type, const U& nestedBlock)
-{
-  size_t valueLength = nestedBlock.wireEncode(encoder);
-  size_t totalLength = valueLength;
-  totalLength += encoder.prependVarNumber(valueLength);
-  totalLength += encoder.prependVarNumber(type);
+////////
 
-  return totalLength;
-}
+/**
+ * @brief Helper to prepend TLV block type @p type with value from a string @p value
+ * @see makeStringBlock, readString
+ */
+template<Tag TAG>
+size_t
+prependStringBlock(EncodingImpl<TAG>& encoder, uint32_t type, const std::string& value);
 
+/**
+ * @brief Create a TLV block type @p type with value from a string @p
+ * @see prependStringBlock, readString
+ */
+Block
+makeStringBlock(uint32_t type, const std::string& value);
 
-inline Block
-nonNegativeIntegerBlock(uint32_t type, uint64_t value)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = prependNonNegativeIntegerBlock(estimator, type, value);
+/**
+ * @brief Helper to read a string value from a block
+ * @see prependStringBlock, makeStringBlock
+ */
+std::string
+readString(const Block& block);
 
-  EncodingBuffer encoder(totalLength, 0);
-  prependNonNegativeIntegerBlock(encoder, type, value);
+////////
 
-  return encoder.block();
-}
+/**
+ * @brief Create a TLV block type @p type with value from a buffer @p value of size @p length
+ */
+Block
+makeBinaryBlock(uint32_t type, const uint8_t* value, size_t length);
 
-inline uint64_t
-readNonNegativeInteger(const Block& block)
-{
-  Buffer::const_iterator begin = block.value_begin();
-  return tlv::readNonNegativeInteger(block.value_size(), begin, block.value_end());
-}
-
-inline Block
-booleanBlock(uint32_t type)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = prependBooleanBlock(estimator, type);
-
-  EncodingBuffer encoder(totalLength, 0);
-  prependBooleanBlock(encoder, type);
-
-  return encoder.block();
-}
-
-inline Block
-dataBlock(uint32_t type, const uint8_t* data, size_t dataSize)
-{
-  EncodingEstimator estimator;
-  size_t totalLength = estimator.prependByteArrayBlock(type, data, dataSize);
-
-  EncodingBuffer encoder(totalLength, 0);
-  encoder.prependByteArrayBlock(type, data, dataSize);
-
-  return encoder.block();
-}
-
-inline Block
-dataBlock(uint32_t type, const char* data, size_t dataSize)
-{
-  return dataBlock(type, reinterpret_cast<const uint8_t*>(data), dataSize);
-}
+/**
+ * @brief Create a TLV block type @p type with value from a buffer @p value of size @p length
+ */
+Block
+makeBinaryBlock(uint32_t type, const char* value, size_t length);
 
 /**
  * @brief Helper class template to create a data block when RandomAccessIterator is used
@@ -192,7 +167,7 @@
  */
 template<class Iterator>
 inline Block
-dataBlock(uint32_t type, Iterator first, Iterator last)
+makeBinaryBlock(uint32_t type, Iterator first, Iterator last)
 {
   static_assert(sizeof(typename std::iterator_traits<Iterator>::value_type) == 1,
                 "Iterator should point only to char or unsigned char");
@@ -206,6 +181,155 @@
   return DataBlock::makeBlock(type, first, last);
 }
 
+////////
+
+/**
+ * @brief Prepend a TLV block of type @p type with WireEncodable @p value as a value
+ * @tparam U type that satisfies WireEncodableWithEncodingBuffer concept
+ * @see makeNestedBlock
+ */
+template<Tag TAG, class U>
+inline size_t
+prependNestedBlock(EncodingImpl<TAG>& encoder, uint32_t type, const U& value)
+{
+  BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<U>));
+
+  size_t valueLength = value.wireEncode(encoder);
+  size_t totalLength = valueLength;
+  totalLength += encoder.prependVarNumber(valueLength);
+  totalLength += encoder.prependVarNumber(type);
+
+  return totalLength;
+}
+
+/**
+ * @brief Create a TLV block of type @p type with WireEncodable @p value as a value
+ * @tparam U type that satisfies WireEncodableWithEncodingBuffer concept
+ * @see prependNestedBlock
+ */
+template<class U>
+inline Block
+makeNestedBlock(uint32_t type, const U& value)
+{
+  EncodingEstimator estimator;
+  size_t totalLength = prependNestedBlock(estimator, type, value);
+
+  EncodingBuffer encoder(totalLength, 0);
+  prependNestedBlock(encoder, type, value);
+
+  return encoder.block();
+}
+
+#define NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+#ifdef NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+/**
+ * @deprecated Use Encoder::prependBlock and Estimator::prependBlock instead
+ */
+template<Tag TAG>
+inline size_t
+prependBlock(EncodingImpl<TAG>& encoder, const Block& block)
+{
+  return encoder.prependBlock(block);
+}
+
+/**
+ * @deprecated Use Encoder::prependByteArrayBlock and Estimator::prependByteArrayBlock instead
+ */
+template<Tag TAG>
+inline size_t
+prependByteArrayBlock(EncodingImpl<TAG>& encoder,
+                      uint32_t type, const uint8_t* array, size_t arraySize)
+{
+  return encoder.prependByteArrayBlock(type, array, arraySize);
+}
+
+/**
+ * @deprecated Use makeNonNegativeIntegerBlock instead
+ */
+inline Block
+nonNegativeIntegerBlock(uint32_t type, uint64_t value)
+{
+  return makeNonNegativeIntegerBlock(type, value);
+}
+
+/**
+ * @deprecated Use prependEmptyBlock instead
+ */
+template<Tag TAG>
+size_t
+prependBooleanBlock(EncodingImpl<TAG>& encoder, uint32_t type)
+{
+  return prependEmptyBlock(encoder, type);
+}
+
+/**
+ * @deprecated Use makeEmptyBlock instead
+ */
+inline Block
+booleanBlock(uint32_t type)
+{
+  return makeEmptyBlock(type);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+inline Block
+dataBlock(uint32_t type, const uint8_t* data, size_t dataSize)
+{
+  return makeBinaryBlock(type, data, dataSize);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+inline Block
+dataBlock(uint32_t type, const char* data, size_t dataSize)
+{
+  return makeBinaryBlock(type, data, dataSize);
+}
+
+/**
+ * @deprecated Use makeBinaryBlock instead
+ */
+template<class Iterator>
+inline Block
+dataBlock(uint32_t type, Iterator first, Iterator last)
+{
+  return makeBinaryBlock(type, first, last);
+}
+
+/**
+ * @deprecated Use makeNestedBlock instead
+ */
+template<class U>
+inline Block
+nestedBlock(uint32_t type, const U& value)
+{
+  return makeNestedBlock(type, value);
+}
+
+#endif // NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+} // namespace encoding
+
+using encoding::makeNonNegativeIntegerBlock;
+using encoding::readNonNegativeInteger;
+using encoding::makeEmptyBlock;
+using encoding::makeStringBlock;
+using encoding::readString;
+using encoding::makeBinaryBlock;
+using encoding::makeNestedBlock;
+
+#ifdef NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
+using encoding::nonNegativeIntegerBlock;
+using encoding::booleanBlock;
+using encoding::dataBlock;
+
+#endif // NDN_CXX_ENABLE_DEPRECATED_BLOCK_HELPERS
+
 } // namespace ndn
 
 #endif // NDN_ENCODING_BLOCK_HELPERS_HPP
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index e17fe9a..5e5f666 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -206,7 +206,7 @@
   uint64_t length = tlv::readVarNumber(begin, end);
 
   if (length == 0) {
-    return dataBlock(type, static_cast<uint8_t*>(nullptr), length);
+    return makeEmptyBlock(type);
   }
 
   if (length > MAX_SIZE_OF_BLOCK_FROM_STREAM)
@@ -223,7 +223,7 @@
     throw tlv::Error("Not enough data in the buffer to fully parse TLV");
   }
 
-  return dataBlock(type, buf, length);
+  return makeBinaryBlock(type, buf, length);
 }
 
 std::tuple<bool, Block>
diff --git a/src/exclude.cpp b/src/exclude.cpp
index 76a6260..b5482cd 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -22,7 +22,7 @@
  */
 
 #include "exclude.hpp"
-#include "util/concepts.hpp"
+#include "encoding/block-helpers.hpp"
 
 #include <boost/range/adaptors.hpp>
 
@@ -30,6 +30,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Exclude>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Exclude>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Exclude>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Exclude>));
 static_assert(std::is_base_of<tlv::Error, Exclude::Error>::value,
               "Exclude::Error must inherit from tlv::Error");
@@ -45,7 +46,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Exclude::wireEncode(EncodingImpl<TAG>& block) const
+Exclude::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   if (m_exclude.empty()) {
     throw Error("Exclude filter cannot be empty");
@@ -58,23 +59,23 @@
 
   for (const auto& item : m_exclude) {
     if (item.second) {
-      totalLength += prependBooleanBlock(block, tlv::Any);
+      totalLength += prependEmptyBlock(encoder, tlv::Any);
     }
     if (!item.first.empty() || !item.second) {
-      totalLength += item.first.wireEncode(block);
+      totalLength += item.first.wireEncode(encoder);
     }
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Exclude);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Exclude);
   return totalLength;
 }
 
 template size_t
-Exclude::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Exclude::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Exclude::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Exclude::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Exclude::wireEncode() const
diff --git a/src/exclude.hpp b/src/exclude.hpp
index fe80acc..7f6ff4f 100644
--- a/src/exclude.hpp
+++ b/src/exclude.hpp
@@ -64,7 +64,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/interest.cpp b/src/interest.cpp
index a7ba973..4873f39 100644
--- a/src/interest.cpp
+++ b/src/interest.cpp
@@ -22,13 +22,13 @@
 #include "interest.hpp"
 #include "util/random.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 #include "data.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Interest>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
 static_assert(std::is_base_of<tlv::Error, Interest::Error>::value,
               "Interest::Error must inherit from tlv::Error");
@@ -79,9 +79,9 @@
     std::memcpy(const_cast<uint8_t*>(m_nonce.value()), &nonce, sizeof(nonce));
   }
   else {
-    m_nonce = dataBlock(tlv::Nonce,
-                        reinterpret_cast<const uint8_t*>(&nonce),
-                        sizeof(nonce));
+    m_nonce = makeBinaryBlock(tlv::Nonce,
+                              reinterpret_cast<const uint8_t*>(&nonce),
+                              sizeof(nonce));
     m_wire.reset();
   }
   return *this;
@@ -214,7 +214,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Interest::wireEncode(EncodingImpl<TAG>& block) const
+Interest::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -230,11 +230,11 @@
 
   if (hasLink()) {
     if (hasSelectedDelegation()) {
-      totalLength += prependNonNegativeIntegerBlock(block,
+      totalLength += prependNonNegativeIntegerBlock(encoder,
                                                     tlv::SelectedDelegation,
                                                     m_selectedDelegationIndex);
     }
-    totalLength += prependBlock(block, m_link);
+    totalLength += encoder.prependBlock(m_link);
   }
   else {
     BOOST_ASSERT(!hasSelectedDelegation());
@@ -244,34 +244,34 @@
   if (getInterestLifetime() >= time::milliseconds::zero() &&
       getInterestLifetime() != DEFAULT_INTEREST_LIFETIME)
     {
-      totalLength += prependNonNegativeIntegerBlock(block,
+      totalLength += prependNonNegativeIntegerBlock(encoder,
                                                     tlv::InterestLifetime,
                                                     getInterestLifetime().count());
     }
 
   // Nonce
   getNonce(); // to ensure that Nonce is properly set
-  totalLength += block.prependBlock(m_nonce);
+  totalLength += encoder.prependBlock(m_nonce);
 
   // Selectors
   if (hasSelectors())
     {
-      totalLength += getSelectors().wireEncode(block);
+      totalLength += getSelectors().wireEncode(encoder);
     }
 
   // Name
-  totalLength += getName().wireEncode(block);
+  totalLength += getName().wireEncode(encoder);
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Interest);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Interest);
   return totalLength;
 }
 
 template size_t
-Interest::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Interest::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Interest::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Interest::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Interest::wireEncode() const
diff --git a/src/interest.hpp b/src/interest.hpp
index 41e3848..80a1b18 100644
--- a/src/interest.hpp
+++ b/src/interest.hpp
@@ -89,7 +89,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/key-locator.cpp b/src/key-locator.cpp
index fd1a7ad..2f92d5d 100644
--- a/src/key-locator.cpp
+++ b/src/key-locator.cpp
@@ -21,12 +21,12 @@
 
 #include "key-locator.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
 BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<KeyLocator>));
 BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
 static_assert(std::is_base_of<tlv::Error, KeyLocator::Error>::value,
               "KeyLocator::Error must inherit from tlv::Error");
@@ -48,7 +48,7 @@
 
 template<encoding::Tag TAG>
 size_t
-KeyLocator::wireEncode(EncodingImpl<TAG>& block) const
+KeyLocator::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   // KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
   // KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+
@@ -59,22 +59,22 @@
   case KeyLocator_None:
     break;
   case KeyLocator_Name:
-    totalLength += m_name.wireEncode(block);
+    totalLength += m_name.wireEncode(encoder);
     break;
   case KeyLocator_KeyDigest:
-    totalLength += block.prependBlock(m_keyDigest);
+    totalLength += encoder.prependBlock(m_keyDigest);
     break;
   default:
     throw Error("Unsupported KeyLocator type");
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::KeyLocator);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::KeyLocator);
   return totalLength;
 }
 
 template size_t
-KeyLocator::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+KeyLocator::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 KeyLocator::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
@@ -180,7 +180,7 @@
   // This function takes a constant reference of a shared pointer.
   // It MUST NOT change the reference count of that shared pointer.
 
-  return this->setKeyDigest(dataBlock(tlv::KeyDigest, keyDigest->get(), keyDigest->size()));
+  return this->setKeyDigest(makeBinaryBlock(tlv::KeyDigest, keyDigest->get(), keyDigest->size()));
 }
 
 bool
diff --git a/src/key-locator.hpp b/src/key-locator.hpp
index 27b8d67..8c206e4 100644
--- a/src/key-locator.hpp
+++ b/src/key-locator.hpp
@@ -72,11 +72,11 @@
 
 public: // encode and decode
   /** \brief prepend wire encoding
-   *  \param block EncodingBuffer or Estimator
+   *  \param encoder EncodingBuffer or Estimator
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \return wire encoding
    */
diff --git a/src/link.cpp b/src/link.cpp
index ce05b36..b900450 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -24,7 +24,6 @@
 #include "encoding/block-helpers.hpp"
 #include "util/crypto.hpp"
 #include "security/key-chain.hpp"
-#include "util/concepts.hpp"
 
 #include <algorithm>
 
@@ -34,6 +33,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Link>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Link>));
 static_assert(std::is_base_of<Data::Error, Link::Error>::value,
               "Link::Error should inherit from Data::Error");
@@ -109,10 +109,10 @@
 }
 
 template size_t
-Link::encodeContent<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
+Link::encodeContent<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Link::encodeContent<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
+Link::encodeContent<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 void
 Link::encodeContent()
diff --git a/src/management/nfd-control-response.cpp b/src/management/nfd-control-response.cpp
index 6de873f..0c2166c 100644
--- a/src/management/nfd-control-response.cpp
+++ b/src/management/nfd-control-response.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -22,7 +22,6 @@
 #include "nfd-control-response.hpp"
 #include "encoding/tlv-nfd.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 namespace nfd {
@@ -56,16 +55,13 @@
     return m_wire;
 
   m_wire = Block(tlv::nfd::ControlResponse);
-  m_wire.push_back
-    (nonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
+  m_wire.push_back(makeNonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
 
-  m_wire.push_back
-    (dataBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
+  m_wire.push_back(makeBinaryBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
 
-  if (m_body.hasWire())
-    {
-      m_wire.push_back(m_body);
-    }
+  if (m_body.hasWire()) {
+    m_wire.push_back(m_body);
+  }
 
   m_wire.encode();
   return m_wire;
diff --git a/src/meta-info.cpp b/src/meta-info.cpp
index 3a70b0d..a1bfa18 100644
--- a/src/meta-info.cpp
+++ b/src/meta-info.cpp
@@ -22,12 +22,12 @@
 #include "meta-info.hpp"
 #include "encoding/block-helpers.hpp"
 #include "encoding/encoding-buffer.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<MetaInfo>));
 BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
 BOOST_CONCEPT_ASSERT((WireDecodable<MetaInfo>));
 static_assert(std::is_base_of<tlv::Error, MetaInfo::Error>::value,
               "MetaInfo::Error must inherit from tlv::Error");
@@ -165,10 +165,10 @@
 }
 
 template size_t
-MetaInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+MetaInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-MetaInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+MetaInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 MetaInfo::wireEncode() const
diff --git a/src/meta-info.hpp b/src/meta-info.hpp
index e88c870..798acd1 100644
--- a/src/meta-info.hpp
+++ b/src/meta-info.hpp
@@ -76,7 +76,7 @@
 
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/name-component.cpp b/src/name-component.cpp
index 1cd0d16..576fac4 100644
--- a/src/name-component.cpp
+++ b/src/name-component.cpp
@@ -30,7 +30,6 @@
 #include "util/string-helper.hpp"
 #include "security/cryptopp.hpp"
 #include "util/crypto.hpp"
-#include "util/concepts.hpp"
 
 #include <boost/lexical_cast.hpp>
 
@@ -39,6 +38,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Component>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Component>));
 static_assert(std::is_base_of<tlv::Error, Component::Error>::value,
               "name::Component::Error must inherit from tlv::Error");
@@ -46,7 +46,7 @@
 static const std::string&
 getSha256DigestUriPrefix()
 {
-  static const std::string prefix { "sha256digest=" };
+  static const std::string prefix{"sha256digest="};
   return prefix;
 }
 
@@ -69,22 +69,22 @@
 }
 
 Component::Component(const Buffer& value)
-  : Block(dataBlock(tlv::NameComponent, value.buf(), value.size()))
+  : Block(makeBinaryBlock(tlv::NameComponent, value.buf(), value.size()))
 {
 }
 
 Component::Component(const uint8_t* value, size_t valueLen)
-  : Block(dataBlock(tlv::NameComponent, value, valueLen))
+  : Block(makeBinaryBlock(tlv::NameComponent, value, valueLen))
 {
 }
 
 Component::Component(const char* str)
-  : Block(dataBlock(tlv::NameComponent, str, std::char_traits<char>::length(str)))
+  : Block(makeBinaryBlock(tlv::NameComponent, str, std::char_traits<char>::length(str)))
 {
 }
 
 Component::Component(const std::string& str)
-  : Block(dataBlock(tlv::NameComponent, str.c_str(), str.size()))
+  : Block(makeStringBlock(tlv::NameComponent, str))
 {
 }
 
@@ -297,7 +297,7 @@
 Component
 Component::fromNumber(uint64_t number)
 {
-  return nonNegativeIntegerBlock(tlv::NameComponent, number);
+  return makeNonNegativeIntegerBlock(tlv::NameComponent, number);
 }
 
 Component
@@ -384,7 +384,7 @@
     throw Error("Cannot create ImplicitSha256DigestComponent (input digest must be " +
                 boost::lexical_cast<std::string>(crypto::SHA256_DIGEST_SIZE) + " octets)");
 
-  return dataBlock(tlv::ImplicitSha256DigestComponent, digest, digestSize);
+  return makeBinaryBlock(tlv::ImplicitSha256DigestComponent, digest, digestSize);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -440,21 +440,21 @@
 
 template<encoding::Tag TAG>
 size_t
-Component::wireEncode(EncodingImpl<TAG>& block) const
+Component::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
   if (value_size() > 0)
-    totalLength += block.prependByteArray(value(), value_size());
-  totalLength += block.prependVarNumber(value_size());
-  totalLength += block.prependVarNumber(type());
+    totalLength += encoder.prependByteArray(value(), value_size());
+  totalLength += encoder.prependVarNumber(value_size());
+  totalLength += encoder.prependVarNumber(type());
   return totalLength;
 }
 
 template size_t
-Component::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
+Component::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-Component::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
+Component::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 const Block&
 Component::wireEncode() const
diff --git a/src/name-component.hpp b/src/name-component.hpp
index c811c9b..6338477 100644
--- a/src/name-component.hpp
+++ b/src/name-component.hpp
@@ -150,7 +150,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
@@ -619,7 +619,7 @@
 template<class Iterator>
 inline
 Component::Component(Iterator first, Iterator last)
-  : Block(dataBlock(tlv::NameComponent, first, last))
+  : Block(makeBinaryBlock(tlv::NameComponent, first, last))
 {
 }
 
diff --git a/src/name.cpp b/src/name.cpp
index ff698d8..1ba3bfd 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -27,7 +27,6 @@
 
 #include "util/time.hpp"
 #include "util/string-helper.hpp"
-#include "util/concepts.hpp"
 #include "encoding/block.hpp"
 #include "encoding/encoding-buffer.hpp"
 
@@ -37,6 +36,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Name>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Name>));
 static_assert(std::is_base_of<tlv::Error, Name::Error>::value,
               "Name::Error must inherit from tlv::Error");
@@ -81,7 +81,7 @@
 }
 
 template size_t
-Name::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+Name::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 Name::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
diff --git a/src/name.hpp b/src/name.hpp
index 2cbab7d..d6040e6 100644
--- a/src/name.hpp
+++ b/src/name.hpp
@@ -112,7 +112,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/selectors.cpp b/src/selectors.cpp
index ae078e3..6e637fa 100644
--- a/src/selectors.cpp
+++ b/src/selectors.cpp
@@ -22,12 +22,12 @@
 #include "selectors.hpp"
 #include "encoding/encoding-buffer.hpp"
 #include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
 
 namespace ndn {
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Selectors>));
 BOOST_CONCEPT_ASSERT((WireEncodable<Selectors>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Selectors>));
 BOOST_CONCEPT_ASSERT((WireDecodable<Selectors>));
 static_assert(std::is_base_of<tlv::Error, Selectors::Error>::value,
               "Selectors::Error must inherit from tlv::Error");
@@ -58,7 +58,7 @@
 
 template<encoding::Tag TAG>
 size_t
-Selectors::wireEncode(EncodingImpl<TAG>& block) const
+Selectors::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -74,43 +74,43 @@
 
   // MustBeFresh
   if (getMustBeFresh()) {
-    totalLength += prependBooleanBlock(block, tlv::MustBeFresh);
+    totalLength += prependEmptyBlock(encoder, tlv::MustBeFresh);
   }
 
   // ChildSelector
   if (getChildSelector() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::ChildSelector, getChildSelector());
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::ChildSelector, getChildSelector());
   }
 
   // Exclude
   if (!getExclude().empty()) {
-    totalLength += getExclude().wireEncode(block);
+    totalLength += getExclude().wireEncode(encoder);
   }
 
   // PublisherPublicKeyLocator
   if (!getPublisherPublicKeyLocator().empty()) {
-    totalLength += getPublisherPublicKeyLocator().wireEncode(block);
+    totalLength += getPublisherPublicKeyLocator().wireEncode(encoder);
   }
 
   // MaxSuffixComponents
   if (getMaxSuffixComponents() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::MaxSuffixComponents,
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::MaxSuffixComponents,
                                                   getMaxSuffixComponents());
   }
 
   // MinSuffixComponents
   if (getMinSuffixComponents() >= 0) {
-    totalLength += prependNonNegativeIntegerBlock(block, tlv::MinSuffixComponents,
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::MinSuffixComponents,
                                                   getMinSuffixComponents());
   }
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::Selectors);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Selectors);
   return totalLength;
 }
 
 template size_t
-Selectors::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& estimator) const;
+Selectors::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
 Selectors::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
diff --git a/src/selectors.hpp b/src/selectors.hpp
index 62b4b06..9a1d8a4 100644
--- a/src/selectors.hpp
+++ b/src/selectors.hpp
@@ -60,7 +60,7 @@
    */
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /**
    * @brief Encode to a wire format
diff --git a/src/signature-info.cpp b/src/signature-info.cpp
index 668e11f..9c1f0de 100644
--- a/src/signature-info.cpp
+++ b/src/signature-info.cpp
@@ -29,6 +29,7 @@
 
 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
 BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
+BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<SignatureInfo>));
 BOOST_CONCEPT_ASSERT((WireDecodable<SignatureInfo>));
 static_assert(std::is_base_of<tlv::Error, SignatureInfo::Error>::value,
               "SignatureInfo::Error must inherit from tlv::Error");
@@ -111,30 +112,30 @@
 
 template<encoding::Tag TAG>
 size_t
-SignatureInfo::wireEncode(EncodingImpl<TAG>& block) const
+SignatureInfo::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
   for (std::list<Block>::const_reverse_iterator i = m_otherTlvs.rbegin();
        i != m_otherTlvs.rend(); i++) {
-    totalLength += block.appendBlock(*i);
+    totalLength += encoder.appendBlock(*i);
   }
 
   if (m_hasKeyLocator)
-    totalLength += m_keyLocator.wireEncode(block);
+    totalLength += m_keyLocator.wireEncode(encoder);
 
-  totalLength += prependNonNegativeIntegerBlock(block, tlv::SignatureType, m_type);
+  totalLength += prependNonNegativeIntegerBlock(encoder, tlv::SignatureType, m_type);
 
-  totalLength += block.prependVarNumber(totalLength);
-  totalLength += block.prependVarNumber(tlv::SignatureInfo);
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::SignatureInfo);
   return totalLength;
 }
 
 template size_t
-SignatureInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
+SignatureInfo::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& encoder) const;
 
 template size_t
-SignatureInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
+SignatureInfo::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& encoder) const;
 
 
 const Block&
diff --git a/src/signature-info.hpp b/src/signature-info.hpp
index 9e0f063..a88b759 100644
--- a/src/signature-info.hpp
+++ b/src/signature-info.hpp
@@ -105,7 +105,7 @@
   /// @brief Encode to a wire format or estimate wire format
   template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<TAG>& block) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /// @brief Encode to a wire format
   const Block&
diff --git a/src/util/concepts.hpp b/src/util/concepts.hpp
index b61c301..8d4567e 100644
--- a/src/util/concepts.hpp
+++ b/src/util/concepts.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -24,6 +24,7 @@
 
 #include <boost/concept/usage.hpp>
 #include "../encoding/block.hpp"
+#include "../encoding/encoding-buffer.hpp"
 
 namespace ndn {
 
@@ -35,10 +36,31 @@
 public:
   BOOST_CONCEPT_USAGE(WireEncodable)
   {
-    X j;
     Block block = j.wireEncode();
     block.size(); // avoid 'unused variable block'
   }
+
+private:
+  X j;
+};
+
+/** \brief a concept check for TLV abstraction with .wireEncode method
+ */
+template<class X>
+class WireEncodableWithEncodingBuffer
+{
+public:
+  BOOST_CONCEPT_USAGE(WireEncodableWithEncodingBuffer)
+  {
+    EncodingEstimator estimator;
+    size_t estimatedSize = j.wireEncode(estimator);
+
+    EncodingBuffer encoder(estimatedSize, 0);
+    j.wireEncode(encoder);
+  }
+
+private:
+  X j;
 };
 
 /** \brief a concept check for TLV abstraction with .wireDecode method
@@ -65,7 +87,6 @@
   BOOST_CONCEPT_USAGE(Hashable)
   {
     X hash;
-
     uint8_t* buf = 0;
     size_t size = hash.DigestSize();