In WireFormat, remove encodeName and decodeName since a name doesn't go over the wire.
diff --git a/ndn-cpp/Name.hpp b/ndn-cpp/Name.hpp
index 3859014..67ed2b6 100644
--- a/ndn-cpp/Name.hpp
+++ b/ndn-cpp/Name.hpp
@@ -63,33 +63,7 @@
* Parse the uri according to the NDN URI Scheme and create the name with the components.
* @param uri the URI string.
*/
- Name(const char *uri);
-
- void encode(std::vector<unsigned char> &output, WireFormat &wireFormat) const
- {
- wireFormat.encodeName(*this, output);
- }
- void encode(std::vector<unsigned char> &output) const
- {
- encode(output, BinaryXMLWireFormat::instance());
- }
- void decode(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat)
- {
- wireFormat.decodeName(*this, input, inputLength);
- }
- void decode(const unsigned char *input, unsigned int inputLength)
- {
- decode(input, inputLength, BinaryXMLWireFormat::instance());
- }
- void decode(const std::vector<unsigned char> &input, WireFormat &wireFormat)
- {
- decode(&input[0], input.size(), wireFormat);
- }
- void decode(const std::vector<unsigned char> &input)
- {
- decode(&input[0], input.size());
- }
-
+ Name(const char *uri);
/**
* Set the nameStruct to point to the components in this name, without copying any memory.
* WARNING: The resulting pointers in nameStruct are invalid after a further use of this object which could reallocate memory.
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
index 6899924..0c1f4d2 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.cpp
@@ -4,7 +4,6 @@
*/
#include <stdexcept>
-#include "../c/encoding/BinaryXMLName.h"
#include "../c/encoding/BinaryXMLInterest.h"
#include "../c/encoding/BinaryXMLContentObject.h"
#include "../Interest.hpp"
@@ -19,33 +18,6 @@
BinaryXMLWireFormat BinaryXMLWireFormat::instance_;
-void BinaryXMLWireFormat::encodeName(const Name &name, vector<unsigned char> &output)
-{
- struct ndn_Name nameStruct;
- struct ndn_NameComponent components[100];
- ndn_Name_init(&nameStruct, components, sizeof(components) / sizeof(components[0]));
- name.get(nameStruct);
-
- BinaryXMLEncoder encoder;
- ndn_encodeBinaryXMLName(&nameStruct, &encoder);
-
- encoder.appendTo(output);
-}
-
-void BinaryXMLWireFormat::decodeName(Name &name, const unsigned char *input, unsigned int inputLength)
-{
- struct ndn_NameComponent components[100];
- struct ndn_Name nameStruct;
- ndn_Name_init(&nameStruct, components, sizeof(components) / sizeof(components[0]));
-
- BinaryXMLDecoder decoder(input, inputLength);
- ndn_Error error;
- if (error = ndn_decodeBinaryXMLName(&nameStruct, &decoder))
- throw std::runtime_error(ndn_getErrorString(error));
-
- name.set(nameStruct);
-}
-
void BinaryXMLWireFormat::encodeInterest(const Interest &interest, vector<unsigned char> &output)
{
struct ndn_NameComponent nameComponents[100];
diff --git a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
index a1a5e6a..d35660f 100644
--- a/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
+++ b/ndn-cpp/encoding/BinaryXMLWireFormat.hpp
@@ -12,9 +12,6 @@
class BinaryXMLWireFormat : public WireFormat {
public:
- virtual void encodeName(const Name &name, std::vector<unsigned char> &output);
- virtual void decodeName(Name &name, const unsigned char *input, unsigned int inputLength);
-
virtual void encodeInterest(const Interest &interest, std::vector<unsigned char> &output);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
diff --git a/ndn-cpp/encoding/WireFormat.cpp b/ndn-cpp/encoding/WireFormat.cpp
index 7e784a3..5d46241 100644
--- a/ndn-cpp/encoding/WireFormat.cpp
+++ b/ndn-cpp/encoding/WireFormat.cpp
@@ -9,16 +9,6 @@
using namespace std;
namespace ndn {
-
-void WireFormat::encodeName(const Name &name, vector<unsigned char> &output)
-{
- throw logic_error("unimplemented");
-}
-void WireFormat::decodeName(Name &name, const unsigned char *input, unsigned int inputLength)
-{
- throw logic_error("unimplemented");
-}
-
void WireFormat::encodeInterest(const Interest &interest, vector<unsigned char> &output)
{
throw logic_error("unimplemented");
diff --git a/ndn-cpp/encoding/WireFormat.hpp b/ndn-cpp/encoding/WireFormat.hpp
index 8458f94..df532e9 100644
--- a/ndn-cpp/encoding/WireFormat.hpp
+++ b/ndn-cpp/encoding/WireFormat.hpp
@@ -10,15 +10,11 @@
namespace ndn {
-class Name;
class Interest;
class ContentObject;
class WireFormat {
public:
- virtual void encodeName(const Name &name, std::vector<unsigned char> &output);
- virtual void decodeName(Name &name, const unsigned char *input, unsigned int inputLength);
-
virtual void encodeInterest(const Interest &interest, std::vector<unsigned char> &output);
virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);