tlv: Use the encoding/decoding functions for "double" from ndn-cxx

refs: #4615

Change-Id: I0bde7085876646f272ee6006f4d3cfbd513d4ffd
diff --git a/src/tlv/tlv-nlsr.hpp b/src/tlv/tlv-nlsr.hpp
index 0e400ea..265b2c6 100644
--- a/src/tlv/tlv-nlsr.hpp
+++ b/src/tlv/tlv-nlsr.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018,  The University of Memphis,
+/*
+ * Copyright (c) 2014-2019,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -23,7 +23,6 @@
 #define NLSR_TLV_NLSR_HPP
 
 #include <ndn-cxx/encoding/tlv.hpp>
-#include <ndn-cxx/encoding/block-helpers.hpp>
 
 namespace ndn {
 namespace tlv {
@@ -41,7 +40,7 @@
   AdjacencyLsa     = 131,
   Adjacency        = 132,
   CoordinateLsa    = 133,
-  Double           = 134,
+  CostDouble       = 134,
   HyperbolicRadius = 135,
   HyperbolicAngle  = 136,
   NameLsa          = 137,
@@ -52,48 +51,9 @@
   Destination      = 142,
   NextHop          = 143,
   RoutingTable     = 144,
-  RouteTableEntry  = 145
+  RouteTableEntry  = 145,
 };
 
-/*! \brief Read a double from a TLV element
- *  \param block the TLV element
- *  \throw ndn::tlv::Error block does not contain a double
- *  \sa prependDouble
- */
-inline double
-readDouble(const ndn::Block& block)
-{
-  block.parse();
-  auto it = block.elements_begin();
-
-  double doubleFromBlock = 0.0;
-  if (it == it->elements_end() || it->type() != ndn::tlv::nlsr::Double ||
-      it->value_size() != sizeof(doubleFromBlock)) {
-    BOOST_THROW_EXCEPTION(ndn::tlv::Error("Block does not contain a double"));
-  }
-  memcpy(&doubleFromBlock, it->value(), sizeof(doubleFromBlock));
-  return doubleFromBlock;
-}
-
-/*! \brief Prepend a TLV element containing a double.
- *  \param encoder an EncodingBuffer or EncodingEstimator
- *  \param type TLV-TYPE number
- *  \param value double value
- */
-template<ndn::encoding::Tag TAG>
-inline size_t
-prependDouble(ndn::EncodingImpl<TAG>& encoder, uint32_t type, double value)
-{
-  size_t totalLength = 0;
-
-  const uint8_t* doubleBytes = reinterpret_cast<const uint8_t*>(&value);
-  totalLength = encoder.prependByteArrayBlock(ndn::tlv::nlsr::Double, doubleBytes, 8);
-  totalLength += encoder.prependVarNumber(totalLength);
-  totalLength += encoder.prependVarNumber(type);
-
-  return totalLength;
-}
-
 } // namespace nlsr
 } // namespace tlv
 } // namespace ndn