Data: add a copy constructor and assignment operator to clone the signature pointer.
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 6b2f570..62cdf3b 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -11,6 +11,7 @@
#include "c/data.h"
using namespace std;
+using namespace ndn::ptr_lib;
namespace ndn {
@@ -46,6 +47,32 @@
{
}
+Data::Data(const Data& data)
+: name_(data.name_), metaInfo_(data.metaInfo_), content_(data.content_), wireEncoding_(data.wireEncoding_)
+{
+ if (data.signature_)
+ signature_ = data.signature_->clone();
+}
+
+Data::~Data()
+{
+}
+
+Data& Data::operator=(const Data& data)
+{
+ if (data.signature_)
+ signature_ = data.signature_->clone();
+ else
+ signature_ = shared_ptr<Signature>();
+
+ name_ = data.name_;
+ metaInfo_ = data.metaInfo_;
+ content_ = data.content_;
+ wireEncoding_ = data.wireEncoding_;
+
+ return *this;
+}
+
void
Data::get(struct ndn_Data& dataStruct) const
{