Use argument defaults for getDefaultWireFormat() instead of a separate overloaded method.
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 5d67f0f..28d753a 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -152,30 +152,18 @@
{
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
{
return wireFormat.encodeData(*this);
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode() const
- {
- return wireEncode(*WireFormat::getDefaultWireFormat());
- }
- void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
+ void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeData(*this, input, inputLength);
}
- void wireDecode(const unsigned char *input, unsigned int inputLength)
- {
- wireDecode(input, inputLength, *WireFormat::getDefaultWireFormat());
- }
- void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat)
+ void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
- void wireDecode(const std::vector<unsigned char>& input)
- {
- wireDecode(&input[0], input.size());
- }
/**
* Set the dataStruct to point to the values in this interest, without copying any memory.
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index b3397af..50baaa4 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -159,30 +159,18 @@
construct();
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat = *WireFormat::getDefaultWireFormat()) const
{
return wireFormat.encodeInterest(*this);
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode() const
- {
- return wireEncode(*WireFormat::getDefaultWireFormat());
- }
- void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
+ void wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireFormat.decodeInterest(*this, input, inputLength);
}
- void wireDecode(const unsigned char *input, unsigned int inputLength)
- {
- wireDecode(input, inputLength, *WireFormat::getDefaultWireFormat());
- }
- void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat)
+ void wireDecode(const std::vector<unsigned char>& input, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat())
{
wireDecode(&input[0], input.size(), wireFormat);
}
- void wireDecode(const std::vector<unsigned char>& input)
- {
- wireDecode(&input[0], input.size());
- }
/**
* Set the interestStruct to point to the components in this interest, without copying any memory.
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index a9248df..c456036 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -121,12 +121,6 @@
sign(data, DEFAULT_PUBLIC_KEY_DER, sizeof(DEFAULT_PUBLIC_KEY_DER), DEFAULT_PRIVATE_KEY_DER, sizeof(DEFAULT_PRIVATE_KEY_DER), wireFormat);
}
-void KeyChain::defaultSign(Data& data)
-{
- sign(data, DEFAULT_PUBLIC_KEY_DER, sizeof(DEFAULT_PUBLIC_KEY_DER), DEFAULT_PRIVATE_KEY_DER, sizeof(DEFAULT_PRIVATE_KEY_DER),
- *WireFormat::getDefaultWireFormat());
-}
-
bool KeyChain::selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
{
// Decode the data packet and digest the data fields.
diff --git a/ndn-cpp/security/key-chain.hpp b/ndn-cpp/security/key-chain.hpp
index 584ddc4..0afa4b5 100644
--- a/ndn-cpp/security/key-chain.hpp
+++ b/ndn-cpp/security/key-chain.hpp
@@ -31,17 +31,11 @@
/**
* Call sign with the default public and private keys.
* @param data
- * @param wireFormat The WireFormat for calling encodeData.
+ * @param wireFormat The WireFormat for calling encodeData, or WireFormat::getDefaultWireFormat() if omitted.
*/
- static void defaultSign(Data& data, WireFormat& wireFormat);
+ static void defaultSign(Data& data, WireFormat& wireFormat = *WireFormat::getDefaultWireFormat());
/**
- * Call sign with the default public and private keys. For wireFormat, use WireFormat::getDefaultWireFormat().
- * @param data
- */
- static void defaultSign(Data& data);
-
- /**
* Use the WireFormat to decode the input as a Data packet and use the public key in the key locator to
* verify the signature.
* This does just uses the public key without checking whether it is certified.