tests: Don't use namespace ptr_lib and qualify ptr_lib::shared_ptr explicitly in case the application also uses std::shared_ptr, etc.
diff --git a/tests/test-encode-decode-benchmark.cpp b/tests/test-encode-decode-benchmark.cpp
index 89beaf6..73a0e75 100644
--- a/tests/test-encode-decode-benchmark.cpp
+++ b/tests/test-encode-decode-benchmark.cpp
@@ -25,7 +25,6 @@
using namespace std;
using namespace ndn;
-using namespace ndn::ptr_lib;
static double
getNowSeconds()
@@ -141,11 +140,11 @@
Blob finalBlockId((uint8_t*)"\x00", 1);
// Initialize the KeyChain storage in case useCrypto is true.
- shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
- shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
+ ptr_lib::shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
+ ptr_lib::shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
KeyChain keyChain
- (make_shared<IdentityManager>(identityStorage, privateKeyStorage),
- make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
+ (ptr_lib::make_shared<IdentityManager>(identityStorage, privateKeyStorage),
+ ptr_lib::make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
Name keyName("/testname/DSK-123");
Name certificateName = keyName.getSubName(0, keyName.size() - 1).append("KEY").append
(keyName.get(keyName.size() - 1)).append("ID-CERT").append("0");
@@ -193,13 +192,13 @@
}
static void
-onVerified(const shared_ptr<Data>& data)
+onVerified(const ptr_lib::shared_ptr<Data>& data)
{
// Do nothing since we expect it to verify.
}
static void
-onVerifyFailed(const shared_ptr<Data>& data)
+onVerifyFailed(const ptr_lib::shared_ptr<Data>& data)
{
cout << "Signature verification: FAILED" << endl;
}
@@ -215,18 +214,18 @@
benchmarkDecodeDataSecondsCpp(int nIterations, bool useCrypto, const Blob& encoding)
{
// Initialize the KeyChain storage in case useCrypto is true.
- shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
- shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
+ ptr_lib::shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
+ ptr_lib::shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
KeyChain keyChain
- (make_shared<IdentityManager>(identityStorage, privateKeyStorage),
- make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
+ (ptr_lib::make_shared<IdentityManager>(identityStorage, privateKeyStorage),
+ ptr_lib::make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
Name keyName("/testname/DSK-123");
identityStorage->addKey(keyName, KEY_TYPE_RSA, Blob(DEFAULT_PUBLIC_KEY_DER, sizeof(DEFAULT_PUBLIC_KEY_DER)));
size_t nameSize = 0;
double start = getNowSeconds();
for (int i = 0; i < nIterations; ++i) {
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
data->wireDecode(*encoding);
if (useCrypto)
@@ -430,13 +429,13 @@
{
Blob encoding;
{
- int nIterations = useCrypto ? 20000 : 2000000;
+ int nIterations = useCrypto ? 20000 : 100;
double duration = benchmarkEncodeDataSecondsCpp(nIterations, useComplex, useCrypto, encoding);
cout << "Encode " << (useComplex ? "complex" : "simple ") << " data C++: Crypto? " << (useCrypto ? "yes" : "no ")
<< ", Duration sec, Hz: " << duration << ", " << (nIterations / duration) << endl;
}
{
- int nIterations = useCrypto ? 100000 : 500000;
+ int nIterations = useCrypto ? 100000 : 100;
double duration = benchmarkDecodeDataSecondsCpp(nIterations, useCrypto, encoding);
cout << "Decode " << (useComplex ? "complex" : "simple ") << " data C++: Crypto? " << (useCrypto ? "yes" : "no ")
<< ", Duration sec, Hz: " << duration << ", " << (nIterations / duration) << endl;
diff --git a/tests/test-encode-decode-data.cpp b/tests/test-encode-decode-data.cpp
index 5791a84..41fefcd 100644
--- a/tests/test-encode-decode-data.cpp
+++ b/tests/test-encode-decode-data.cpp
@@ -18,7 +18,6 @@
using namespace std;
using namespace ndn;
-using namespace ndn::ptr_lib;
using namespace ndn::func_lib;
#if NDN_CPP_HAVE_STD_FUNCTION
// In the std library, the placeholders are in a different namespace than boost.
@@ -208,12 +207,12 @@
}
}
-static void onVerified(const char *prefix, const shared_ptr<Data>& data)
+static void onVerified(const char *prefix, const ptr_lib::shared_ptr<Data>& data)
{
cout << prefix << " signature verification: VERIFIED" << endl;
}
-static void onVerifyFailed(const char *prefix, const shared_ptr<Data>& data)
+static void onVerifyFailed(const char *prefix, const ptr_lib::shared_ptr<Data>& data)
{
cout << prefix << " signature verification: FAILED" << endl;
}
@@ -221,28 +220,28 @@
int main(int argc, char** argv)
{
try {
- shared_ptr<Data> data(new Data());
+ ptr_lib::shared_ptr<Data> data(new Data());
data->wireDecode(Data1, sizeof(Data1));
cout << "Decoded Data:" << endl;
dumpData(*data);
Blob encoding = data->wireEncode();
- shared_ptr<Data> reDecodedData(new Data());
+ ptr_lib::shared_ptr<Data> reDecodedData(new Data());
reDecodedData->wireDecode(*encoding);
cout << endl << "Re-decoded Data:" << endl;
dumpData(*reDecodedData);
- shared_ptr<Data> freshData(new Data(Name("/ndn/abc")));
+ ptr_lib::shared_ptr<Data> freshData(new Data(Name("/ndn/abc")));
const uint8_t freshContent[] = "SUCCESS!";
freshData->setContent(freshContent, sizeof(freshContent) - 1);
freshData->getMetaInfo().setTimestampMilliseconds(time(NULL) * 1000.0);
- shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
- shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
+ ptr_lib::shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
+ ptr_lib::shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
KeyChain keyChain
- (make_shared<IdentityManager>(identityStorage, privateKeyStorage),
- make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
+ (ptr_lib::make_shared<IdentityManager>(identityStorage, privateKeyStorage),
+ ptr_lib::make_shared<SelfVerifyPolicyManager>(identityStorage.get()));
// Initialize the storage.
Name keyName("/testname/DSK-123");
diff --git a/tests/test-get-async.cpp b/tests/test-get-async.cpp
index 46e9920..67a0348 100644
--- a/tests/test-get-async.cpp
+++ b/tests/test-get-async.cpp
@@ -12,7 +12,6 @@
using namespace std;
using namespace ndn;
-using namespace ndn::ptr_lib;
using namespace ndn::func_lib;
#if NDN_CPP_HAVE_STD_FUNCTION
// In the std library, the placeholders are in a different namespace than boost.
@@ -26,7 +25,7 @@
callbackCount_ = 0;
}
- void onData(const shared_ptr<const Interest>& interest, const 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;
@@ -35,7 +34,7 @@
cout << endl;
}
- void onTimeout(const 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;
diff --git a/tests/test-publish-async.cpp b/tests/test-publish-async.cpp
index 6e2c731..bdea5b0 100644
--- a/tests/test-publish-async.cpp
+++ b/tests/test-publish-async.cpp
@@ -17,7 +17,6 @@
using namespace std;
using namespace ndn;
-using namespace ndn::ptr_lib;
using namespace ndn::func_lib;
static uint8_t DEFAULT_PUBLIC_KEY_DER[] = {
@@ -75,7 +74,7 @@
// onInterest.
void operator()
- (const shared_ptr<const Name>& prefix, const 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,
uint64_t registeredPrefixId)
{
++responseCount_;
@@ -93,7 +92,7 @@
}
// onRegisterFailed.
- void operator()(const shared_ptr<const Name>& prefix)
+ void operator()(const ptr_lib::shared_ptr<const Name>& prefix)
{
++responseCount_;
cout << "Register failed for prefix " << prefix->toUri() << endl;
@@ -109,10 +108,10 @@
try {
Face face("localhost");
- shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
- shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
+ ptr_lib::shared_ptr<MemoryIdentityStorage> identityStorage(new MemoryIdentityStorage());
+ ptr_lib::shared_ptr<MemoryPrivateKeyStorage> privateKeyStorage(new MemoryPrivateKeyStorage());
KeyChain keyChain
- (make_shared<IdentityManager>(identityStorage, privateKeyStorage), make_shared<NoVerifyPolicyManager>());
+ (ptr_lib::make_shared<IdentityManager>(identityStorage, privateKeyStorage), ptr_lib::shared_ptr<NoVerifyPolicyManager>(new NoVerifyPolicyManager()));
keyChain.setFace(&face);
// Initialize the storage.