Change wire encoding to return a Blob.
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index 2bb2093..39f7b4a 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.cpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.cpp
@@ -24,7 +24,7 @@
return new BinaryXmlWireFormat();
}
-ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeInterest(const Interest& interest)
+Blob BinaryXmlWireFormat::encodeInterest(const Interest& interest)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -59,8 +59,7 @@
interest.set(interestStruct);
}
-ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeData
- (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+Blob BinaryXmlWireFormat::encodeData(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_NameComponent keyNameComponents[100];
@@ -96,7 +95,7 @@
data.set(dataStruct);
}
-ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
+Blob BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
struct ndn_NameComponent prefixNameComponents[100];
struct ndn_ForwardingEntry forwardingEntryStruct;
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.hpp b/ndn-cpp/encoding/binary-xml-wire-format.hpp
index aca140d..6647566 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -19,9 +19,9 @@
/**
* Encode interest in binary XML and return the encoding.
* @param interest The Interest object to encode.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest& interest);
+ virtual Blob encodeInterest(const Interest& interest);
/**
* Decode input as an interest in binary XML and set the fields of the interest object.
@@ -38,9 +38,9 @@
* If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
* @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
* If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData
+ virtual Blob encodeData
(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
/**
@@ -61,9 +61,9 @@
/**
* Encode forwardingEntry in binary XML and return the encoding.
* @param forwardingEntry The ForwardingEntry object to encode.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
+ virtual Blob encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry in binary XML and set the fields of the forwardingEntry object.
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index e0a4fc0..ced4c18 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -26,7 +26,7 @@
return defaultWireFormat_;
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeInterest(const Interest& interest)
+Blob WireFormat::encodeInterest(const Interest& interest)
{
throw logic_error("unimplemented");
}
@@ -35,8 +35,7 @@
throw logic_error("unimplemented");
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData
- (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+Blob WireFormat::encodeData(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
throw logic_error("unimplemented");
}
@@ -46,7 +45,7 @@
throw logic_error("unimplemented");
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
+Blob WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index b0b2ea4..575b441 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -7,7 +7,7 @@
#define NDN_WIREFORMAT_HPP
#include "../common.hpp"
-#include <vector>
+#include "../util/blob.hpp"
namespace ndn {
@@ -20,10 +20,10 @@
/**
* Encode interest and return the encoding. Your derived class should override.
* @param interest The Interest object to encode.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest& interest);
+ virtual Blob encodeInterest(const Interest& interest);
/**
* Decode input as an interest and set the fields of the interest object. Your derived class should override.
@@ -41,19 +41,19 @@
* If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
* @param signedFieldsEndOffset Return the offset in the encoding of the end of the fields which are signed.
* If you are not encoding in order to sign, you can call encodeData(const Data& data) to ignore this returned value.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData
+ virtual Blob encodeData
(const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
/**
* Encode data and return the encoding.
* @param data The Data object to encode.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData(const Data& data)
+ Blob encodeData(const Data& data)
{
unsigned int dummyBeginOffset, dummyEndOffset;
return encodeData(data, &dummyBeginOffset, &dummyEndOffset);
@@ -84,10 +84,10 @@
/**
* Encode forwardingEntry and return the encoding. Your derived class should override.
* @param forwardingEntry The ForwardingEntry object to encode.
- * @return A shared_ptr with the vector<unsigned char> containing the encoding.
+ * @return A Blob containing the encoding.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
+ virtual Blob encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry and set the fields of the forwardingEntry object. Your derived class should override.