data: Implementing Data::getFullName() method to get Data packet name with implicit digest

Note that getFullName() method will throw a Data::Error if Data packet
does not have wire encoding, i.e., it has not been constructed from wire
and is not yet signed.

Change-Id: I7a9b8a6c9e4c6eced9bc907bfc81adb5d4f0e4b3
Refs: #1298
diff --git a/src/data.cpp b/src/data.cpp
index 8ce8f4c..596e20b 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -116,6 +116,7 @@
 void
 Data::wireDecode(const Block& wire)
 {
+  m_fullName.clear();
   m_wire = wire;
   m_wire.parse();
 
@@ -156,6 +157,21 @@
   return *this;
 }
 
+const Name&
+Data::getFullName() const
+{
+  if (m_fullName.empty()) {
+    if (!m_wire.hasWire()) {
+      throw Error("Full name requested, but Data packet does not have wire format "
+                  "(e.g., not signed)");
+    }
+    m_fullName = m_name;
+    m_fullName.append(name::Component(crypto::sha256(m_wire.wire(), m_wire.size())));
+  }
+
+  return m_fullName;
+}
+
 Data&
 Data::setMetaInfo(const MetaInfo& metaInfo)
 {
@@ -275,6 +291,7 @@
   // the application to do proper re-signing if necessary
 
   m_wire.reset();
+  m_fullName.clear();
 }
 
 bool