build+tests: Fixing c++11 mode compilation and correcting integrated test with faces
Change-Id: I32e34d6b2ee8cfd85ec83f62323dd7a51f2238d6
diff --git a/src/common.hpp b/src/common.hpp
index aa38241..ed2bf19 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -82,7 +82,18 @@
using std::function;
using std::bind;
-using std::placeholders; // _1, _2, ..
+using std::placeholders::_1;
+using std::placeholders::_2;
+using std::placeholders::_3;
+using std::placeholders::_4;
+using std::placeholders::_5;
+using std::placeholders::_6;
+using std::placeholders::_7;
+using std::placeholders::_8;
+using std::placeholders::_9;
+
+using std::ref;
+using std::cref;
} // namespace ndn
@@ -114,6 +125,9 @@
using boost::function;
using boost::bind;
+using boost::ref;
+using boost::cref;
+
} // namespace ndn
#endif // NDN_CXX_HAVE_CXX11
diff --git a/src/encoding/buffer.hpp b/src/encoding/buffer.hpp
index 616832c..3130a73 100644
--- a/src/encoding/buffer.hpp
+++ b/src/encoding/buffer.hpp
@@ -20,8 +20,8 @@
namespace ndn {
class Buffer;
-typedef ptr_lib::shared_ptr<const Buffer> ConstBufferPtr;
-typedef ptr_lib::shared_ptr<Buffer> BufferPtr;
+typedef shared_ptr<const Buffer> ConstBufferPtr;
+typedef shared_ptr<Buffer> BufferPtr;
/**
* @brief Class representing a general-use automatically managed/resized buffer
diff --git a/src/face.cpp b/src/face.cpp
index d351c0a..44de6cc 100644
--- a/src/face.cpp
+++ b/src/face.cpp
@@ -92,8 +92,8 @@
m_transport = transport;
m_ioService = ioService;
- m_pitTimeoutCheckTimer = make_shared<monotonic_deadline_timer>(boost::ref(*m_ioService));
- m_processEventsTimeoutTimer = make_shared<monotonic_deadline_timer>(boost::ref(*m_ioService));
+ m_pitTimeoutCheckTimer = make_shared<monotonic_deadline_timer>(ref(*m_ioService));
+ m_processEventsTimeoutTimer = make_shared<monotonic_deadline_timer>(ref(*m_ioService));
std::string protocol = "nrd-0.1";
@@ -112,15 +112,15 @@
if (isSupportedNrdProtocol(protocol))
{
- m_fwController = make_shared<nrd::Controller>(boost::ref(*this));
+ m_fwController = make_shared<nrd::Controller>(ref(*this));
}
else if (isSupportedNfdProtocol(protocol))
{
- m_fwController = make_shared<nfd::Controller>(boost::ref(*this));
+ m_fwController = make_shared<nfd::Controller>(ref(*this));
}
else if (isSupportedNdndProtocol(protocol))
{
- m_fwController = make_shared<ndnd::Controller>(boost::ref(*this));
+ m_fwController = make_shared<ndnd::Controller>(ref(*this));
}
else
{
@@ -135,7 +135,7 @@
m_transport->connect(*m_ioService,
bind(&Face::onReceiveElement, this, _1));
- shared_ptr<const Interest> interestToExpress(new Interest(interest));
+ shared_ptr<Interest> interestToExpress(new Interest(interest));
// If the same ioService thread, dispatch directly calls the method
m_ioService->dispatch(bind(&Face::asyncExpressInterest, this,
@@ -219,6 +219,12 @@
m_pendingInterestTable.remove_if(MatchPendingInterestId(pendingInterestId));
}
+void
+Face::finalizeSetInterestFilter(const shared_ptr<RegisteredPrefix>& registeredPrefix)
+{
+ m_registeredPrefixTable.push_back(registeredPrefix);
+}
+
const RegisteredPrefixId*
Face::setInterestFilter(const Name& prefix,
const OnInterest& onInterest,
@@ -227,8 +233,7 @@
shared_ptr<RegisteredPrefix> prefixToRegister(new RegisteredPrefix(prefix, onInterest));
m_fwController->selfRegisterPrefix(prefixToRegister->getPrefix(),
- bind(&RegisteredPrefixTable::push_back,
- &m_registeredPrefixTable, prefixToRegister),
+ bind(&Face::finalizeSetInterestFilter, this, prefixToRegister),
bind(onSetInterestFilterFailed,
prefixToRegister->getPrefix(), _1));
@@ -244,8 +249,7 @@
shared_ptr<RegisteredPrefix> prefixToRegister(new RegisteredPrefix(prefix, onInterest));
m_fwController->selfRegisterPrefix(prefixToRegister->getPrefix(),
- bind(&RegisteredPrefixTable::push_back,
- &m_registeredPrefixTable, prefixToRegister),
+ bind(&Face::finalizeSetInterestFilter, this, prefixToRegister),
bind(onSetInterestFilterFailed,
prefixToRegister->getPrefix(), _1),
certificate);
@@ -262,8 +266,7 @@
shared_ptr<RegisteredPrefix> prefixToRegister(new RegisteredPrefix(prefix, onInterest));
m_fwController->selfRegisterPrefix(prefixToRegister->getPrefix(),
- bind(&RegisteredPrefixTable::push_back,
- &m_registeredPrefixTable, prefixToRegister),
+ bind(&Face::finalizeSetInterestFilter, this, prefixToRegister),
bind(onSetInterestFilterFailed,
prefixToRegister->getPrefix(), _1),
identity);
@@ -380,7 +383,7 @@
if (keepThread) {
// work will ensure that m_ioService is running until work object exists
- m_ioServiceWork = make_shared<boost::asio::io_service::work>(boost::ref(*m_ioService));
+ m_ioServiceWork = make_shared<boost::asio::io_service::work>(ref(*m_ioService));
}
m_ioService->run();
diff --git a/src/face.hpp b/src/face.hpp
index 48f253e..d0efc03 100644
--- a/src/face.hpp
+++ b/src/face.hpp
@@ -394,6 +394,9 @@
const Name& identity);
void
+ finalizeSetInterestFilter(const shared_ptr<RegisteredPrefix>& registeredPrefix);
+
+ void
finalizeUnsetInterestFilter(RegisteredPrefixTable::iterator item);
void
diff --git a/src/management/nfd-controller.hpp b/src/management/nfd-controller.hpp
index 583be71..081389e 100644
--- a/src/management/nfd-controller.hpp
+++ b/src/management/nfd-controller.hpp
@@ -53,7 +53,7 @@
start<Command>(parameters, onSuccess, onFailure,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(Name())),
+ Name()),
timeout);
}
@@ -68,7 +68,7 @@
start<Command>(parameters, onSuccess, onFailure,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(certificate.getName())),
+ cref(certificate.getName())),
timeout);
}
@@ -83,7 +83,7 @@
start<Command>(parameters, onSuccess, onFailure,
bind(&CommandInterestGenerator::generateWithIdentity,
&m_commandInterestGenerator, _1,
- boost::cref(identity)),
+ cref(identity)),
timeout);
}
@@ -96,7 +96,7 @@
this->selfRegisterPrefix(prefixToRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(Name())));
+ Name()));
}
virtual void
@@ -108,7 +108,7 @@
this->selfRegisterPrefix(prefixToRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(certificate.getName())));
+ cref(certificate.getName())));
}
virtual void
@@ -120,7 +120,7 @@
this->selfRegisterPrefix(prefixToRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generateWithIdentity,
&m_commandInterestGenerator, _1,
- boost::cref(identity)));
+ cref(identity)));
}
virtual void
@@ -131,7 +131,7 @@
this->selfDeregisterPrefix(prefixToDeRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(Name())));
+ Name()));
}
virtual void
@@ -143,7 +143,7 @@
this->selfDeregisterPrefix(prefixToDeRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generate,
&m_commandInterestGenerator, _1,
- boost::cref(certificate.getName())));
+ cref(certificate.getName())));
}
virtual void
@@ -155,7 +155,7 @@
this->selfDeregisterPrefix(prefixToDeRegister, onSuccess, onFail,
bind(&CommandInterestGenerator::generateWithIdentity,
&m_commandInterestGenerator, _1,
- boost::cref(identity)));
+ cref(identity)));
}
protected:
diff --git a/src/security/conf/checker.hpp b/src/security/conf/checker.hpp
index cb56d85..05eb8c1 100644
--- a/src/security/conf/checker.hpp
+++ b/src/security/conf/checker.hpp
@@ -380,8 +380,7 @@
if (propertyIt != configSection.end())
throw Error("Expect the end of checker!");
- return make_shared<CustomizedChecker>(boost::cref(getSigType(sigType)),
- boost::cref(keyLocatorChecker));
+ return make_shared<CustomizedChecker>(getSigType(sigType), cref(keyLocatorChecker));
}
static shared_ptr<Checker>
@@ -401,7 +400,7 @@
if (propertyIt != configSection.end())
throw Error("Expect the end of checker!");
- return make_shared<HierarchicalChecker>(boost::cref(getSigType(sigType)));
+ return make_shared<HierarchicalChecker>(getSigType(sigType));
}
static shared_ptr<Checker>
diff --git a/src/security/conf/filter.hpp b/src/security/conf/filter.hpp
index 5891c76..8fa91b8 100644
--- a/src/security/conf/filter.hpp
+++ b/src/security/conf/filter.hpp
@@ -199,8 +199,8 @@
if (propertyIt != configSection.end())
throw Error("Expect the end of filter!");
- return make_shared<RelationNameFilter>(boost::cref(name),
- boost::cref(relation));
+ return make_shared<RelationNameFilter>(cref(name),
+ cref(relation));
}
else if (boost::iequals(propertyIt->first, "regex"))
{
diff --git a/src/security/key-chain.cpp b/src/security/key-chain.cpp
index 58c3570..67cdda6 100644
--- a/src/security/key-chain.cpp
+++ b/src/security/key-chain.cpp
@@ -265,8 +265,8 @@
m_pib->addCertificateAsIdentityDefault(*cert);
}
- shared_ptr<SecuredBag> secureBag = make_shared<SecuredBag>(boost::cref(*cert),
- boost::cref(pkcs5));
+ // make_shared on OSX 10.9 has some strange problem here
+ shared_ptr<SecuredBag> secureBag(new SecuredBag(*cert, pkcs5));
return secureBag;
}
diff --git a/src/security/sec-public-info-memory.cpp b/src/security/sec-public-info-memory.cpp
index f84b291..c9efc2f 100644
--- a/src/security/sec-public-info-memory.cpp
+++ b/src/security/sec-public-info-memory.cpp
@@ -61,7 +61,7 @@
addIdentity(identityName);
- m_keyStore[keyName.toUri()] = make_shared<KeyRecord>(keyType, boost::cref(publicKey));
+ m_keyStore[keyName.toUri()] = make_shared<KeyRecord>(keyType, cref(publicKey));
}
shared_ptr<PublicKey>
diff --git a/src/security/validator-config.cpp b/src/security/validator-config.cpp
index 80d2fb1..11f63a3 100644
--- a/src/security/validator-config.cpp
+++ b/src/security/validator-config.cpp
@@ -33,7 +33,7 @@
, m_certificateCache(certificateCache)
{
if (!static_cast<bool>(m_certificateCache))
- m_certificateCache = make_shared<CertificateCacheTtl>(boost::ref(m_face.getIoService()));
+ m_certificateCache = make_shared<CertificateCacheTtl>(ref(m_face.getIoService()));
}
void
diff --git a/src/security/validator-config.hpp b/src/security/validator-config.hpp
index 00d7c66..9dc69e3 100644
--- a/src/security/validator-config.hpp
+++ b/src/security/validator-config.hpp
@@ -209,7 +209,7 @@
Interest certInterest(keyLocatorName);
shared_ptr<ValidationRequest> nextStep =
- make_shared<ValidationRequest>(boost::cref(certInterest),
+ make_shared<ValidationRequest>(cref(certInterest),
onCertValidated,
onCertValidationFailed,
1, nSteps + 1);
@@ -229,7 +229,7 @@
const OnFailed& onValidationFailed)
{
shared_ptr<IdentityCertificate> certificate =
- make_shared<IdentityCertificate>(boost::cref(*signCertificate));
+ make_shared<IdentityCertificate>(cref(*signCertificate));
if (!certificate->isTooLate() && !certificate->isTooEarly())
{
diff --git a/src/security/validator-regex.cpp b/src/security/validator-regex.cpp
index c0797c7..b4fd1b8 100644
--- a/src/security/validator-regex.cpp
+++ b/src/security/validator-regex.cpp
@@ -36,7 +36,7 @@
, m_certificateCache(certificateCache)
{
if (!static_cast<bool>(m_certificateCache))
- m_certificateCache = make_shared<CertificateCacheTtl>(boost::ref(m_face.getIoService()));
+ m_certificateCache = make_shared<CertificateCacheTtl>(ref(m_face.getIoService()));
}
void
@@ -46,7 +46,7 @@
const OnDataValidationFailed& onValidationFailed)
{
shared_ptr<IdentityCertificate> certificate =
- make_shared<IdentityCertificate>(boost::cref(*signCertificate));
+ make_shared<IdentityCertificate>(cref(*signCertificate));
if (!certificate->isTooLate() && !certificate->isTooEarly())
{
@@ -137,7 +137,7 @@
Interest interest(sig.getKeyLocator().getName());
shared_ptr<ValidationRequest> nextStep =
- make_shared<ValidationRequest>(boost::cref(interest),
+ make_shared<ValidationRequest>(cref(interest),
onKeyValidated,
onKeyValidationFailed,
3,
diff --git a/src/transport/stream-transport.hpp b/src/transport/stream-transport.hpp
index ca1ce9a..c9d61b7 100644
--- a/src/transport/stream-transport.hpp
+++ b/src/transport/stream-transport.hpp
@@ -59,7 +59,7 @@
buffer.push_back(boost::asio::buffer(i->first.wire(), i->first.size()));
buffer.push_back(boost::asio::buffer(i->second.wire(), i->second.size()));
m_socket.async_send(buffer,
- bind(&impl::handle_async_send, this, _1, i->first, i->second));
+ bind(&impl::handle_async_send2, this, _1, i->first, i->second));
}
m_sendQueue.clear();
@@ -172,7 +172,7 @@
buffers.push_back(boost::asio::buffer(payload.wire(), payload.size()));
m_socket.async_send(buffers,
- bind(&impl::handle_async_send, this, _1, header, payload));
+ bind(&impl::handle_async_send2, this, _1, header, payload));
}
}
@@ -253,8 +253,8 @@
}
void
- handle_async_send(const boost::system::error_code& error,
- const Block& header, const Block& payload)
+ handle_async_send2(const boost::system::error_code& error,
+ const Block& header, const Block& payload)
{
// pass (needed to keep data blocks alive during the send)
}
@@ -327,7 +327,7 @@
// typename boost::asio::ip::basic_resolver< protocol > resolver;
shared_ptr<typename protocol::resolver> resolver =
- make_shared<typename protocol::resolver>(boost::ref(this->m_socket.get_io_service()));
+ make_shared<typename protocol::resolver>(ref(this->m_socket.get_io_service()));
resolver->async_resolve(query, bind(&impl::resolveHandler, this, _1, _2, resolver));
}
diff --git a/src/transport/tcp-transport.cpp b/src/transport/tcp-transport.cpp
index 8f835a6..fafe987 100644
--- a/src/transport/tcp-transport.cpp
+++ b/src/transport/tcp-transport.cpp
@@ -34,8 +34,7 @@
if (!static_cast<bool>(m_impl)) {
Transport::connect(ioService, receiveCallback);
- m_impl = make_shared<Impl> (boost::ref(*this),
- boost::ref(ioService));
+ m_impl = make_shared<Impl>(ref(*this), ref(ioService));
}
boost::asio::ip::tcp::resolver::query query(m_host, m_port);
diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
index cce5f0f..a7acd44 100644
--- a/src/transport/unix-transport.cpp
+++ b/src/transport/unix-transport.cpp
@@ -77,8 +77,7 @@
if (!static_cast<bool>(m_impl)) {
Transport::connect(ioService, receiveCallback);
- m_impl = make_shared<Impl> (boost::ref(*this),
- boost::ref(ioService));
+ m_impl = make_shared<Impl>(ref(*this), ref(ioService));
}
m_impl->connect(boost::asio::local::stream_protocol::endpoint(m_unixSocket));
diff --git a/src/util/regex/regex-pattern-list-matcher.hpp b/src/util/regex/regex-pattern-list-matcher.hpp
index d6e3a72..827c3f2 100644
--- a/src/util/regex/regex-pattern-list-matcher.hpp
+++ b/src/util/regex/regex-pattern-list-matcher.hpp
@@ -97,7 +97,7 @@
shared_ptr<RegexMatcher> matcher =
make_shared<RegexBackrefMatcher>(m_expr.substr(start, end - start), m_backrefManager);
m_backrefManager->pushRef(matcher);
- boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
+ dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
m_matcherList.push_back(matcher);
}
diff --git a/src/util/regex/regex-repeat-matcher.hpp b/src/util/regex/regex-repeat-matcher.hpp
index 502369f..ce0abb1 100644
--- a/src/util/regex/regex-repeat-matcher.hpp
+++ b/src/util/regex/regex-repeat-matcher.hpp
@@ -89,7 +89,7 @@
if ('(' == m_expr[0]){
matcher = make_shared<RegexBackrefMatcher>(m_expr.substr(0, m_indicator), m_backrefManager);
m_backrefManager->pushRef(matcher);
- boost::dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
+ dynamic_pointer_cast<RegexBackrefMatcher>(matcher)->lateCompile();
}
else{
matcher = make_shared<RegexComponentSetMatcher>(m_expr.substr(0, m_indicator),
diff --git a/src/util/regex/regex-top-matcher.cpp b/src/util/regex/regex-top-matcher.cpp
index b00a891..6a4cf36 100644
--- a/src/util/regex/regex-top-matcher.cpp
+++ b/src/util/regex/regex-top-matcher.cpp
@@ -47,13 +47,13 @@
expr = expr.substr(0, expr.size()-1);
if ('^' != expr[0])
- m_secondaryMatcher = make_shared<RegexPatternListMatcher>(boost::cref("<.*>*" + expr),
- boost::cref(m_secondaryBackRefManager));
+ m_secondaryMatcher = make_shared<RegexPatternListMatcher>("<.*>*" + expr,
+ cref(m_secondaryBackRefManager));
else
expr = expr.substr(1, expr.size()-1);
- m_primaryMatcher = make_shared<RegexPatternListMatcher>(boost::cref(expr),
- boost::cref(m_primaryBackRefManager));
+ m_primaryMatcher = make_shared<RegexPatternListMatcher>(func_lib::cref(expr),
+ func_lib::cref(m_primaryBackRefManager));
}
bool
@@ -199,7 +199,8 @@
if (hasAnchor)
regexStr.append("$");
- return make_shared<RegexTopMatcher>(boost::cref(regexStr));
+ // OSX 10.9 has problems with just cref
+ return make_shared<RegexTopMatcher>(func_lib::cref(regexStr));
}
std::string
diff --git a/src/util/scheduler.cpp b/src/util/scheduler.cpp
index 9a51871..4e74d10 100644
--- a/src/util/scheduler.cpp
+++ b/src/util/scheduler.cpp
@@ -62,7 +62,8 @@
{
}
-Scheduler::EventInfo::EventInfo(const time::steady_clock::TimePoint& when, const EventInfo& previousEvent)
+Scheduler::EventInfo::EventInfo(const time::steady_clock::TimePoint& when,
+ const EventInfo& previousEvent)
: m_scheduledTime(when)
, m_period(previousEvent.m_period)
, m_event(previousEvent.m_event)
@@ -101,7 +102,7 @@
const Event& event)
{
EventQueue::iterator i = m_events.insert(EventInfo(after, period, event));
- i->m_eventId = make_shared<EventIdImpl>(boost::cref(i));
+ i->m_eventId = make_shared<EventIdImpl>(func_lib::cref(i));
if (!m_isEventExecuting)
{