build: use C++11
Change-Id: I0e58ac4e9cb42d07a9b58125d761875f91c7744c
Refs: #1930
diff --git a/tools/ndngetfile.cpp b/tools/ndngetfile.cpp
index 50f8ab3..db1b22b 100644
--- a/tools/ndngetfile.cpp
+++ b/tools/ndngetfile.cpp
@@ -23,7 +23,14 @@
namespace repo {
-using namespace ndn;
+using ndn::Name;
+using ndn::Interest;
+using ndn::Data;
+using ndn::Block;
+
+using std::bind;
+using std::placeholders::_1;
+using std::placeholders::_2;
static const int MAX_RETRY = 3;
@@ -45,9 +52,9 @@
m_face.expressInterest(interest,
m_hasVersion ?
- bind(&Consumer::onVersionedData, this, _1, _2)
- :
- bind(&Consumer::onUnversionedData, this, _1, _2),
+ bind(&Consumer::onVersionedData, this, _1, _2)
+ :
+ bind(&Consumer::onUnversionedData, this, _1, _2),
bind(&Consumer::onTimeout, this, _1));
}
@@ -161,7 +168,7 @@
{
uint64_t segment = name[-1].toSegment();
BOOST_ASSERT(segment == (m_nextSegment - 1));
- const name::Component& finalBlockId = data.getMetaInfo().getFinalBlockId();
+ const ndn::name::Component& finalBlockId = data.getMetaInfo().getFinalBlockId();
if (finalBlockId == name[-1]) {
m_isFinished = true;
}
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index ffe5519..9d20a63 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -38,6 +38,12 @@
using namespace ndn::time;
+using std::shared_ptr;
+using std::make_shared;
+using std::bind;
+using std::placeholders::_1;
+using std::placeholders::_2;
+
static const uint64_t DEFAULT_BLOCK_SIZE = 1000;
static const uint64_t DEFAULT_INTEREST_LIFETIME = 4000;
static const uint64_t DEFAULT_FRESHNESS_PERIOD = 10000;
@@ -151,7 +157,7 @@
bool m_isFinished;
ndn::Name m_dataPrefix;
- typedef std::map<uint64_t, ndn::shared_ptr<ndn::Data> > DataContainer;
+ typedef std::map<uint64_t, shared_ptr<ndn::Data> > DataContainer;
DataContainer m_data;
};
@@ -185,8 +191,8 @@
throw Error("Error reading from the input stream");
}
- ndn::shared_ptr<ndn::Data> data =
- ndn::make_shared<ndn::Data>(Name(m_dataPrefix)
+ shared_ptr<ndn::Data> data =
+ make_shared<ndn::Data>(Name(m_dataPrefix)
.appendSegment(m_currentSegmentNo));
if (insertStream->peek() == std::istream::traits_type::eof()) {
@@ -215,15 +221,15 @@
std::cerr << "setInterestFilter for " << m_dataPrefix << std::endl;
m_face.setInterestFilter(m_dataPrefix,
isSingle ?
- ndn::bind(&NdnPutFile::onSingleInterest, this, _1, _2)
- :
- ndn::bind(&NdnPutFile::onInterest, this, _1, _2),
- ndn::bind(&NdnPutFile::onRegisterSuccess, this, _1),
- ndn::bind(&NdnPutFile::onRegisterFailed, this, _1, _2));
+ bind(&NdnPutFile::onSingleInterest, this, _1, _2)
+ :
+ bind(&NdnPutFile::onInterest, this, _1, _2),
+ bind(&NdnPutFile::onRegisterSuccess, this, _1),
+ bind(&NdnPutFile::onRegisterFailed, this, _1, _2));
if (hasTimeout)
- m_scheduler.scheduleEvent(timeout, ndn::bind(&NdnPutFile::stopProcess, this));
+ m_scheduler.scheduleEvent(timeout, bind(&NdnPutFile::stopProcess, this));
m_face.processEvents();
}
@@ -245,8 +251,8 @@
ndn::Interest commandInterest = generateCommandInterest(repoPrefix, "insert", parameters);
m_face.expressInterest(commandInterest,
- ndn::bind(&NdnPutFile::onInsertCommandResponse, this, _1, _2),
- ndn::bind(&NdnPutFile::onInsertCommandTimeout, this, _1));
+ bind(&NdnPutFile::onInsertCommandResponse, this, _1, _2),
+ bind(&NdnPutFile::onInsertCommandTimeout, this, _1));
}
void
@@ -261,7 +267,7 @@
m_processId = response.getProcessId();
m_scheduler.scheduleEvent(m_checkPeriod,
- ndn::bind(&NdnPutFile::startCheckCommand, this));
+ bind(&NdnPutFile::startCheckCommand, this));
}
void
@@ -336,7 +342,7 @@
throw Error("Input data does not fit into one Data packet");
}
- ndn::shared_ptr<ndn::Data> data = ndn::make_shared<ndn::Data>(m_dataPrefix);
+ shared_ptr<ndn::Data> data = make_shared<ndn::Data>(m_dataPrefix);
data->setContent(buffer, readSize);
data->setFreshnessPeriod(freshnessPeriod);
signData(*data);
@@ -381,8 +387,8 @@
RepoCommandParameter()
.setProcessId(m_processId));
m_face.expressInterest(checkInterest,
- ndn::bind(&NdnPutFile::onCheckCommandResponse, this, _1, _2),
- ndn::bind(&NdnPutFile::onCheckCommandTimeout, this, _1));
+ bind(&NdnPutFile::onCheckCommandResponse, this, _1, _2),
+ bind(&NdnPutFile::onCheckCommandTimeout, this, _1));
}
void
@@ -414,7 +420,7 @@
}
m_scheduler.scheduleEvent(m_checkPeriod,
- ndn::bind(&NdnPutFile::startCheckCommand, this));
+ bind(&NdnPutFile::startCheckCommand, this));
}
void
diff --git a/tools/ndnrepowatch.cpp b/tools/ndnrepowatch.cpp
index a9b6d8b..c5128f3 100644
--- a/tools/ndnrepowatch.cpp
+++ b/tools/ndnrepowatch.cpp
@@ -34,6 +34,11 @@
using namespace ndn::time;
+using std::shared_ptr;
+using std::bind;
+using std::placeholders::_1;
+using std::placeholders::_2;
+
static const uint64_t DEFAULT_INTEREST_LIFETIME = 4000;
static const uint64_t DEFAULT_FRESHNESS_PERIOD = 10000;
static const uint64_t DEFAULT_CHECK_PERIOD = 1000;
@@ -130,7 +135,7 @@
ndn::Name m_dataPrefix;
ndn::KeyChain m_keyChain;
- typedef std::map<uint64_t, ndn::shared_ptr<ndn::Data> > DataContainer;
+ typedef std::map<uint64_t, shared_ptr<ndn::Data> > DataContainer;
};
void
@@ -140,7 +145,7 @@
startWatchCommand();
if (hasTimeout)
- m_scheduler.scheduleEvent(watchTimeout, ndn::bind(&NdnRepoWatch::stopProcess, this));
+ m_scheduler.scheduleEvent(watchTimeout, bind(&NdnRepoWatch::stopProcess, this));
m_face.processEvents();
}
@@ -161,20 +166,23 @@
}
ndn::Interest commandInterest = generateCommandInterest(repoPrefix, "start", parameters);
m_face.expressInterest(commandInterest,
- ndn::bind(&NdnRepoWatch::onWatchCommandResponse, this, _1, _2),
- ndn::bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
+ bind(&NdnRepoWatch::onWatchCommandResponse, this,
+ _1, _2),
+ bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
}
else if (status == STOP){
ndn::Interest commandInterest = generateCommandInterest(repoPrefix, "stop", parameters);
m_face.expressInterest(commandInterest,
- ndn::bind(&NdnRepoWatch::onWatchCommandResponse, this, _1, _2),
- ndn::bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
+ bind(&NdnRepoWatch::onWatchCommandResponse, this,
+ _1, _2),
+ bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
}
else if (status == CHECK){
ndn::Interest commandInterest = generateCommandInterest(repoPrefix, "check", parameters);
m_face.expressInterest(commandInterest,
- ndn::bind(&NdnRepoWatch::onWatchCommandResponse, this, _1, _2),
- ndn::bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
+ bind(&NdnRepoWatch::onWatchCommandResponse, this,
+ _1, _2),
+ bind(&NdnRepoWatch::onWatchCommandTimeout, this, _1));
}
}
@@ -196,13 +204,13 @@
else if (statusCode == 300) {
std::cerr << "Watching prefix is running!" <<std::endl;
m_scheduler.scheduleEvent(m_checkPeriod,
- ndn::bind(&NdnRepoWatch::startCheckCommand, this));
+ bind(&NdnRepoWatch::startCheckCommand, this));
return;
}
else if (statusCode == 100) {
std::cerr << "Watching prefix starts!" <<std::endl;
m_scheduler.scheduleEvent(m_checkPeriod,
- ndn::bind(&NdnRepoWatch::startCheckCommand, this));
+ bind(&NdnRepoWatch::startCheckCommand, this));
return;
}
else {
@@ -231,8 +239,8 @@
RepoCommandParameter()
.setName(m_dataPrefix));
m_face.expressInterest(checkInterest,
- ndn::bind(&NdnRepoWatch::onWatchCommandResponse, this, _1, _2),
- ndn::bind(&NdnRepoWatch::onCheckCommandTimeout, this, _1));
+ bind(&NdnRepoWatch::onWatchCommandResponse, this, _1, _2),
+ bind(&NdnRepoWatch::onCheckCommandTimeout, this, _1));
}
void
diff --git a/tools/repo-ng-ls.cpp b/tools/repo-ng-ls.cpp
index be51b34..862f133 100644
--- a/tools/repo-ng-ls.cpp
+++ b/tools/repo-ng-ls.cpp
@@ -26,7 +26,7 @@
namespace repo {
-using namespace ndn::time;
+using std::string;
void
printUsage(const char* programName)