Rename encode and decode to wireEncode and wireDecode
diff --git a/ndn-cpp/Interest.hpp b/ndn-cpp/Interest.hpp
index 449c0e5..370b093 100644
--- a/ndn-cpp/Interest.hpp
+++ b/ndn-cpp/Interest.hpp
@@ -140,29 +140,29 @@
{
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > encode(WireFormat &wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat &wireFormat) const
{
return wireFormat.encodeInterest(*this);
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > encode() const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode() const
{
- return encode(*WireFormat::getDefaultWireFormat());
+ return wireEncode(*WireFormat::getDefaultWireFormat());
}
- void decode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
+ void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
{
wireFormat.decodeInterest(*this, input, inputLength);
}
- void decode(const unsigned char *input, unsigned int inputLength)
+ void wireDecode(const unsigned char *input, unsigned int inputLength)
{
- decode(input, inputLength, *WireFormat::getDefaultWireFormat());
+ wireDecode(input, inputLength, *WireFormat::getDefaultWireFormat());
}
- void decode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
+ void wireDecode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
{
- decode(&input[0], input.size(), wireFormat);
+ wireDecode(&input[0], input.size(), wireFormat);
}
- void decode(const std::vector<unsigned char> &input)
+ void wireDecode(const std::vector<unsigned char> &input)
{
- decode(&input[0], input.size());
+ wireDecode(&input[0], input.size());
}
/**
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index bb616fb..7da6dad 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -84,29 +84,29 @@
class Data {
public:
- ptr_lib::shared_ptr<std::vector<unsigned char> > encode(WireFormat &wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat &wireFormat) const
{
return wireFormat.encodeData(*this);
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > encode() const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode() const
{
- return encode(*WireFormat::getDefaultWireFormat());
+ return wireEncode(*WireFormat::getDefaultWireFormat());
}
- void decode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
+ void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
{
wireFormat.decodeData(*this, input, inputLength);
}
- void decode(const unsigned char *input, unsigned int inputLength)
+ void wireDecode(const unsigned char *input, unsigned int inputLength)
{
- decode(input, inputLength, *WireFormat::getDefaultWireFormat());
+ wireDecode(input, inputLength, *WireFormat::getDefaultWireFormat());
}
- void decode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
+ void wireDecode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
{
- decode(&input[0], input.size(), wireFormat);
+ wireDecode(&input[0], input.size(), wireFormat);
}
- void decode(const std::vector<unsigned char> &input)
+ void wireDecode(const std::vector<unsigned char> &input)
{
- decode(&input[0], input.size());
+ wireDecode(&input[0], input.size());
}
/**
diff --git a/ndn-cpp/face.cpp b/ndn-cpp/face.cpp
index f2212ea..4fa2325 100644
--- a/ndn-cpp/face.cpp
+++ b/ndn-cpp/face.cpp
@@ -16,7 +16,7 @@
void Face::expressInterest(const Name &name, const shared_ptr<Closure> &closure, const Interest *interestTemplate)
{
Interest interest(name);
- shared_ptr<vector<unsigned char> > encoding = interest.encode();
+ shared_ptr<vector<unsigned char> > encoding = interest.wireEncode();
// TODO: This should go in the PIT.
tempClosure_ = closure;
@@ -31,7 +31,7 @@
if (decoder.peekDTag(ndn_BinaryXml_DTag_ContentObject)) {
shared_ptr<Data> data(new Data());
- data->decode(element, elementLength);
+ data->wireDecode(element, elementLength);
shared_ptr<Interest> dummyInterest;
UpcallInfo upcallInfo(this, dummyInterest, 0, data);
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index bc4a324..b328001 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -74,7 +74,7 @@
{
try {
Data data;
- data.decode(Data1, sizeof(Data1));
+ data.wireDecode(Data1, sizeof(Data1));
cout << "Data name " << data.getName().to_uri() << endl;
#if 0
ptime timestamp = UNIX_EPOCH_TIME + milliseconds(data.getSignedInfo().getTimestampMilliseconds());
@@ -82,11 +82,11 @@
<< " " << timestamp.time_of_day().hours() << ":" << timestamp.time_of_day().minutes() << ":" << timestamp.time_of_day().seconds() << endl;
#endif
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = data.encode();
+ ptr_lib::shared_ptr<vector<unsigned char> > encoding = data.wireEncode();
cout << "Data encoding length " << encoding->size() << " vs. sizeof(Data1) " << sizeof(Data1) << endl;
Data reDecodedData;
- reDecodedData.decode(*encoding);
+ reDecodedData.wireDecode(*encoding);
cout << "Re-decoded Data name " << reDecodedData.getName().to_uri() << endl;
#if 0
timestamp = UNIX_EPOCH_TIME + milliseconds(reDecodedData.getSignedInfo().getTimestampMilliseconds());
diff --git a/tests/test-encode-decode-interest.cpp b/tests/test-encode-decode-interest.cpp
index 412f78e..6d5b9d3 100644
--- a/tests/test-encode-decode-interest.cpp
+++ b/tests/test-encode-decode-interest.cpp
@@ -37,18 +37,18 @@
{
try {
Interest interest;
- interest.decode(Interest1, sizeof(Interest1));
+ interest.wireDecode(Interest1, sizeof(Interest1));
cout << "Interest name " << interest.getName().to_uri() << endl;
cout << "Interest minSuffixComponents " << interest.getMinSuffixComponents() << endl;
cout << "Interest publisherPublicKeyDigest length " << interest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() << endl;
cout << "Interest excludeEntryCount " << interest.getExclude().getEntryCount() << endl;
cout << "InterestLifetimeMilliseconds " << interest.getInterestLifetimeMilliseconds() << endl;
- ptr_lib::shared_ptr<vector<unsigned char> > encoding = interest.encode();
+ ptr_lib::shared_ptr<vector<unsigned char> > encoding = interest.wireEncode();
cout << "Interest encoding length " << encoding->size() << " vs. sizeof(Interest1) " << sizeof(Interest1) << endl;
Interest reDecodedInterest;
- reDecodedInterest.decode(*encoding);
+ reDecodedInterest.wireDecode(*encoding);
cout << "Re-decoded Interest name " << reDecodedInterest.getName().to_uri() << endl;
cout << "Re-decoded Interest minSuffixComponents " << reDecodedInterest.getMinSuffixComponents() << endl;
cout << "Re-decoded Interest publisherPublicKeyDigest length " << reDecodedInterest.getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() << endl;