encoding: Refactoring EncodingBuffer

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

Change-Id: I8275c6276c5ecfa280f87f584189907521febf5f
Refs: #2494, #2490
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index 3daf497..4bbfe52 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -28,6 +28,7 @@
 
 #include "buffer.hpp"
 #include "tlv.hpp"
+#include "encoding-buffer-fwd.hpp"
 
 namespace boost {
 namespace asio {
@@ -37,9 +38,6 @@
 
 namespace ndn {
 
-template<bool> class EncodingImpl;
-typedef EncodingImpl<true> EncodingBuffer;
-
 /** @brief Class representing a wire element of NDN-TLV packet format
  */
 class Block
@@ -247,6 +245,12 @@
   Block
   blockFromValue() const;
 
+  /**
+   * @brief Get underlying buffer
+   */
+  shared_ptr<const Buffer>
+  getBuffer() const;
+
 public: // EqualityComparable concept
   bool
   operator==(const Block& other) const;
@@ -258,7 +262,7 @@
   operator boost::asio::const_buffer() const;
 
 protected:
-  ConstBufferPtr m_buffer;
+  shared_ptr<const Buffer> m_buffer;
 
   uint32_t m_type;
 
@@ -270,13 +274,18 @@
   Buffer::const_iterator m_value_end;
 
   mutable element_container m_subBlocks;
-  friend class EncodingImpl<true>;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////////////
 
+inline shared_ptr<const Buffer>
+Block::getBuffer() const
+{
+  return m_buffer;
+}
+
 inline bool
 Block::empty() const
 {