encoding: Refactoring EncodingBuffer

Breaks: nfd:commit:c0273e3505ac2ccf843401be77a513d8eb663127
Breaks: ChronoSync:commit:e042f83a1df184a8e7a90ef00034d11026891cd1

Change-Id: I8275c6276c5ecfa280f87f584189907521febf5f
Refs: #2494, #2490
diff --git a/src/management/nfd-channel-status.cpp b/src/management/nfd-channel-status.cpp
index 771b8d3..2c93283 100644
--- a/src/management/nfd-channel-status.cpp
+++ b/src/management/nfd-channel-status.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).
  *
@@ -42,13 +42,13 @@
   this->wireDecode(payload);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-ChannelStatus::wireEncode(EncodingImpl<T>& encoder) const
+ChannelStatus::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
-  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                  reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
 
   totalLength += encoder.prependVarNumber(totalLength);
@@ -57,10 +57,10 @@
 }
 
 template size_t
-ChannelStatus::wireEncode<true>(EncodingImpl<true>& block) const;
+ChannelStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
 
 template size_t
-ChannelStatus::wireEncode<false>(EncodingImpl<false>& block) const;
+ChannelStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
 
 const Block&
 ChannelStatus::wireEncode() const
diff --git a/src/management/nfd-channel-status.hpp b/src/management/nfd-channel-status.hpp
index 4bb2707..422de2b 100644
--- a/src/management/nfd-channel-status.hpp
+++ b/src/management/nfd-channel-status.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).
  *
@@ -50,9 +50,9 @@
   explicit
   ChannelStatus(const Block& payload);
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/management/nfd-control-parameters.cpp b/src/management/nfd-control-parameters.cpp
index 773d65a..eb9fa0f 100644
--- a/src/management/nfd-control-parameters.cpp
+++ b/src/management/nfd-control-parameters.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).
  *
@@ -44,9 +44,9 @@
   wireDecode(block);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-ControlParameters::wireEncode(EncodingImpl<T>& encoder) const
+ControlParameters::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -90,10 +90,10 @@
 }
 
 template size_t
-ControlParameters::wireEncode<true>(EncodingImpl<true>& encoder) const;
+ControlParameters::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
 
 template size_t
-ControlParameters::wireEncode<false>(EncodingImpl<false>& estimator) const;
+ControlParameters::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
 
 const Block&
 ControlParameters::wireEncode() const
diff --git a/src/management/nfd-control-parameters.hpp b/src/management/nfd-control-parameters.hpp
index faa7c3a..29434fc 100644
--- a/src/management/nfd-control-parameters.hpp
+++ b/src/management/nfd-control-parameters.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).
  *
@@ -89,9 +89,9 @@
   explicit
   ControlParameters(const Block& block);
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/management/nfd-face-event-notification.cpp b/src/management/nfd-face-event-notification.cpp
index 18b12d1..9e757a3 100644
--- a/src/management/nfd-face-event-notification.cpp
+++ b/src/management/nfd-face-event-notification.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).
  *
@@ -43,9 +43,9 @@
   this->wireDecode(block);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-FaceEventNotification::wireEncode(EncodingImpl<T>& encoder) const
+FaceEventNotification::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -55,9 +55,9 @@
                  tlv::nfd::FacePersistency, m_facePersistency);
   totalLength += prependNonNegativeIntegerBlock(encoder,
                  tlv::nfd::FaceScope, m_faceScope);
-  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                  reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
-  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                  reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
   totalLength += prependNonNegativeIntegerBlock(encoder,
                  tlv::nfd::FaceId, m_faceId);
diff --git a/src/management/nfd-face-event-notification.hpp b/src/management/nfd-face-event-notification.hpp
index f101f25..56325ef 100644
--- a/src/management/nfd-face-event-notification.hpp
+++ b/src/management/nfd-face-event-notification.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).
  *
@@ -51,9 +51,9 @@
 
   /** \brief prepend FaceEventNotification to the encoder
    */
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \brief encode FaceEventNotification
    */
diff --git a/src/management/nfd-face-query-filter.cpp b/src/management/nfd-face-query-filter.cpp
index d0ca150..0fa02f2 100644
--- a/src/management/nfd-face-query-filter.cpp
+++ b/src/management/nfd-face-query-filter.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).
  *
@@ -49,9 +49,9 @@
   this->wireDecode(block);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-FaceQueryFilter::wireEncode(EncodingImpl<T>& encoder) const
+FaceQueryFilter::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -71,17 +71,17 @@
   }
 
   if (m_hasLocalUri) {
-    totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+    totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                    reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
   }
 
   if (m_hasRemoteUri) {
-    totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+    totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                    reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
   }
 
   if (m_hasUriScheme) {
-    totalLength += prependByteArrayBlock(encoder, tlv::nfd::UriScheme,
+    totalLength += encoder.prependByteArrayBlock(tlv::nfd::UriScheme,
                    reinterpret_cast<const uint8_t*>(m_uriScheme.c_str()), m_uriScheme.size());
   }
 
@@ -96,10 +96,10 @@
 }
 
 template size_t
-FaceQueryFilter::wireEncode<true>(EncodingImpl<true>& block) const;
+FaceQueryFilter::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
 
 template size_t
-FaceQueryFilter::wireEncode<false>(EncodingImpl<false>& block) const;
+FaceQueryFilter::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
 
 const Block&
 FaceQueryFilter::wireEncode() const
diff --git a/src/management/nfd-face-query-filter.hpp b/src/management/nfd-face-query-filter.hpp
index 5833d1f..30ea386 100644
--- a/src/management/nfd-face-query-filter.hpp
+++ b/src/management/nfd-face-query-filter.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).
  *
@@ -53,9 +53,9 @@
 
   /** \brief prepend FaceQueryFilter to the encoder
    */
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \brief encode FaceQueryFilter
    */
diff --git a/src/management/nfd-face-status.cpp b/src/management/nfd-face-status.cpp
index 8a08825..becaa75 100644
--- a/src/management/nfd-face-status.cpp
+++ b/src/management/nfd-face-status.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).
  *
@@ -49,9 +49,9 @@
   this->wireDecode(block);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-FaceStatus::wireEncode(EncodingImpl<T>& encoder) const
+FaceStatus::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -77,9 +77,9 @@
     totalLength += prependNonNegativeIntegerBlock(encoder,
                    tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
   }
-  totalLength += prependByteArrayBlock(encoder, tlv::nfd::LocalUri,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                  reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
-  totalLength += prependByteArrayBlock(encoder, tlv::nfd::Uri,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                  reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
   totalLength += prependNonNegativeIntegerBlock(encoder,
                  tlv::nfd::FaceId, m_faceId);
@@ -90,10 +90,10 @@
 }
 
 template size_t
-FaceStatus::wireEncode<true>(EncodingImpl<true>& block) const;
+FaceStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
 
 template size_t
-FaceStatus::wireEncode<false>(EncodingImpl<false>& block) const;
+FaceStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
 
 const Block&
 FaceStatus::wireEncode() const
@@ -321,4 +321,3 @@
 
 } // namespace nfd
 } // namespace ndn
-
diff --git a/src/management/nfd-face-status.hpp b/src/management/nfd-face-status.hpp
index 5b70ce2..f29b568 100644
--- a/src/management/nfd-face-status.hpp
+++ b/src/management/nfd-face-status.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).
  *
@@ -44,9 +44,9 @@
 
   /** \brief prepend FaceStatus to the encoder
    */
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \brief encode FaceStatus
    */
diff --git a/src/management/nfd-fib-entry.cpp b/src/management/nfd-fib-entry.cpp
index 73b5f42..b8c5274 100644
--- a/src/management/nfd-fib-entry.cpp
+++ b/src/management/nfd-fib-entry.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).
  *
@@ -71,9 +71,9 @@
   return *this;
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-NextHopRecord::wireEncode(EncodingImpl<T>& block) const
+NextHopRecord::wireEncode(EncodingImpl<TAG>& block) const
 {
   size_t totalLength = 0;
   totalLength += prependNonNegativeIntegerBlock(block,
@@ -90,10 +90,10 @@
 }
 
 template size_t
-NextHopRecord::wireEncode<true>(EncodingImpl<true>& block) const;
+NextHopRecord::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
 
 template size_t
-NextHopRecord::wireEncode<false>(EncodingImpl<false>& block) const;
+NextHopRecord::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
 
 const Block&
 NextHopRecord::wireEncode() const
@@ -182,9 +182,9 @@
   return *this;
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-FibEntry::wireEncode(EncodingImpl<T>& block) const
+FibEntry::wireEncode(EncodingImpl<TAG>& block) const
 {
   size_t totalLength = 0;
 
@@ -200,10 +200,10 @@
 }
 
 template size_t
-FibEntry::wireEncode<true>(EncodingImpl<true>& block) const;
+FibEntry::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
 
 template size_t
-FibEntry::wireEncode<false>(EncodingImpl<false>& block) const;
+FibEntry::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
 
 const Block&
 FibEntry::wireEncode() const
diff --git a/src/management/nfd-fib-entry.hpp b/src/management/nfd-fib-entry.hpp
index 0e7bb59..f1f3003 100644
--- a/src/management/nfd-fib-entry.hpp
+++ b/src/management/nfd-fib-entry.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).
  *
@@ -67,9 +67,9 @@
   NextHopRecord&
   setCost(uint64_t cost);
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& block) const;
+  wireEncode(EncodingImpl<TAG>& block) const;
 
   const Block&
   wireEncode() const;
@@ -132,9 +132,9 @@
     return *this;
   }
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& block) const;
+  wireEncode(EncodingImpl<TAG>& block) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/management/nfd-forwarder-status.cpp b/src/management/nfd-forwarder-status.cpp
index c4e736a..4e989ee 100644
--- a/src/management/nfd-forwarder-status.cpp
+++ b/src/management/nfd-forwarder-status.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).
  *
@@ -53,9 +53,9 @@
   this->wireDecode(payload);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-ForwarderStatus::wireEncode(EncodingImpl<T>& encoder) const
+ForwarderStatus::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -81,7 +81,7 @@
                                                 time::toUnixTimestamp(m_currentTimestamp).count());
   totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::StartTimestamp,
                                                 time::toUnixTimestamp(m_startTimestamp).count());
-  totalLength += prependByteArrayBlock(encoder,tlv::nfd::NfdVersion,
+  totalLength += encoder.prependByteArrayBlock(tlv::nfd::NfdVersion,
                                        reinterpret_cast<const uint8_t*>(m_nfdVersion.c_str()),
                                        m_nfdVersion.size());
 
@@ -91,10 +91,10 @@
 }
 
 template size_t
-ForwarderStatus::wireEncode<true>(EncodingImpl<true>& block) const;
+ForwarderStatus::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
 
 template size_t
-ForwarderStatus::wireEncode<false>(EncodingImpl<false>& block) const;
+ForwarderStatus::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
 
 const Block&
 ForwarderStatus::wireEncode() const
diff --git a/src/management/nfd-forwarder-status.hpp b/src/management/nfd-forwarder-status.hpp
index c45d403..11f59e1 100644
--- a/src/management/nfd-forwarder-status.hpp
+++ b/src/management/nfd-forwarder-status.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).
  *
@@ -55,9 +55,9 @@
    *
    *  The outermost Content element isn't part of ForwardStatus structure.
    */
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   /** \brief encode ForwarderStatus as a Content block
    *
diff --git a/src/management/nfd-local-control-header.hpp b/src/management/nfd-local-control-header.hpp
index 6a6803e..5f8d667 100644
--- a/src/management/nfd-local-control-header.hpp
+++ b/src/management/nfd-local-control-header.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).
  *
@@ -155,9 +155,9 @@
   }
 
 private:
-  template<bool T>
+  template<encoding::Tag TAG>
   inline size_t
-  wireEncode(EncodingImpl<T>& block, size_t payloadSize,
+  wireEncode(EncodingImpl<TAG>& block, size_t payloadSize,
              bool encodeIncomingFaceId, bool encodeNextHopFaceId) const;
 
 private:
@@ -169,9 +169,9 @@
 /**
  * @brief Fast encoding or block size estimation
  */
-template<bool T>
+template<encoding::Tag TAG>
 inline size_t
-LocalControlHeader::wireEncode(EncodingImpl<T>& block, size_t payloadSize,
+LocalControlHeader::wireEncode(EncodingImpl<TAG>& block, size_t payloadSize,
                                bool encodeIncomingFaceId, bool encodeNextHopFaceId) const
 {
   size_t totalLength = payloadSize;
diff --git a/src/management/nfd-rib-entry.cpp b/src/management/nfd-rib-entry.cpp
index 9fc7fd9..ab78d5c 100644
--- a/src/management/nfd-rib-entry.cpp
+++ b/src/management/nfd-rib-entry.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).
  *
@@ -56,9 +56,9 @@
   wireDecode(block);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-Route::wireEncode(EncodingImpl<T>& block) const
+Route::wireEncode(EncodingImpl<TAG>& block) const
 {
   size_t totalLength = 0;
 
@@ -92,10 +92,10 @@
 }
 
 template size_t
-Route::wireEncode<true>(EncodingImpl<true>& block) const;
+Route::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
 
 template size_t
-Route::wireEncode<false>(EncodingImpl<false>& block) const;
+Route::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
 
 const Block&
 Route::wireEncode() const
@@ -216,9 +216,9 @@
 }
 
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-RibEntry::wireEncode(EncodingImpl<T>& block) const
+RibEntry::wireEncode(EncodingImpl<TAG>& block) const
 {
   size_t totalLength = 0;
 
@@ -237,10 +237,10 @@
 }
 
 template size_t
-RibEntry::wireEncode<true>(EncodingImpl<true>& block) const;
+RibEntry::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>& block) const;
 
 template size_t
-RibEntry::wireEncode<false>(EncodingImpl<false>& block) const;
+RibEntry::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>& block) const;
 
 const Block&
 RibEntry::wireEncode() const
diff --git a/src/management/nfd-rib-entry.hpp b/src/management/nfd-rib-entry.hpp
index 8fa1704..ad5fe92 100644
--- a/src/management/nfd-rib-entry.hpp
+++ b/src/management/nfd-rib-entry.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).
  *
@@ -152,9 +152,9 @@
     return m_hasInfiniteExpirationPeriod;
   }
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& block) const;
+  wireEncode(EncodingImpl<TAG>& block) const;
 
   const Block&
   wireEncode() const;
@@ -243,9 +243,9 @@
     return *this;
   }
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& block) const;
+  wireEncode(EncodingImpl<TAG>& block) const;
 
   const Block&
   wireEncode() const;
diff --git a/src/management/nfd-strategy-choice.cpp b/src/management/nfd-strategy-choice.cpp
index 9296954..6283acd 100644
--- a/src/management/nfd-strategy-choice.cpp
+++ b/src/management/nfd-strategy-choice.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).
  *
@@ -42,9 +42,9 @@
   this->wireDecode(payload);
 }
 
-template<bool T>
+template<encoding::Tag TAG>
 size_t
-StrategyChoice::wireEncode(EncodingImpl<T>& encoder) const
+StrategyChoice::wireEncode(EncodingImpl<TAG>& encoder) const
 {
   size_t totalLength = 0;
 
@@ -57,10 +57,10 @@
 }
 
 template size_t
-StrategyChoice::wireEncode<true>(EncodingImpl<true>& block) const;
+StrategyChoice::wireEncode<encoding::EncoderTag>(EncodingImpl<encoding::EncoderTag>&) const;
 
 template size_t
-StrategyChoice::wireEncode<false>(EncodingImpl<false>& block) const;
+StrategyChoice::wireEncode<encoding::EstimatorTag>(EncodingImpl<encoding::EstimatorTag>&) const;
 
 const Block&
 StrategyChoice::wireEncode() const
diff --git a/src/management/nfd-strategy-choice.hpp b/src/management/nfd-strategy-choice.hpp
index 6fc2f18..4d8e781 100644
--- a/src/management/nfd-strategy-choice.hpp
+++ b/src/management/nfd-strategy-choice.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).
  *
@@ -51,9 +51,9 @@
   explicit
   StrategyChoice(const Block& payload);
 
-  template<bool T>
+  template<encoding::Tag TAG>
   size_t
-  wireEncode(EncodingImpl<T>& encoder) const;
+  wireEncode(EncodingImpl<TAG>& encoder) const;
 
   const Block&
   wireEncode() const;