data: Add ability to print out information about Data packet using std::ostream
Change-Id: I20869cebd259e90f8b69d48758a090a8c31fa34c
diff --git a/src/data.cpp b/src/data.cpp
index 4326040..6b1efd7 100644
--- a/src/data.cpp
+++ b/src/data.cpp
@@ -77,5 +77,18 @@
signature_.setValue(wire_.get(Tlv::SignatureValue));
}
+std::ostream&
+operator << (std::ostream &os, const Data &data)
+{
+ os << "Name: " << data.getName() << "\n";
+ os << "MetaInfo: " << data.getMetaInfo() << "\n";
+ os << "Content: (size: " << data.getContent().value_size() << ")\n";
+ os << "Signature: (type: " << data.getSignature().getType() <<
+ ", value_length: "<< data.getSignature().getValue().value_size() << ")";
+ os << std::endl;
+
+ return os;
+}
+
}