data+interest+selectors+meta-info+signature: Implementing EqualityComparable concept

Change-Id: I54f04820861bdc7b4e001949f1ba8d62f9a66786
diff --git a/src/key-locator.hpp b/src/key-locator.hpp
index 1c71489..a139bf7 100644
--- a/src/key-locator.hpp
+++ b/src/key-locator.hpp
@@ -15,7 +15,15 @@
 
 class KeyLocator {
 public:
-  struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
 
   enum {
     KeyLocator_None = 65535, // just an arbitrarily large number (used only internally)
@@ -24,30 +32,28 @@
     KeyLocator_Unknown = 255
   };
 
-  inline
   KeyLocator()
     : m_type(KeyLocator_None)
   {
   }
 
-  inline
-  KeyLocator(const Name &name);
+  KeyLocator(const Name& name);
 
   ///////////////////////////////////////////////////////////////////////////////
 
   template<bool T>
   size_t
-  wireEncode(EncodingImpl<T> &block) const;
+  wireEncode(EncodingImpl<T>& block) const;
 
   const Block&
   wireEncode() const;
 
   void
-  wireDecode(const Block &wire);
+  wireDecode(const Block& wire);
 
   ///////////////////////////////////////////////////////////////////////////////
 
-  inline bool
+   bool
   empty() const
   {
     return m_type == KeyLocator_None;
@@ -61,11 +67,11 @@
   //
   // For now only Name type is actually supported
 
-  inline const Name&
+  const Name&
   getName() const;
 
-  inline void
-  setName(const Name &name);
+  void
+  setName(const Name& name);
 
 public: // EqualityComparable concept
   bool
@@ -82,7 +88,7 @@
 };
 
 inline
-KeyLocator::KeyLocator(const Name &name)
+KeyLocator::KeyLocator(const Name& name)
 {
   setName(name);
 }
@@ -111,15 +117,15 @@
     throw Error("Unsupported KeyLocator type");
   }
 
-  total_len += block.prependVarNumber (total_len);
-  total_len += block.prependVarNumber (Tlv::KeyLocator);
+  total_len += block.prependVarNumber(total_len);
+  total_len += block.prependVarNumber(Tlv::KeyLocator);
   return total_len;
 }
 
 inline const Block&
 KeyLocator::wireEncode() const
 {
-  if (m_wire.hasWire ())
+  if (m_wire.hasWire())
     return m_wire;
 
   EncodingEstimator estimator;
@@ -133,7 +139,7 @@
 }
 
 inline void
-KeyLocator::wireDecode(const Block &value)
+KeyLocator::wireDecode(const Block& value)
 {
   if (value.type() != Tlv::KeyLocator)
     throw Error("Unexpected TLV type during KeyLocator decoding");
@@ -162,8 +168,9 @@
 }
 
 inline void
-KeyLocator::setName(const Name &name)
+KeyLocator::setName(const Name& name)
 {
+  m_wire.reset();
   m_type = KeyLocator_Name;
   m_name = name;
 }
@@ -171,19 +178,7 @@
 inline bool
 KeyLocator::operator==(const KeyLocator& other) const
 {
-  if (this->getType() != other.getType()) {
-    return false;
-  }
-
-  switch (this->getType()) {
-    case KeyLocator_Name:
-      if (this->getName() != other.getName()) {
-        return false;
-      }
-      break;
-  }
-
-  return true;
+  return wireEncode() == other.wireEncode();
 }
 
 inline bool