Code style: Declare (Type& value) instead of (Type &value)
diff --git a/ndn-cpp/common.cpp b/ndn-cpp/common.cpp
index b4c6e45..b4a1bd8 100644
--- a/ndn-cpp/common.cpp
+++ b/ndn-cpp/common.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-string toHex(const vector<unsigned char> &array)
+string toHex(const vector<unsigned char>& array)
{
ostringstream result;
result.flags(ios::hex | ios::uppercase);
diff --git a/ndn-cpp/common.hpp b/ndn-cpp/common.hpp
index 56b1aa4..79952a4 100644
--- a/ndn-cpp/common.hpp
+++ b/ndn-cpp/common.hpp
@@ -56,7 +56,7 @@
* @param value the array of bytes, or 0 to not copy
* @param valueLength the length of value
*/
-static inline void setVector(std::vector<unsigned char> &vec, const unsigned char *value, unsigned int valueLength)
+static inline void setVector(std::vector<unsigned char>& vec, const unsigned char *value, unsigned int valueLength)
{
vec.clear();
if (value)
@@ -68,7 +68,7 @@
* @param array The array of bytes.
* @return Hex string.
*/
-std::string toHex(const std::vector<unsigned char> &array);
+std::string toHex(const std::vector<unsigned char>& array);
}
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 322faff..1028795 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-void Signature::get(struct ndn_Signature &signatureStruct) const
+void Signature::get(struct ndn_Signature& signatureStruct) const
{
signatureStruct.digestAlgorithmLength = digestAlgorithm_.size();
if (digestAlgorithm_.size() > 0)
@@ -31,14 +31,14 @@
signatureStruct.signature = 0;
}
-void Signature::set(const struct ndn_Signature &signatureStruct)
+void Signature::set(const struct ndn_Signature& signatureStruct)
{
setVector(digestAlgorithm_, signatureStruct.digestAlgorithm, signatureStruct.digestAlgorithmLength);
setVector(witness_, signatureStruct.witness, signatureStruct.witnessLength);
setVector(signature_, signatureStruct.signature, signatureStruct.signatureLength);
}
-void SignedInfo::get(struct ndn_SignedInfo &signedInfoStruct) const
+void SignedInfo::get(struct ndn_SignedInfo& signedInfoStruct) const
{
publisherPublicKeyDigest_.get(signedInfoStruct.publisherPublicKeyDigest);
signedInfoStruct.timestampMilliseconds = timestampMilliseconds_;
@@ -54,7 +54,7 @@
keyLocator_.get(signedInfoStruct.keyLocator);
}
-void SignedInfo::set(const struct ndn_SignedInfo &signedInfoStruct)
+void SignedInfo::set(const struct ndn_SignedInfo& signedInfoStruct)
{
publisherPublicKeyDigest_.set(signedInfoStruct.publisherPublicKeyDigest);
timestampMilliseconds_ = signedInfoStruct.timestampMilliseconds;
@@ -64,7 +64,7 @@
keyLocator_.set(signedInfoStruct.keyLocator);
}
-void Data::get(struct ndn_Data &dataStruct) const
+void Data::get(struct ndn_Data& dataStruct) const
{
signature_.get(dataStruct.signature);
name_.get(dataStruct.name);
@@ -77,7 +77,7 @@
dataStruct.content = 0;
}
-void Data::set(const struct ndn_Data &dataStruct)
+void Data::set(const struct ndn_Data& dataStruct)
{
signature_.set(dataStruct.signature);
name_.set(dataStruct.name);
diff --git a/ndn-cpp/data.hpp b/ndn-cpp/data.hpp
index 24b436a..620da8c 100644
--- a/ndn-cpp/data.hpp
+++ b/ndn-cpp/data.hpp
@@ -21,36 +21,36 @@
* WARNING: The resulting pointers in signatureStruct are invalid after a further use of this object which could reallocate memory.
* @param signatureStruct a C ndn_Signature struct where the name components array is already allocated.
*/
- void get(struct ndn_Signature &signatureStruct) const;
+ void get(struct ndn_Signature& signatureStruct) const;
/**
* Clear this signature, and set the values by copying from the ndn_Signature struct.
* @param signatureStruct a C ndn_Signature struct
*/
- void set(const struct ndn_Signature &signatureStruct);
+ void set(const struct ndn_Signature& signatureStruct);
- const std::vector<unsigned char> &getDigestAlgorithm() const { return digestAlgorithm_; }
- std::vector<unsigned char> &getDigestAlgorithm() { return digestAlgorithm_; }
+ const std::vector<unsigned char>& getDigestAlgorithm() const { return digestAlgorithm_; }
+ std::vector<unsigned char>& getDigestAlgorithm() { return digestAlgorithm_; }
- const std::vector<unsigned char> &getWitness() const { return witness_; }
- std::vector<unsigned char> &getWitness() { return witness_; }
+ const std::vector<unsigned char>& getWitness() const { return witness_; }
+ std::vector<unsigned char>& getWitness() { return witness_; }
- const std::vector<unsigned char> &getSignature() const { return signature_; }
- std::vector<unsigned char> &getSignature() { return signature_; }
+ const std::vector<unsigned char>& getSignature() const { return signature_; }
+ std::vector<unsigned char>& getSignature() { return signature_; }
- void setDigestAlgorithm(const std::vector<unsigned char> &digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
+ void setDigestAlgorithm(const std::vector<unsigned char>& digestAlgorithm) { digestAlgorithm_ = digestAlgorithm; }
void setDigestAlgorithm(const unsigned char *digestAlgorithm, unsigned int digestAlgorithmLength)
{
setVector(digestAlgorithm_, digestAlgorithm, digestAlgorithmLength);
}
- void setWitness(const std::vector<unsigned char> &witness) { witness_ = witness; }
+ void setWitness(const std::vector<unsigned char>& witness) { witness_ = witness; }
void setWitness(const unsigned char *witness, unsigned int witnessLength)
{
setVector(witness_, witness, witnessLength);
}
- void setSignature(const std::vector<unsigned char> &signature) { signature_ = signature; }
+ void setSignature(const std::vector<unsigned char>& signature) { signature_ = signature; }
void setSignature(const unsigned char *signature, unsigned int signatureLength)
{
setVector(signature_, signature, signatureLength);
@@ -85,16 +85,16 @@
* WARNING: The resulting pointers in signedInfoStruct are invalid after a further use of this object which could reallocate memory.
* @param signedInfoStruct a C ndn_SignedInfo struct where the name components array is already allocated.
*/
- void get(struct ndn_SignedInfo &signedInfoStruct) const;
+ void get(struct ndn_SignedInfo& signedInfoStruct) const;
/**
* Clear this signed info, and set the values by copying from the ndn_SignedInfo struct.
* @param signedInfoStruct a C ndn_SignedInfo struct
*/
- void set(const struct ndn_SignedInfo &signedInfoStruct);
+ void set(const struct ndn_SignedInfo& signedInfoStruct);
- const PublisherPublicKeyDigest &getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- PublisherPublicKeyDigest &getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+ const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
double getTimestampMilliseconds() const { return timestampMilliseconds_; }
@@ -102,13 +102,13 @@
int getFreshnessSeconds() const { return freshnessSeconds_; }
- const std::vector<unsigned char> &getFinalBlockID() const { return finalBlockID_; }
- std::vector<unsigned char> &getFinalBlockID() { return finalBlockID_; }
+ const std::vector<unsigned char>& getFinalBlockID() const { return finalBlockID_; }
+ std::vector<unsigned char>& getFinalBlockID() { return finalBlockID_; }
- const KeyLocator &getKeyLocator() const { return keyLocator_; }
- KeyLocator &getKeyLocator() { return keyLocator_; }
+ const KeyLocator& getKeyLocator() const { return keyLocator_; }
+ KeyLocator& getKeyLocator() { return keyLocator_; }
- void setPublisherPublicKeyDigest(const PublisherPublicKeyDigest &publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
+ void setPublisherPublicKeyDigest(const PublisherPublicKeyDigest& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
void setTimestampMilliseconds(double timestampMilliseconds) { timestampMilliseconds_ = timestampMilliseconds; }
@@ -116,13 +116,13 @@
void setFreshnessSeconds(int freshnessSeconds) { freshnessSeconds_ = freshnessSeconds; }
- void setFinalBlockID(const std::vector<unsigned char> &finalBlockID) { finalBlockID_ = finalBlockID; }
+ void setFinalBlockID(const std::vector<unsigned char>& finalBlockID) { finalBlockID_ = finalBlockID; }
void setFinalBlockID(const unsigned char *finalBlockID, unsigned int finalBlockIdLength)
{
setVector(finalBlockID_, finalBlockID, finalBlockIdLength);
}
- void setKeyLocator(const KeyLocator &keyLocator) { keyLocator_ = keyLocator; }
+ void setKeyLocator(const KeyLocator& keyLocator) { keyLocator_ = keyLocator; }
private:
PublisherPublicKeyDigest publisherPublicKeyDigest_;
@@ -139,12 +139,12 @@
{
}
- Data(const Name &name)
+ Data(const Name& name)
: name_(name)
{
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat &wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat) const
{
return wireFormat.encodeData(*this);
}
@@ -152,7 +152,7 @@
{
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.decodeData(*this, input, inputLength);
}
@@ -160,11 +160,11 @@
{
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)
{
wireDecode(&input[0], input.size(), wireFormat);
}
- void wireDecode(const std::vector<unsigned char> &input)
+ void wireDecode(const std::vector<unsigned char>& input)
{
wireDecode(&input[0], input.size());
}
@@ -174,33 +174,33 @@
* WARNING: The resulting pointers in dataStruct are invalid after a further use of this object which could reallocate memory.
* @param dataStruct a C ndn_Data struct where the name components array is already allocated.
*/
- void get(struct ndn_Data &dataStruct) const;
+ void get(struct ndn_Data& dataStruct) const;
/**
* Clear this data object, and set the values by copying from the ndn_Data struct.
* @param dataStruct a C ndn_Data struct
*/
- void set(const struct ndn_Data &dataStruct);
+ void set(const struct ndn_Data& dataStruct);
- const Signature &getSignature() const { return signature_; }
- Signature &getSignature() { return signature_; }
+ const Signature& getSignature() const { return signature_; }
+ Signature& getSignature() { return signature_; }
- const Name &getName() const { return name_; }
- Name &getName() { return name_; }
+ const Name& getName() const { return name_; }
+ Name& getName() { return name_; }
- const SignedInfo &getSignedInfo() const { return signedInfo_; }
- SignedInfo &getSignedInfo() { return signedInfo_; }
+ const SignedInfo& getSignedInfo() const { return signedInfo_; }
+ SignedInfo& getSignedInfo() { return signedInfo_; }
- const std::vector<unsigned char> &getContent() const { return content_; }
- std::vector<unsigned char> &getContent() { return content_; }
+ const std::vector<unsigned char>& getContent() const { return content_; }
+ std::vector<unsigned char>& getContent() { return content_; }
- void setSignature(const Signature &signature) { signature_ = signature; }
+ void setSignature(const Signature& signature) { signature_ = signature; }
- void setName(const Name &name) { name_ = name; }
+ void setName(const Name& name) { name_ = name; }
- void setSignedInfo(const SignedInfo &signedInfo) { signedInfo_ = signedInfo; }
+ void setSignedInfo(const SignedInfo& signedInfo) { signedInfo_ = signedInfo; }
- void setContent(const std::vector<unsigned char> &content) { content_ = content; }
+ void setContent(const std::vector<unsigned char>& content) { content_ = content; }
void setContent(const unsigned char *content, unsigned int contentLength)
{
setVector(content_, content, contentLength);
diff --git a/ndn-cpp/encoding/binary-xml-encoder.hpp b/ndn-cpp/encoding/binary-xml-encoder.hpp
index cee590c..ad41a69 100644
--- a/ndn-cpp/encoding/binary-xml-encoder.hpp
+++ b/ndn-cpp/encoding/binary-xml-encoder.hpp
@@ -31,7 +31,7 @@
* Resize the output vector to the correct encoding length and return.
* @return The encoding as a shared_ptr. Assume that the caller now owns the vector.
*/
- const ptr_lib::shared_ptr<std::vector<unsigned char> > &getOutput()
+ const ptr_lib::shared_ptr<std::vector<unsigned char> >& getOutput()
{
output_.get()->resize(offset);
return output_.get();
diff --git a/ndn-cpp/encoding/binary-xml-wire-format.cpp b/ndn-cpp/encoding/binary-xml-wire-format.cpp
index b331e08..2bb2093 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)
+ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeInterest(const Interest& interest)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -42,7 +42,7 @@
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength)
+void BinaryXmlWireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_ExcludeEntry excludeEntries[100];
@@ -60,7 +60,7 @@
}
ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeData
- (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+ (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_NameComponent keyNameComponents[100];
@@ -79,7 +79,7 @@
}
void BinaryXmlWireFormat::decodeData
- (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+ (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
struct ndn_NameComponent nameComponents[100];
struct ndn_NameComponent keyNameComponents[100];
@@ -96,7 +96,7 @@
data.set(dataStruct);
}
-ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry &forwardingEntry)
+ptr_lib::shared_ptr<vector<unsigned char> > BinaryXmlWireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
struct ndn_NameComponent prefixNameComponents[100];
struct ndn_ForwardingEntry forwardingEntryStruct;
@@ -112,7 +112,7 @@
return encoder.getOutput();
}
-void BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry &forwardingEntry, const unsigned char *input, unsigned int inputLength)
+void BinaryXmlWireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
{
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 68be550..aca140d 100644
--- a/ndn-cpp/encoding/binary-xml-wire-format.hpp
+++ b/ndn-cpp/encoding/binary-xml-wire-format.hpp
@@ -21,7 +21,7 @@
* @param interest The Interest object to encode.
* @return A shared_ptr with the vector<unsigned char> containing the encoding.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest &interest);
+ virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest& interest);
/**
* Decode input as an interest in binary XML and set the fields of the interest object.
@@ -29,19 +29,19 @@
* @param input A pointer to the input buffer to decode.
* @param inputLength The number of bytes in input.
*/
- virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
+ virtual void decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
/**
* Encode data with binary XML and return the encoding.
* @param data The Data object to encode.
* @param signedFieldsBeginOffset Return the offset in the encoding of the beginning 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.
+ * 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.
+ * 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.
*/
virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData
- (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+ (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
/**
* Decode input as a data packet in binary XML and set the fields in the data object.
@@ -50,20 +50,20 @@
* @param inputLength The number of bytes in input.
* @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed.
* If you are not decoding in order to verify, you can call
- * decodeData(Data &data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
* @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed.
* If you are not decoding in order to verify, you can call
- * decodeData(Data &data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
*/
virtual void decodeData
- (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+ (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
/**
* 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.
*/
- virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeForwardingEntry(const ForwardingEntry &forwardingEntry);
+ virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry in binary XML and set the fields of the forwardingEntry object.
@@ -71,7 +71,7 @@
* @param input A pointer to the input buffer to decode.
* @param inputLength The number of bytes in input.
*/
- virtual void decodeForwardingEntry(ForwardingEntry &forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ virtual void decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
};
}
diff --git a/ndn-cpp/encoding/wire-format.cpp b/ndn-cpp/encoding/wire-format.cpp
index 036262d..e0a4fc0 100644
--- a/ndn-cpp/encoding/wire-format.cpp
+++ b/ndn-cpp/encoding/wire-format.cpp
@@ -26,31 +26,31 @@
return defaultWireFormat_;
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeInterest(const Interest &interest)
+ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeInterest(const Interest& interest)
{
throw logic_error("unimplemented");
}
-void WireFormat::decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength)
+void WireFormat::decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeData
- (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+ (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
throw logic_error("unimplemented");
}
void WireFormat::decodeData
- (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
+ (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset)
{
throw logic_error("unimplemented");
}
-ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeForwardingEntry(const ForwardingEntry &forwardingEntry)
+ptr_lib::shared_ptr<vector<unsigned char> > WireFormat::encodeForwardingEntry(const ForwardingEntry& forwardingEntry)
{
throw logic_error("unimplemented");
}
-void WireFormat::decodeForwardingEntry(ForwardingEntry &forwardingEntry, const unsigned char *input, unsigned int inputLength)
+void WireFormat::decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/encoding/wire-format.hpp b/ndn-cpp/encoding/wire-format.hpp
index bfd1a1d..b0b2ea4 100644
--- a/ndn-cpp/encoding/wire-format.hpp
+++ b/ndn-cpp/encoding/wire-format.hpp
@@ -23,7 +23,7 @@
* @return A shared_ptr with the vector<unsigned char> 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 ptr_lib::shared_ptr<std::vector<unsigned char> > encodeInterest(const Interest& interest);
/**
* Decode input as an interest and set the fields of the interest object. Your derived class should override.
@@ -32,20 +32,20 @@
* @param inputLength The number of bytes in input.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual void decodeInterest(Interest &interest, const unsigned char *input, unsigned int inputLength);
+ virtual void decodeInterest(Interest& interest, const unsigned char *input, unsigned int inputLength);
/**
* Encode data and return the encoding. Your derived class should override.
* @param data The Data object to encode.
* @param signedFieldsBeginOffset Return the offset in the encoding of the beginning 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.
+ * 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.
+ * 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.
* @throw logic_error for unimplemented if the derived class does not override.
*/
virtual ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData
- (const Data &data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+ (const Data& data, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
/**
* Encode data and return the encoding.
@@ -53,7 +53,7 @@
* @return A shared_ptr with the vector<unsigned char> 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)
+ ptr_lib::shared_ptr<std::vector<unsigned char> > encodeData(const Data& data)
{
unsigned int dummyBeginOffset, dummyEndOffset;
return encodeData(data, &dummyBeginOffset, &dummyEndOffset);
@@ -66,16 +66,16 @@
* @param inputLength The number of bytes in input.
* @param signedFieldsBeginOffset Return the offset in the input buffer of the beginning of the fields which are signed.
* If you are not decoding in order to verify, you can call
- * decodeData(Data &data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
* @param signedFieldsEndOffset Return the offset in the input buffer of the end of the fields which are signed.
* If you are not decoding in order to verify, you can call
- * decodeData(Data &data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
+ * decodeData(Data& data, const unsigned char *input, unsigned int inputLength) to ignore this returned value.
* @throw logic_error for unimplemented if the derived class does not override.
*/
virtual void decodeData
- (Data &data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
+ (Data& data, const unsigned char *input, unsigned int inputLength, unsigned int *signedFieldsBeginOffset, unsigned int *signedFieldsEndOffset);
- void decodeData(Data &data, const unsigned char *input, unsigned int inputLength)
+ void decodeData(Data& data, const unsigned char *input, unsigned int inputLength)
{
unsigned int dummyBeginOffset, dummyEndOffset;
decodeData(data, input, inputLength, &dummyBeginOffset, &dummyEndOffset);
@@ -87,7 +87,7 @@
* @return A shared_ptr with the vector<unsigned char> 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 ptr_lib::shared_ptr<std::vector<unsigned char> > encodeForwardingEntry(const ForwardingEntry& forwardingEntry);
/**
* Decode input as a forwarding entry and set the fields of the forwardingEntry object. Your derived class should override.
@@ -96,7 +96,7 @@
* @param inputLength The number of bytes in input.
* @throw logic_error for unimplemented if the derived class does not override.
*/
- virtual void decodeForwardingEntry(ForwardingEntry &forwardingEntry, const unsigned char *input, unsigned int inputLength);
+ virtual void decodeForwardingEntry(ForwardingEntry& forwardingEntry, const unsigned char *input, unsigned int inputLength);
/**
* Set the static default WireFormat used by default encoding and decoding methods.
diff --git a/ndn-cpp/face.cpp b/ndn-cpp/face.cpp
index a2503fe..9b24dda 100644
--- a/ndn-cpp/face.cpp
+++ b/ndn-cpp/face.cpp
@@ -9,7 +9,7 @@
namespace ndn {
-void Face::expressInterest(const Name &name, const Interest *interestTemplate, const OnData &onData, const OnTimeout &onTimeout)
+void Face::expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout)
{
if (interestTemplate)
node_.expressInterest(Interest
diff --git a/ndn-cpp/face.hpp b/ndn-cpp/face.hpp
index 9dce469..550c30e 100644
--- a/ndn-cpp/face.hpp
+++ b/ndn-cpp/face.hpp
@@ -21,7 +21,7 @@
* @param transport A shared_ptr to a Transport object used for communication.
* @param transport A shared_ptr to a Transport::ConnectionInfo to be used to connect to the transport.
*/
- Face(const ptr_lib::shared_ptr<Transport> &transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo> &connectionInfo)
+ Face(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo)
: node_(transport, connectionInfo)
{
}
@@ -45,7 +45,7 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout = OnTimeout())
+ void expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
node_.expressInterest(interest, onData, onTimeout);
}
@@ -60,7 +60,7 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Name &name, const Interest *interestTemplate, const OnData &onData, const OnTimeout &onTimeout = OnTimeout());
+ void expressInterest(const Name& name, const Interest *interestTemplate, const OnData& onData, const OnTimeout& onTimeout = OnTimeout());
/**
* Encode name as an Interest, using a default interest lifetime.
@@ -71,7 +71,7 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Name &name, const OnData &onData, const OnTimeout &onTimeout = OnTimeout())
+ void expressInterest(const Name& name, const OnData& onData, const OnTimeout& onTimeout = OnTimeout())
{
expressInterest(name, 0, onData, onTimeout);
}
@@ -83,7 +83,7 @@
* use func_lib::ref() as appropriate.
* @param flags The flags for finer control of which interests are forward to the application.
*/
- void registerPrefix(const Name &prefix, const OnInterest &onInterest, int flags = 0)
+ void registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags = 0)
{
node_.registerPrefix(prefix, onInterest, flags);
}
diff --git a/ndn-cpp/forwarding-entry.cpp b/ndn-cpp/forwarding-entry.cpp
index 0e8c6d7..116a542 100644
--- a/ndn-cpp/forwarding-entry.cpp
+++ b/ndn-cpp/forwarding-entry.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-void ForwardingEntry::set(const struct ndn_ForwardingEntry &forwardingEntryStruct)
+void ForwardingEntry::set(const struct ndn_ForwardingEntry& forwardingEntryStruct)
{
if (forwardingEntryStruct.action && forwardingEntryStruct.actionLength > 0)
action_ = string(forwardingEntryStruct.action, forwardingEntryStruct.action + forwardingEntryStruct.actionLength);
@@ -24,7 +24,7 @@
freshnessSeconds_ = forwardingEntryStruct.freshnessSeconds;
}
-void ForwardingEntry::get(struct ndn_ForwardingEntry &forwardingEntryStruct) const
+void ForwardingEntry::get(struct ndn_ForwardingEntry& forwardingEntryStruct) const
{
prefix_.get(forwardingEntryStruct.prefix);
publisherPublicKeyDigest_.get(forwardingEntryStruct.publisherPublicKeyDigest);
diff --git a/ndn-cpp/forwarding-entry.hpp b/ndn-cpp/forwarding-entry.hpp
index 8c652a7..9919f49 100644
--- a/ndn-cpp/forwarding-entry.hpp
+++ b/ndn-cpp/forwarding-entry.hpp
@@ -19,7 +19,7 @@
class ForwardingEntry {
public:
ForwardingEntry
- (const std::string &action, const Name &prefix, const PublisherPublicKeyDigest publisherPublicKeyDigest,
+ (const std::string& action, const Name& prefix, const PublisherPublicKeyDigest publisherPublicKeyDigest,
int faceId, int forwardingFlags, int freshnessSeconds)
: action_(action), prefix_(prefix), publisherPublicKeyDigest_(publisherPublicKeyDigest),
faceId_(faceId), forwardingFlags_(forwardingFlags), freshnessSeconds_(freshnessSeconds)
@@ -31,7 +31,7 @@
{
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat &wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat) const
{
return wireFormat.encodeForwardingEntry(*this);
}
@@ -39,7 +39,7 @@
{
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.decodeForwardingEntry(*this, input, inputLength);
}
@@ -47,11 +47,11 @@
{
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)
{
wireDecode(&input[0], input.size(), wireFormat);
}
- void wireDecode(const std::vector<unsigned char> &input)
+ void wireDecode(const std::vector<unsigned char>& input)
{
wireDecode(&input[0], input.size());
}
@@ -61,15 +61,15 @@
* WARNING: The resulting pointers in forwardingEntryStruct are invalid after a further use of this object which could reallocate memory.
* @param forwardingEntryStruct a C ndn_ForwardingEntry struct where the prefix name components array is already allocated.
*/
- void get(struct ndn_ForwardingEntry &forwardingEntryStruct) const;
+ void get(struct ndn_ForwardingEntry& forwardingEntryStruct) const;
- const std::string &getAction() const { return action_; }
+ const std::string& getAction() const { return action_; }
- Name &getPrefix() { return prefix_; }
- const Name &getPrefix() const { return prefix_; }
+ Name& getPrefix() { return prefix_; }
+ const Name& getPrefix() const { return prefix_; }
- PublisherPublicKeyDigest &getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
- const PublisherPublicKeyDigest &getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+ const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
int getFaceId() const { return faceId_; }
@@ -81,9 +81,9 @@
* Clear this forwarding entry, and set the values by copying from forwardingEntryStruct.
* @param forwardingEntryStruct a C ndn_ForwardingEntry struct.
*/
- void set(const struct ndn_ForwardingEntry &forwardingEntryStruct);
+ void set(const struct ndn_ForwardingEntry& forwardingEntryStruct);
- void setAction(const std::string &value) { action_ = value; }
+ void setAction(const std::string& value) { action_ = value; }
void setFaceId(int value) { faceId_ = value; }
diff --git a/ndn-cpp/interest.cpp b/ndn-cpp/interest.cpp
index f84dd7a..39e3358 100644
--- a/ndn-cpp/interest.cpp
+++ b/ndn-cpp/interest.cpp
@@ -11,7 +11,7 @@
namespace ndn {
-void Exclude::get(struct ndn_Exclude &excludeStruct) const
+void Exclude::get(struct ndn_Exclude& excludeStruct) const
{
if (excludeStruct.maxEntries < entries_.size())
throw runtime_error("excludeStruct.maxEntries must be >= this exclude getEntryCount()");
@@ -21,7 +21,7 @@
entries_[i].get(excludeStruct.entries[i]);
}
-void Exclude::set(const struct ndn_Exclude &excludeStruct)
+void Exclude::set(const struct ndn_Exclude& excludeStruct)
{
entries_.clear();
for (unsigned int i = 0; i < excludeStruct.nEntries; ++i) {
@@ -55,7 +55,7 @@
return result.str();
}
-void Interest::set(const struct ndn_Interest &interestStruct)
+void Interest::set(const struct ndn_Interest& interestStruct)
{
name_.set(interestStruct.name);
minSuffixComponents_ = interestStruct.minSuffixComponents;
@@ -71,7 +71,7 @@
setVector(nonce_, interestStruct.nonce, interestStruct.nonceLength);
}
-void Interest::get(struct ndn_Interest &interestStruct) const
+void Interest::get(struct ndn_Interest& interestStruct) const
{
name_.get(interestStruct.name);
interestStruct.minSuffixComponents = minSuffixComponents_;
diff --git a/ndn-cpp/interest.hpp b/ndn-cpp/interest.hpp
index e4aeeb1..b3397af 100644
--- a/ndn-cpp/interest.hpp
+++ b/ndn-cpp/interest.hpp
@@ -38,7 +38,7 @@
* WARNING: The resulting pointer in excludeEntryStruct is invalid after a further use of this object which could reallocate memory.
* @param excludeEntryStruct the C ndn_NameComponent struct to receive the pointer
*/
- void get(struct ndn_ExcludeEntry &excludeEntryStruct) const
+ void get(struct ndn_ExcludeEntry& excludeEntryStruct) const
{
excludeEntryStruct.type = type_;
if (type_ == ndn_Exclude_COMPONENT)
@@ -47,7 +47,7 @@
ndn_ExcludeType getType() const { return type_; }
- const Name::Component &getComponent() const { return component_; }
+ const Name::Component& getComponent() const { return component_; }
private:
ndn_ExcludeType type_;
@@ -69,20 +69,20 @@
return entries_.size();
}
- const ExcludeEntry &getEntry(unsigned int i) const { return entries_[i]; }
+ const ExcludeEntry& getEntry(unsigned int i) const { return entries_[i]; }
/**
* Set the excludeStruct to point to the entries in this Exclude, without copying any memory.
* WARNING: The resulting pointers in excludeStruct are invalid after a further use of this object which could reallocate memory.
* @param excludeStruct a C ndn_Exclude struct where the entries array is already allocated
*/
- void get(struct ndn_Exclude &excludeStruct) const;
+ void get(struct ndn_Exclude& excludeStruct) const;
/**
* Clear this Exclude, and set the entries by copying from the ndn_Exclude struct.
* @param excludeStruct a C ndn_Exclude struct
*/
- void set(const struct ndn_Exclude &excludeStruct);
+ void set(const struct ndn_Exclude& excludeStruct);
/**
* Add a new entry of type ndn_Exclude_ANY
@@ -122,9 +122,9 @@
*/
class Interest {
public:
- Interest(const Name &name, int minSuffixComponents, int maxSuffixComponents,
- const PublisherPublicKeyDigest &publisherPublicKeyDigest, const Exclude &exclude, int childSelector, int answerOriginKind,
- int scope, double interestLifetimeMilliseconds, const std::vector<unsigned char> &nonce)
+ Interest(const Name& name, int minSuffixComponents, int maxSuffixComponents,
+ const PublisherPublicKeyDigest& publisherPublicKeyDigest, const Exclude& exclude, int childSelector, int answerOriginKind,
+ int scope, double interestLifetimeMilliseconds, const std::vector<unsigned char>& nonce)
: name_(name), minSuffixComponents_(minSuffixComponents), maxSuffixComponents_(maxSuffixComponents),
publisherPublicKeyDigest_(publisherPublicKeyDigest), exclude_(exclude), childSelector_(childSelector),
answerOriginKind_(answerOriginKind), scope_(scope), interestLifetimeMilliseconds_(interestLifetimeMilliseconds),
@@ -132,8 +132,8 @@
{
}
- Interest(const Name &name, int minSuffixComponents, int maxSuffixComponents,
- const PublisherPublicKeyDigest &publisherPublicKeyDigest, const Exclude &exclude, int childSelector, int answerOriginKind,
+ Interest(const Name& name, int minSuffixComponents, int maxSuffixComponents,
+ const PublisherPublicKeyDigest& publisherPublicKeyDigest, const Exclude& exclude, int childSelector, int answerOriginKind,
int scope, double interestLifetimeMilliseconds)
: name_(name), minSuffixComponents_(minSuffixComponents), maxSuffixComponents_(maxSuffixComponents),
publisherPublicKeyDigest_(publisherPublicKeyDigest), exclude_(exclude), childSelector_(childSelector),
@@ -141,14 +141,14 @@
{
}
- Interest(const Name &name, double interestLifetimeMilliseconds)
+ Interest(const Name& name, double interestLifetimeMilliseconds)
: name_(name)
{
construct();
interestLifetimeMilliseconds_ = interestLifetimeMilliseconds;
}
- Interest(const Name &name)
+ Interest(const Name& name)
: name_(name)
{
construct();
@@ -159,7 +159,7 @@
construct();
}
- ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat &wireFormat) const
+ ptr_lib::shared_ptr<std::vector<unsigned char> > wireEncode(WireFormat& wireFormat) const
{
return wireFormat.encodeInterest(*this);
}
@@ -167,7 +167,7 @@
{
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.decodeInterest(*this, input, inputLength);
}
@@ -175,11 +175,11 @@
{
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)
{
wireDecode(&input[0], input.size(), wireFormat);
}
- void wireDecode(const std::vector<unsigned char> &input)
+ void wireDecode(const std::vector<unsigned char>& input)
{
wireDecode(&input[0], input.size());
}
@@ -189,20 +189,20 @@
* WARNING: The resulting pointers in interestStruct are invalid after a further use of this object which could reallocate memory.
* @param interestStruct a C ndn_Interest struct where the name components array is already allocated.
*/
- void get(struct ndn_Interest &interestStruct) const;
+ void get(struct ndn_Interest& interestStruct) const;
- Name &getName() { return name_; }
- const Name &getName() const { return name_; }
+ Name& getName() { return name_; }
+ const Name& getName() const { return name_; }
int getMinSuffixComponents() const { return minSuffixComponents_; }
int getMaxSuffixComponents() const { return maxSuffixComponents_; }
- PublisherPublicKeyDigest &getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
- const PublisherPublicKeyDigest &getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ PublisherPublicKeyDigest& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+ const PublisherPublicKeyDigest& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- Exclude &getExclude() { return exclude_; }
- const Exclude &getExclude() const { return exclude_; }
+ Exclude& getExclude() { return exclude_; }
+ const Exclude& getExclude() const { return exclude_; }
int getChildSelector() const { return childSelector_; }
@@ -212,13 +212,13 @@
double getInterestLifetimeMilliseconds() const { return interestLifetimeMilliseconds_; }
- const std::vector<unsigned char> &getNonce() const { return nonce_; }
+ const std::vector<unsigned char>& getNonce() const { return nonce_; }
/**
* Clear this interest, and set the values by copying from the interest struct.
* @param interestStruct a C ndn_Interest struct
*/
- void set(const struct ndn_Interest &interestStruct);
+ void set(const struct ndn_Interest& interestStruct);
void setMinSuffixComponents(int value) { minSuffixComponents_ = value; }
@@ -232,7 +232,7 @@
void setInterestLifetimeMilliseconds(double value) { interestLifetimeMilliseconds_ = value; }
- void setNonce(const std::vector<unsigned char> &value) { nonce_ = value; }
+ void setNonce(const std::vector<unsigned char>& value) { nonce_ = value; }
private:
void construct()
diff --git a/ndn-cpp/key.cpp b/ndn-cpp/key.cpp
index 7548968..6cdae60 100644
--- a/ndn-cpp/key.cpp
+++ b/ndn-cpp/key.cpp
@@ -10,7 +10,7 @@
namespace ndn {
-void KeyLocator::get(struct ndn_KeyLocator &keyLocatorStruct) const
+void KeyLocator::get(struct ndn_KeyLocator& keyLocatorStruct) const
{
keyLocatorStruct.type = type_;
@@ -24,7 +24,7 @@
keyLocatorStruct.keyNameType = keyNameType_;
}
-void KeyLocator::set(const struct ndn_KeyLocator &keyLocatorStruct)
+void KeyLocator::set(const struct ndn_KeyLocator& keyLocatorStruct)
{
type_ = keyLocatorStruct.type;
setVector(keyData_, keyLocatorStruct.keyData, keyLocatorStruct.keyDataLength);
diff --git a/ndn-cpp/key.hpp b/ndn-cpp/key.hpp
index 6fa2f05..a3784f6 100644
--- a/ndn-cpp/key.hpp
+++ b/ndn-cpp/key.hpp
@@ -24,26 +24,26 @@
* WARNING: The resulting pointers in keyLocatorStruct are invalid after a further use of this object which could reallocate memory.
* @param keyLocatorStruct a C ndn_KeyLocator struct where the name components array is already allocated.
*/
- void get(struct ndn_KeyLocator &keyLocatorStruct) const;
+ void get(struct ndn_KeyLocator& keyLocatorStruct) const;
/**
* Clear this key locator, and set the values by copying from the ndn_KeyLocator struct.
* @param keyLocatorStruct a C ndn_KeyLocator struct
*/
- void set(const struct ndn_KeyLocator &keyLocatorStruct);
+ void set(const struct ndn_KeyLocator& keyLocatorStruct);
ndn_KeyLocatorType getType() const { return type_; }
- const std::vector<unsigned char> &getKeyData() const { return keyData_; }
+ const std::vector<unsigned char>& getKeyData() const { return keyData_; }
- const Name &getKeyName() const { return keyName_; }
- Name &getKeyName() { return keyName_; }
+ const Name& getKeyName() const { return keyName_; }
+ Name& getKeyName() { return keyName_; }
ndn_KeyNameType getKeyNameType() const { return keyNameType_; }
void setType(ndn_KeyLocatorType type) { type_ = type; }
- void setKeyData(const std::vector<unsigned char> &keyData) { keyData_ = keyData; }
+ void setKeyData(const std::vector<unsigned char>& keyData) { keyData_ = keyData; }
void setKeyData(const unsigned char *keyData, unsigned int keyDataLength)
{
setVector(keyData_, keyData, keyDataLength);
@@ -52,12 +52,12 @@
/**
* @deprecated Use getKeyData().
*/
- const std::vector<unsigned char> &getKeyOrCertificate() const { return getKeyData(); }
+ const std::vector<unsigned char>& getKeyOrCertificate() const { return getKeyData(); }
/**
* @deprecated Use setKeyData.
*/
- void setKeyOrCertificate(const std::vector<unsigned char> &keyData) { setKeyData(keyData); }
+ void setKeyOrCertificate(const std::vector<unsigned char>& keyData) { setKeyData(keyData); }
/**
* @deprecated Use setKeyData.
diff --git a/ndn-cpp/name.cpp b/ndn-cpp/name.cpp
index bb2b144..488fcd5 100644
--- a/ndn-cpp/name.cpp
+++ b/ndn-cpp/name.cpp
@@ -17,7 +17,7 @@
* Modify str in place to erase whitespace on the left.
* @param str
*/
-static inline void trimLeft(string &str)
+static inline void trimLeft(string& str)
{
size_t found = str.find_first_not_of(WHITESPACE_CHARS);
if (found != string::npos) {
@@ -33,7 +33,7 @@
* Modify str in place to erase whitespace on the right.
* @param str
*/
-static inline void trimRight(string &str)
+static inline void trimRight(string& str)
{
size_t found = str.find_last_not_of(WHITESPACE_CHARS);
if (found != string::npos) {
@@ -49,7 +49,7 @@
* Modify str in place to erase whitespace on the left and right.
* @param str
*/
-static void trim(string &str)
+static void trim(string& str)
{
trimLeft(str);
trimRight(str);
@@ -76,7 +76,7 @@
* Return a copy of str, converting each escaped "%XX" to the char value.
* @param str
*/
-static string unescape(const string &str)
+static string unescape(const string& str)
{
ostringstream result;
@@ -200,7 +200,7 @@
}
}
-void Name::get(struct ndn_Name &nameStruct) const
+void Name::get(struct ndn_Name& nameStruct) const
{
if (nameStruct.maxComponents < components_.size())
throw runtime_error("nameStruct.maxComponents must be >= this name getNComponents()");
@@ -210,7 +210,7 @@
components_[i].get(nameStruct.components[i]);
}
-void Name::set(const struct ndn_Name &nameStruct)
+void Name::set(const struct ndn_Name& nameStruct)
{
clear();
for (unsigned int i = 0; i < nameStruct.nComponents; ++i)
@@ -231,7 +231,7 @@
return result.str();
}
-bool Name::match(const Name &name) const
+bool Name::match(const Name& name) const
{
// Imitate ndn_Name_match.
@@ -252,7 +252,7 @@
return true;
}
-void Name::toEscapedString(const vector<unsigned char> &value, ostringstream &result)
+void Name::toEscapedString(const vector<unsigned char>& value, ostringstream& result)
{
bool gotNonDot = false;
for (unsigned i = 0; i < value.size(); ++i) {
diff --git a/ndn-cpp/name.hpp b/ndn-cpp/name.hpp
index dc59f06..f43a924 100644
--- a/ndn-cpp/name.hpp
+++ b/ndn-cpp/name.hpp
@@ -29,7 +29,7 @@
* Create a new Name::Component, copying the given value.
* @param value The value byte array.
*/
- Component(const std::vector<unsigned char> &value)
+ Component(const std::vector<unsigned char>& value)
: value_(value)
{
}
@@ -49,7 +49,7 @@
* WARNING: The resulting pointer in componentStruct is invalid after a further use of this object which could reallocate memory.
* @param componentStruct The C ndn_NameComponent struct to receive the pointer.
*/
- void get(struct ndn_NameComponent &componentStruct) const
+ void get(struct ndn_NameComponent& componentStruct) const
{
componentStruct.valueLength = value_.size();
if (value_.size() > 0)
@@ -66,7 +66,7 @@
*/
bool setFromEscapedString(const char *first, const char *last);
- const std::vector<unsigned char> &getValue() const { return value_; }
+ const std::vector<unsigned char>& getValue() const { return value_; }
/**
* Set this component to the encoded segment number.
@@ -88,7 +88,7 @@
* Create a new Name, copying the name components.
* @param components A vector of Component
*/
- Name(const std::vector<Component> &components)
+ Name(const std::vector<Component>& components)
: components_(components)
{
}
@@ -107,13 +107,13 @@
* WARNING: The resulting pointers in nameStruct are invalid after a further use of this object which could reallocate memory.
* @param nameStruct A C ndn_Name struct where the components array is already allocated.
*/
- void get(struct ndn_Name &nameStruct) const;
+ void get(struct ndn_Name& nameStruct) const;
/**
* Clear this name, and set the components by copying from the name struct.
* @param nameStruct A C ndn_Name struct
*/
- void set(const struct ndn_Name &nameStruct);
+ void set(const struct ndn_Name& nameStruct);
/**
* Parse the uri according to the NDN URI Scheme and set the name with the components.
@@ -131,7 +131,7 @@
/**
* Add a new component, copying from value.
*/
- void addComponent(const std::vector<unsigned char> &value) {
+ void addComponent(const std::vector<unsigned char>& value) {
components_.push_back(value);
}
@@ -150,7 +150,7 @@
return components_.size();
}
- const Component &getComponent(unsigned int i) const { return components_[i]; }
+ const Component& getComponent(unsigned int i) const { return components_[i]; }
/**
* Encode this name as a URI.
@@ -181,7 +181,7 @@
* @param name The Name to check.
* @return true if this matches the given name, otherwise false. This always returns true if this name is empty.
*/
- bool match(const Name &name) const;
+ bool match(const Name& name) const;
/**
* Write the value to result, escaping characters according to the NDN URI Scheme.
@@ -189,7 +189,7 @@
* @param value the buffer with the value to escape
* @param result the string stream to write to.
*/
- static void toEscapedString(const std::vector<unsigned char> &value, std::ostringstream &result);
+ static void toEscapedString(const std::vector<unsigned char>& value, std::ostringstream& result);
private:
std::vector<Component> components_;
diff --git a/ndn-cpp/node.cpp b/ndn-cpp/node.cpp
index 996fb64..1107a11 100644
--- a/ndn-cpp/node.cpp
+++ b/ndn-cpp/node.cpp
@@ -23,13 +23,13 @@
return t.tv_sec * 1000.0 + t.tv_usec / 1000.0;
}
-Node::Node(const ptr_lib::shared_ptr<Transport> &transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo> &connectionInfo)
+Node::Node(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo)
: transport_(transport), connectionInfo_(connectionInfo),
ndndIdFetcherInterest_(Name("/%C1.M.S.localhost/%C1.M.SRV/ndnd/KEY"), 4000.0)
{
}
-void Node::expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout)
+void Node::expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout)
{
// TODO: Properly check if we are already connected to the expected host.
if (!transport_->getIsConnected())
@@ -41,7 +41,7 @@
transport_->send(*encoding);
}
-void Node::registerPrefix(const Name &prefix, const OnInterest &onInterest, int flags)
+void Node::registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags)
{
if (ndndId_.size() == 0) {
// First fetch the ndndId of the connected hub.
@@ -53,7 +53,7 @@
registerPrefixHelper(prefix, onInterest, flags);
}
-void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest> &interest, const ptr_lib::shared_ptr<Data> &ndndIdData)
+void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData)
{
if (ndndIdData->getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest().size() > 0) {
// Set the ndndId_ and continue.
@@ -64,12 +64,12 @@
// TODO: else need to log not getting the ndndId.
}
-void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest> &timedOutInterest)
+void Node::NdndIdFetcher::operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest)
{
// TODO: Log the timeout.
}
-void Node::registerPrefixHelper(const Name &prefix, const OnInterest &onInterest, int flags)
+void Node::registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags)
{
// Create a ForwardingEntry.
ForwardingEntry forwardingEntry("selfreg", prefix, PublisherPublicKeyDigest(), -1, 3, 2147483647);
@@ -150,7 +150,7 @@
transport_->close();
}
-int Node::getEntryIndexForExpressedInterest(const Name &name)
+int Node::getEntryIndexForExpressedInterest(const Name& name)
{
// TODO: Doesn't this belong in the Name class?
vector<struct ndn_NameComponent> nameComponents;
@@ -173,7 +173,7 @@
return iResult;
}
-Node::PrefixEntry *Node::getEntryForRegisteredPrefix(const Name &name)
+Node::PrefixEntry *Node::getEntryForRegisteredPrefix(const Name& name)
{
int iResult = -1;
@@ -192,7 +192,7 @@
return 0;
}
-Node::PitEntry::PitEntry(const ptr_lib::shared_ptr<const Interest> &interest, const OnData &onData, const OnTimeout &onTimeout)
+Node::PitEntry::PitEntry(const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout)
: interest_(interest), onData_(onData), onTimeout_(onTimeout)
{
// Set up timeoutTime_.
diff --git a/ndn-cpp/node.hpp b/ndn-cpp/node.hpp
index b82ba8a..9efb742 100644
--- a/ndn-cpp/node.hpp
+++ b/ndn-cpp/node.hpp
@@ -17,18 +17,18 @@
/**
* An OnData function object is used to pass a callback to expressInterest.
*/
-typedef func_lib::function<void(const ptr_lib::shared_ptr<const Interest> &, const ptr_lib::shared_ptr<Data> &)> OnData;
+typedef func_lib::function<void(const ptr_lib::shared_ptr<const Interest>& , const ptr_lib::shared_ptr<Data>& )> OnData;
/**
* An OnTimeout function object is used to pass a callback to expressInterest.
*/
-typedef func_lib::function<void(const ptr_lib::shared_ptr<const Interest> &)> OnTimeout;
+typedef func_lib::function<void(const ptr_lib::shared_ptr<const Interest>& )> OnTimeout;
/**
* An OnInterest function object is used to pass a callback to registerPrefix.
*/
typedef func_lib::function<void
- (const ptr_lib::shared_ptr<const Name> &, const ptr_lib::shared_ptr<const Interest> &, Transport &)> OnInterest;
+ (const ptr_lib::shared_ptr<const Name>& , const ptr_lib::shared_ptr<const Interest>& , Transport& )> OnInterest;
class Face;
@@ -39,7 +39,7 @@
* @param transport A shared_ptr to a Transport object used for communication.
* @param transport A shared_ptr to a Transport::ConnectionInfo to be used to connect to the transport.
*/
- Node(const ptr_lib::shared_ptr<Transport> &transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo> &connectionInfo);
+ Node(const ptr_lib::shared_ptr<Transport>& transport, const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& connectionInfo);
/**
* Send the Interest through the transport, read the entire response and call onData(interest, data).
@@ -49,7 +49,7 @@
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
* This copies the function object, so you may need to use func_lib::ref() as appropriate.
*/
- void expressInterest(const Interest &interest, const OnData &onData, const OnTimeout &onTimeout);
+ void expressInterest(const Interest& interest, const OnData& onData, const OnTimeout& onTimeout);
/**
* Register prefix with the connected NDN hub and call onInterest when a matching interest is received.
@@ -58,7 +58,7 @@
* use func_lib::ref() as appropriate.
* @param flags The flags for finer control of which interests are forward to the application.
*/
- void registerPrefix(const Name &prefix, const OnInterest &onInterest, int flags);
+ void registerPrefix(const Name& prefix, const OnInterest& onInterest, int flags);
/**
* Process any data to receive. For each element received, call onReceivedElement.
@@ -69,9 +69,9 @@
*/
void processEvents();
- const ptr_lib::shared_ptr<Transport> &getTransport() { return transport_; }
+ const ptr_lib::shared_ptr<Transport>& getTransport() { return transport_; }
- const ptr_lib::shared_ptr<const Transport::ConnectionInfo> &getConnectionInfo() { return connectionInfo_; }
+ const ptr_lib::shared_ptr<const Transport::ConnectionInfo>& getConnectionInfo() { return connectionInfo_; }
void onReceivedElement(const unsigned char *element, unsigned int elementLength);
@@ -86,11 +86,11 @@
* @param onData A function object to call when a matching data packet is received.
* @param onTimeout A function object to call if the interest times out. If onTimeout is an empty OnTimeout(), this does not use it.
*/
- PitEntry(const ptr_lib::shared_ptr<const Interest> &interest, const OnData &onData, const OnTimeout &onTimeout);
+ PitEntry(const ptr_lib::shared_ptr<const Interest>& interest, const OnData& onData, const OnTimeout& onTimeout);
- const ptr_lib::shared_ptr<const Interest> &getInterest() { return interest_; }
+ const ptr_lib::shared_ptr<const Interest>& getInterest() { return interest_; }
- const OnData &getOnData() { return onData_; }
+ const OnData& getOnData() { return onData_; }
/**
* Get the struct ndn_Interest for the interest_.
@@ -100,7 +100,7 @@
* @return A reference to the ndn_Interest struct.
* WARNING: The resulting pointers in are invalid uses getInterest() to manipulate the object which could reallocate memory.
*/
- const struct ndn_Interest &getInterestStruct()
+ const struct ndn_Interest& getInterestStruct()
{
return interestStruct_;
}
@@ -131,14 +131,14 @@
* @param prefix A shared_ptr for the prefix.
* @param onInterest A function object to call when a matching data packet is received.
*/
- PrefixEntry(const ptr_lib::shared_ptr<const Name> &prefix, const OnInterest &onInterest)
+ PrefixEntry(const ptr_lib::shared_ptr<const Name>& prefix, const OnInterest& onInterest)
: prefix_(prefix), onInterest_(onInterest)
{
}
- const ptr_lib::shared_ptr<const Name> &getPrefix() { return prefix_; }
+ const ptr_lib::shared_ptr<const Name>& getPrefix() { return prefix_; }
- const OnInterest &getOnInterest() { return onInterest_; }
+ const OnInterest& getOnInterest() { return onInterest_; }
private:
ptr_lib::shared_ptr<const Name> prefix_;
@@ -162,22 +162,22 @@
* @param interest
* @param data
*/
- void operator()(const ptr_lib::shared_ptr<const Interest> &interest, const ptr_lib::shared_ptr<Data> &ndndIdData);
+ void operator()(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& ndndIdData);
/**
* We timed out fetching the ndnd ID.
* @param interest
*/
- void operator()(const ptr_lib::shared_ptr<const Interest> &timedOutInterest);
+ void operator()(const ptr_lib::shared_ptr<const Interest>& timedOutInterest);
class Info {
public:
- Info(Node *node, const Name &prefix, const OnInterest &onInterest, int flags)
+ Info(Node *node, const Name& prefix, const OnInterest& onInterest, int flags)
: node_(*node), prefix_(prefix), onInterest_(onInterest), flags_(flags)
{
}
- Node &node_;
+ Node& node_;
Name prefix_;
const OnInterest onInterest_;
int flags_;
@@ -193,14 +193,14 @@
* @param name The name to find the interest for (from the incoming data packet).
* @return The index in pit_ of the pit entry, or -1 if not found.
*/
- int getEntryIndexForExpressedInterest(const Name &name);
+ int getEntryIndexForExpressedInterest(const Name& name);
/**
* Find the first entry from the registeredPrefixTable_ where the entry prefix is the longest that matches name.
* @param name The name to find the PrefixEntry for (from the incoming interest packet).
* @return A pointer to the entry, or 0 if not found.
*/
- PrefixEntry *getEntryForRegisteredPrefix(const Name &name);
+ PrefixEntry *getEntryForRegisteredPrefix(const Name& name);
/**
* Do the work of registerPrefix once we know we are connected with an ndndId_.
@@ -208,7 +208,7 @@
* @param onInterest
* @param flags
*/
- void registerPrefixHelper(const Name &prefix, const OnInterest &onInterest, int flags);
+ void registerPrefixHelper(const Name& prefix, const OnInterest& onInterest, int flags);
ptr_lib::shared_ptr<Transport> transport_;
ptr_lib::shared_ptr<const Transport::ConnectionInfo> connectionInfo_;
diff --git a/ndn-cpp/publisher-public-key-digest.hpp b/ndn-cpp/publisher-public-key-digest.hpp
index 02009b9..3b8dd56 100644
--- a/ndn-cpp/publisher-public-key-digest.hpp
+++ b/ndn-cpp/publisher-public-key-digest.hpp
@@ -26,7 +26,7 @@
* WARNING: The resulting pointers in publisherPublicKeyDigestStruct are invalid after a further use of this object which could reallocate memory.
* @param publisherPublicKeyDigestStruct a C ndn_PublisherPublicKeyDigest struct to receive the pointer
*/
- void get(struct ndn_PublisherPublicKeyDigest &publisherPublicKeyDigestStruct) const
+ void get(struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct) const
{
publisherPublicKeyDigestStruct.publisherPublicKeyDigestLength = publisherPublicKeyDigest_.size();
if (publisherPublicKeyDigest_.size() > 0)
@@ -39,16 +39,16 @@
* Clear this PublisherPublicKeyDigest, and copy from the ndn_PublisherPublicKeyDigest struct.
* @param excludeStruct a C ndn_Exclude struct
*/
- void set(const struct ndn_PublisherPublicKeyDigest &publisherPublicKeyDigestStruct)
+ void set(const struct ndn_PublisherPublicKeyDigest& publisherPublicKeyDigestStruct)
{
setVector(publisherPublicKeyDigest_, publisherPublicKeyDigestStruct.publisherPublicKeyDigest,
publisherPublicKeyDigestStruct.publisherPublicKeyDigestLength);
}
- const std::vector<unsigned char> &getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
- std::vector<unsigned char> &getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
+ const std::vector<unsigned char>& getPublisherPublicKeyDigest() const { return publisherPublicKeyDigest_; }
+ std::vector<unsigned char>& getPublisherPublicKeyDigest() { return publisherPublicKeyDigest_; }
- void setPublisherPublicKeyDigest(const std::vector<unsigned char> &publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
+ void setPublisherPublicKeyDigest(const std::vector<unsigned char>& publisherPublicKeyDigest) { publisherPublicKeyDigest_ = publisherPublicKeyDigest; }
void setPublisherPublicKeyDigest(const unsigned char *publisherPublicKeyDigest, unsigned int publisherPublicKeyDigestLength)
{
setVector(publisherPublicKeyDigest_, publisherPublicKeyDigest, publisherPublicKeyDigestLength);
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 65d61bb..9ba15f0 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -65,7 +65,7 @@
* @param dataLength
* @param digest
*/
-void setSha256(const unsigned char *data, unsigned int dataLength, vector<unsigned char> &digest)
+void setSha256(const unsigned char *data, unsigned int dataLength, vector<unsigned char>& digest)
{
unsigned char digestBuffer[SHA256_DIGEST_LENGTH];
ndn_digestSha256(data, dataLength, digestBuffer);
@@ -77,7 +77,7 @@
* @param data The Data object with the fields to digest.
* @param digest A pointer to a buffer of size SHA256_DIGEST_LENGTH to receive the data.
*/
-static void digestDataFieldsSha256(const Data &data, WireFormat &wireFormat, unsigned char *digest)
+static void digestDataFieldsSha256(const Data& data, WireFormat& wireFormat, unsigned char *digest)
{
unsigned int signedFieldsBeginOffset, signedFieldsEndOffset;
ptr_lib::shared_ptr<vector<unsigned char> > encoding = wireFormat.encodeData(data, &signedFieldsBeginOffset, &signedFieldsEndOffset);
@@ -86,8 +86,8 @@
}
void KeyChain::sign
- (Data &data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
- const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat &wireFormat)
+ (Data& data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
+ const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat)
{
// Set the public key.
setSha256(publicKeyDer, publicKeyDerLength, data.getSignedInfo().getPublisherPublicKeyDigest().getPublisherPublicKeyDigest());
@@ -116,18 +116,18 @@
data.getSignature().setSignature(signature, signatureLength);
}
-void KeyChain::defaultSign(Data &data, WireFormat &wireFormat)
+void KeyChain::defaultSign(Data& data, WireFormat& wireFormat)
{
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)
+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)
+bool KeyChain::selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat)
{
// Decode the data packet and digest the data fields.
Data data;
diff --git a/ndn-cpp/security/key-chain.hpp b/ndn-cpp/security/key-chain.hpp
index 662e6a4..0d3873e 100644
--- a/ndn-cpp/security/key-chain.hpp
+++ b/ndn-cpp/security/key-chain.hpp
@@ -25,21 +25,21 @@
* @param wireFormat The WireFormat for calling encodeData.
*/
static void sign
- (Data &data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
- const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat &wireFormat);
+ (Data& data, const unsigned char *publicKeyDer, unsigned int publicKeyDerLength,
+ const unsigned char *privateKeyDer, unsigned int privateKeyDerLength, WireFormat& wireFormat);
/**
* Call sign with the default public and private keys.
* @param data
* @param wireFormat The WireFormat for calling encodeData.
*/
- static void defaultSign(Data &data, WireFormat &wireFormat);
+ static void defaultSign(Data& data, WireFormat& wireFormat);
/**
* Call sign with the default public and private keys. For wireFormat, use WireFormat::getDefaultWireFormat().
* @param data
*/
- static void defaultSign(Data &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
@@ -51,7 +51,7 @@
* @return true if the public key in the Data object verifies the object, false if not or if the Data object
* doesn't have a public key.
*/
- static bool selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat &wireFormat);
+ static bool selfVerifyData(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat);
static bool selfVerifyData(const unsigned char *input, unsigned int inputLength)
{
diff --git a/ndn-cpp/transport/tcp-transport.cpp b/ndn-cpp/transport/tcp-transport.cpp
index 7c55d04..8d6810b 100644
--- a/ndn-cpp/transport/tcp-transport.cpp
+++ b/ndn-cpp/transport/tcp-transport.cpp
@@ -16,9 +16,9 @@
{
}
-void TcpTransport::connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener)
+void TcpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
- const TcpTransport::ConnectionInfo &tcpConnectionInfo = dynamic_cast<const TcpTransport::ConnectionInfo &>(connectionInfo);
+ const TcpTransport::ConnectionInfo& tcpConnectionInfo = dynamic_cast<const TcpTransport::ConnectionInfo&>(connectionInfo);
ndn_Error error;
if ((error = ndn_TcpTransport_connect(&transport_, (char *)tcpConnectionInfo.getHost().c_str(), tcpConnectionInfo.getPort())))
diff --git a/ndn-cpp/transport/tcp-transport.hpp b/ndn-cpp/transport/tcp-transport.hpp
index b9c12bb..a13a1da 100644
--- a/ndn-cpp/transport/tcp-transport.hpp
+++ b/ndn-cpp/transport/tcp-transport.hpp
@@ -34,7 +34,7 @@
* Get the host given to the constructor.
* @return A string reference for the host.
*/
- const std::string &getHost() const { return host_; }
+ const std::string& getHost() const { return host_; }
/**
* Get the port given to the constructor.
@@ -61,7 +61,7 @@
* @param connectionInfo A reference to a TcpTransport::ConnectionInfo.
* @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
*/
- virtual void connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener);
+ virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
/**
* Set data to the host
diff --git a/ndn-cpp/transport/transport.cpp b/ndn-cpp/transport/transport.cpp
index 1636e4e..ad76dc2 100644
--- a/ndn-cpp/transport/transport.cpp
+++ b/ndn-cpp/transport/transport.cpp
@@ -14,7 +14,7 @@
{
}
-void Transport::connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener)
+void Transport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
throw logic_error("unimplemented");
}
diff --git a/ndn-cpp/transport/transport.hpp b/ndn-cpp/transport/transport.hpp
index b27039a..2e78b6e 100644
--- a/ndn-cpp/transport/transport.hpp
+++ b/ndn-cpp/transport/transport.hpp
@@ -27,7 +27,7 @@
* @param connectionInfo A reference to an object of a subclass of ConnectionInfo.
* @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
*/
- virtual void connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener);
+ virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
/**
* Set data to the host
@@ -36,7 +36,7 @@
*/
virtual void send(const unsigned char *data, unsigned int dataLength);
- void send(const std::vector<unsigned char> &data)
+ void send(const std::vector<unsigned char>& data)
{
send(&data[0], data.size());
}
diff --git a/ndn-cpp/transport/udp-transport.cpp b/ndn-cpp/transport/udp-transport.cpp
index e877a1f..2ac010a 100644
--- a/ndn-cpp/transport/udp-transport.cpp
+++ b/ndn-cpp/transport/udp-transport.cpp
@@ -16,9 +16,9 @@
{
}
-void UdpTransport::connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener)
+void UdpTransport::connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener)
{
- const UdpTransport::ConnectionInfo &udpConnectionInfo = dynamic_cast<const UdpTransport::ConnectionInfo &>(connectionInfo);
+ const UdpTransport::ConnectionInfo& udpConnectionInfo = dynamic_cast<const UdpTransport::ConnectionInfo&>(connectionInfo);
ndn_Error error;
if ((error = ndn_UdpTransport_connect(&transport_, (char *)udpConnectionInfo.getHost().c_str(), udpConnectionInfo.getPort())))
diff --git a/ndn-cpp/transport/udp-transport.hpp b/ndn-cpp/transport/udp-transport.hpp
index 3df6f93..3004088 100644
--- a/ndn-cpp/transport/udp-transport.hpp
+++ b/ndn-cpp/transport/udp-transport.hpp
@@ -34,7 +34,7 @@
* Get the host given to the constructor.
* @return A string reference for the host.
*/
- const std::string &getHost() const { return host_; }
+ const std::string& getHost() const { return host_; }
/**
* Get the port given to the constructor.
@@ -61,7 +61,7 @@
* @param connectionInfo A reference to a TcpTransport::ConnectionInfo.
* @param elementListener Not a shared_ptr because we assume that it will remain valid during the life of this object.
*/
- virtual void connect(const Transport::ConnectionInfo &connectionInfo, ElementListener &elementListener);
+ virtual void connect(const Transport::ConnectionInfo& connectionInfo, ElementListener& elementListener);
/**
* Set data to the host
diff --git a/ndn-cpp/util/dynamic-uchar-vector.hpp b/ndn-cpp/util/dynamic-uchar-vector.hpp
index b24229b..07294fc 100644
--- a/ndn-cpp/util/dynamic-uchar-vector.hpp
+++ b/ndn-cpp/util/dynamic-uchar-vector.hpp
@@ -28,7 +28,7 @@
* Get the shared_ptr to the allocated vector.
* @return The shared_ptr to the allocated vector.
*/
- const ptr_lib::shared_ptr<std::vector<unsigned char> > &get() { return vector_; }
+ const ptr_lib::shared_ptr<std::vector<unsigned char> >& get() { return vector_; }
private:
/**
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 0b4aa26..d550a16 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -59,7 +59,7 @@
1
};
-static void dumpData(const Data &data)
+static void dumpData(const Data& data)
{
cout << "name: " << data.getName().to_uri() << endl;
if (data.getContent().size() > 0) {
@@ -173,7 +173,7 @@
dumpData(freshData);
ptr_lib::shared_ptr<vector<unsigned char> > freshEncoding = freshData.wireEncode();
cout << "Freshly-signed Data signature verification: " << (KeyChain::selfVerifyData(&freshEncoding->front(), freshEncoding->size()) ? "VERIFIED" : "FAILED") << endl;
- } catch (exception &e) {
+ } catch (exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;
diff --git a/tests/test-encode-decode-forwarding-entry.cpp b/tests/test-encode-decode-forwarding-entry.cpp
index 89a7a80..dfa780e 100644
--- a/tests/test-encode-decode-forwarding-entry.cpp
+++ b/tests/test-encode-decode-forwarding-entry.cpp
@@ -57,12 +57,12 @@
1
};
-static inline string toString(const vector<unsigned char> &v)
+static inline string toString(const vector<unsigned char>& v)
{
return string(&v[0], &v[0] + v.size());
}
-static void dumpForwardingEntry(const ForwardingEntry &forwardingEntry)
+static void dumpForwardingEntry(const ForwardingEntry& forwardingEntry)
{
cout << "action: " << forwardingEntry.getAction() << endl;
cout << "prefix: " << forwardingEntry.getPrefix().to_uri() << endl;
@@ -89,7 +89,7 @@
* Show the interest name and scope, and expect the name to have 4 components where the last component is a data packet
* whose content is a forwarding entry.
*/
-static void dumpInterestWithForwardingEntry(const Interest &interest)
+static void dumpInterestWithForwardingEntry(const Interest& interest)
{
if (interest.getName().getComponentCount() != 4) {
cout << "Error: expected the interest name to have 4 components. Got: " << interest.getName().to_uri() << endl;
@@ -129,7 +129,7 @@
reDecodedInterest.wireDecode(*encoding);
cout << "Re-decoded Interest:" << endl;
dumpInterestWithForwardingEntry(reDecodedInterest);
- } catch (exception &e) {
+ } catch (exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;
diff --git a/tests/test-encode-decode-interest.cpp b/tests/test-encode-decode-interest.cpp
index 26d8269..ad638ce 100644
--- a/tests/test-encode-decode-interest.cpp
+++ b/tests/test-encode-decode-interest.cpp
@@ -30,7 +30,7 @@
1
};
-static void dumpInterest(const Interest &interest)
+static void dumpInterest(const Interest& interest)
{
cout << "name: " << interest.getName().to_uri() << endl;
cout << "minSuffixComponents: ";
@@ -86,7 +86,7 @@
reDecodedInterest.wireDecode(*encoding);
cout << "Re-decoded Interest:" << endl;
dumpInterest(reDecodedInterest);
- } catch (exception &e) {
+ } catch (exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index da02c81..3c55b31 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -24,7 +24,7 @@
callbackCount_ = 0;
}
- void onData(const ptr_lib::shared_ptr<const Interest> &interest, const ptr_lib::shared_ptr<Data> &data)
+ void onData(const ptr_lib::shared_ptr<const Interest>& interest, const ptr_lib::shared_ptr<Data>& data)
{
++callbackCount_;
cout << "Got data packet with name " << data->getName().to_uri() << endl;
@@ -33,7 +33,7 @@
cout << endl;
}
- void onTimeout(const ptr_lib::shared_ptr<const Interest> &interest)
+ void onTimeout(const ptr_lib::shared_ptr<const Interest>& interest)
{
++callbackCount_;
cout << "Time out for interest " << interest->getName().toUri() << endl;
@@ -69,7 +69,7 @@
// We need to sleep for a few milliseconds so we don't use 100% of the CPU.
usleep(10000);
}
- } catch (std::exception &e) {
+ } catch (std::exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;
diff --git a/tests/test-publish-async.cpp b/tests/test-publish-async.cpp
index 5358169..e28871c 100644
--- a/tests/test-publish-async.cpp
+++ b/tests/test-publish-async.cpp
@@ -23,7 +23,7 @@
}
void operator()
- (const ptr_lib::shared_ptr<const Name> &prefix, const ptr_lib::shared_ptr<const Interest> &interest, Transport &transport) {
+ (const ptr_lib::shared_ptr<const Name>& prefix, const ptr_lib::shared_ptr<const Interest>& interest, Transport& transport) {
++interestCount_;
// Make and sign a Data packet.
@@ -58,7 +58,7 @@
// We need to sleep for a few milliseconds so we don't use 100% of the CPU.
usleep(10000);
}
- } catch (std::exception &e) {
+ } catch (std::exception& e) {
cout << "exception: " << e.what() << endl;
}
return 0;