Always build in C++11 mode
refs: #1930
Change-Id: Iedad4a814e5c7e6a5486f2f7e16c45c356131792
diff --git a/nsync/sync-common.h b/nsync/sync-common.h
new file mode 100644
index 0000000..982726e
--- /dev/null
+++ b/nsync/sync-common.h
@@ -0,0 +1,59 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014 University of Memphis,
+ * Regents of the University of California
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
+ *
+ **/
+
+#ifndef NSYNC_SYNC_COMMON_HPP
+#define NSYNC_SYNC_COMMON_HPP
+
+#include <boost/exception/all.hpp>
+
+#include <ndn-cxx/common.hpp>
+
+#include <tuple>
+
+namespace Sync {
+
+using ndn::bind;
+using ndn::function;
+
+using ndn::make_shared;
+using ndn::shared_ptr;
+using ndn::weak_ptr;
+
+using ndn::dynamic_pointer_cast;
+using ndn::static_pointer_cast;
+
+using ndn::_1;
+using ndn::_2;
+using ndn::_3;
+using ndn::_4;
+using ndn::_5;
+using ndn::_6;
+using ndn::_7;
+using ndn::_8;
+using ndn::_9;
+
+using std::tuple;
+using std::make_tuple;
+using std::tie;
+
+} // namespace Sync
+
+#endif // NSYNC_SYNC_COMMON_HPP
diff --git a/nsync/sync-diff-leaf.cc b/nsync/sync-diff-leaf.cc
index bdbbd1b..114b122 100644
--- a/nsync/sync-diff-leaf.cc
+++ b/nsync/sync-diff-leaf.cc
@@ -17,12 +17,12 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-diff-leaf.h"
#include <boost/throw_exception.hpp>
-typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
+typedef boost::error_info<struct tag_errmsg, std::string> errmsg_info;
using namespace Sync::Error;
diff --git a/nsync/sync-diff-leaf.h b/nsync/sync-diff-leaf.h
index 6e09efe..598a83e 100644
--- a/nsync/sync-diff-leaf.h
+++ b/nsync/sync-diff-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_LEAF_H
@@ -40,7 +40,7 @@
/**
* @ingroup sync
- * @brief Annotated SYNC leaf
+ * @brief Annotated SYNC leaf
*/
class DiffLeaf : public Leaf
{
@@ -73,8 +73,8 @@
Operation m_op;
};
-typedef boost::shared_ptr<DiffLeaf> DiffLeafPtr;
-typedef boost::shared_ptr<const DiffLeaf> DiffLeafConstPtr;
+typedef shared_ptr<DiffLeaf> DiffLeafPtr;
+typedef shared_ptr<const DiffLeaf> DiffLeafConstPtr;
std::ostream &
operator << (std::ostream &os, Operation op);
diff --git a/nsync/sync-diff-state-container.h b/nsync/sync-diff-state-container.h
index 2ae7c59..9cbec2b 100644
--- a/nsync/sync-diff-state-container.h
+++ b/nsync/sync-diff-state-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_STATE_CONTAINER_H
@@ -40,7 +40,7 @@
namespace Sync {
-/// @cond include_hidden
+/// @cond include_hidden
struct sequenced { };
struct timed { };
/// @endcond
@@ -59,7 +59,7 @@
DigestPtrHash,
DigestPtrEqual
>
- ,
+ ,
// sequenced index to access older/newer element (like in list)
mi::sequenced<mi::tag<sequenced> >
>
diff --git a/nsync/sync-diff-state.cc b/nsync/sync-diff-state.cc
index 3030940..715ba47 100644
--- a/nsync/sync-diff-state.cc
+++ b/nsync/sync-diff-state.cc
@@ -17,18 +17,15 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-diff-state.h"
#include "sync-diff-leaf.h"
-#include <boost/make_shared.hpp>
#include <boost/foreach.hpp>
#include <boost/assert.hpp>
-using namespace boost;
-
namespace Sync {
DiffState::DiffState ()
@@ -43,7 +40,7 @@
DiffState::diff () const
{
DiffStatePtr ret = make_shared<DiffState> ();
-
+
DiffStatePtr state = m_next;
while (state != 0)
{
@@ -71,17 +68,17 @@
BOOST_ASSERT (false);
}
}
-
+
return *this;
}
-
+
// from State
-boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
DiffState::update (NameInfoConstPtr info, const SeqNo &seq)
{
m_leaves.erase (info);
- DiffLeafPtr leaf = make_shared<DiffLeaf> (info, cref (seq));
+ DiffLeafPtr leaf = make_shared<DiffLeaf> (info, seq);
m_leaves.insert (leaf);
return make_tuple (true, false, SeqNo ());
diff --git a/nsync/sync-diff-state.h b/nsync/sync-diff-state.h
index d944c3e..fd80809 100644
--- a/nsync/sync-diff-state.h
+++ b/nsync/sync-diff-state.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_DIFF_STATE_H
@@ -29,8 +29,8 @@
namespace Sync {
class DiffState;
-typedef boost::shared_ptr<DiffState> DiffStatePtr;
-typedef boost::shared_ptr<DiffState> DiffStateConstPtr;
+typedef shared_ptr<DiffState> DiffStatePtr;
+typedef shared_ptr<DiffState> DiffStateConstPtr;
/**
* @ingroup ccnx
@@ -67,7 +67,7 @@
*/
DigestConstPtr
getDigest () const { return m_digest; }
-
+
/**
* @brief Accumulate differences from `this' state to the most current state
* @returns Accumulated differences from `this' state to the most current state
@@ -84,14 +84,14 @@
*/
DiffState&
operator += (const DiffState &state);
-
+
// from State
- virtual boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+ virtual tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
update (NameInfoConstPtr info, const SeqNo &seq);
virtual bool
remove (NameInfoConstPtr info);
-
+
private:
DiffStatePtr m_next;
DigestConstPtr m_digest;
diff --git a/nsync/sync-digest.cc b/nsync/sync-digest.cc
index c9ff12d..c6dc060 100644
--- a/nsync/sync-digest.cc
+++ b/nsync/sync-digest.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-digest.h"
diff --git a/nsync/sync-digest.h b/nsync/sync-digest.h
index da45758..b7dbe41 100644
--- a/nsync/sync-digest.h
+++ b/nsync/sync-digest.h
@@ -23,8 +23,8 @@
#ifndef SYNC_DIGEST_H
#define SYNC_DIGEST_H
-#include <boost/exception/all.hpp>
-#include <boost/cstdint.hpp>
+#include "sync-common.h"
+
#include <vector>
#include "openssl.h"
@@ -142,8 +142,8 @@
struct DigestCalculationError : virtual boost::exception, virtual std::exception { };
}
-typedef boost::shared_ptr<Digest> DigestPtr;
-typedef boost::shared_ptr<const Digest> DigestConstPtr;
+typedef shared_ptr<Digest> DigestPtr;
+typedef shared_ptr<const Digest> DigestConstPtr;
Digest &
Digest::operator << (const std::string &str)
diff --git a/nsync/sync-event.h b/nsync/sync-event.h
index 7808947..083ca61 100644
--- a/nsync/sync-event.h
+++ b/nsync/sync-event.h
@@ -17,18 +17,18 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_EVENT_H
#define SYNC_EVENT_H
-#include <boost/function.hpp>
+#include "sync-common.h"
namespace Sync
{
-typedef boost::function< void ( ) > Event;
+typedef function< void ( ) > Event;
} // Sync
diff --git a/nsync/sync-full-leaf.cc b/nsync/sync-full-leaf.cc
index 84f96e3..67c68fc 100644
--- a/nsync/sync-full-leaf.cc
+++ b/nsync/sync-full-leaf.cc
@@ -17,13 +17,10 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-full-leaf.h"
-#include <boost/ref.hpp>
-
-using namespace boost;
namespace Sync {
diff --git a/nsync/sync-full-leaf.h b/nsync/sync-full-leaf.h
index 08142a6..5946c0d 100644
--- a/nsync/sync-full-leaf.h
+++ b/nsync/sync-full-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_FULL_LEAF_H
@@ -29,7 +29,7 @@
/**
* @ingroup sync
- * @brief SYNC leaf for the full state (with support of Digest calculation)
+ * @brief SYNC leaf for the full state (with support of Digest calculation)
*/
class FullLeaf : public Leaf
{
@@ -49,12 +49,12 @@
* (including updates of child classes)
*/
const Digest &
- getDigest () const { return m_digest; }
+ getDigest () const { return m_digest; }
// from Leaf
virtual void
setSeq (const SeqNo &seq);
-
+
private:
void
updateDigest ();
@@ -63,8 +63,8 @@
Digest m_digest;
};
-typedef boost::shared_ptr<FullLeaf> FullLeafPtr;
-typedef boost::shared_ptr<const FullLeaf> FullLeafConstPtr;
+typedef shared_ptr<FullLeaf> FullLeafPtr;
+typedef shared_ptr<const FullLeaf> FullLeafConstPtr;
} // Sync
diff --git a/nsync/sync-full-state.cc b/nsync/sync-full-state.cc
index 7000606..b6ffd64 100644
--- a/nsync/sync-full-state.cc
+++ b/nsync/sync-full-state.cc
@@ -17,22 +17,15 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-full-state.h"
-#include <boost/make_shared.hpp>
-#include <boost/lambda/lambda.hpp>
-#include <boost/lambda/bind.hpp>
-#include <boost/foreach.hpp>
#include <boost/assert.hpp>
#include "sync-full-leaf.h"
-using namespace boost;
-namespace ll = boost::lambda;
-
namespace Sync {
@@ -59,7 +52,7 @@
m_digest = make_shared<Digest> ();
if (m_leaves.get<ordered> ().size () > 0)
{
- BOOST_FOREACH (LeafConstPtr leaf, m_leaves.get<ordered> ())
+ for (LeafConstPtr leaf : m_leaves.get<ordered> ())
{
FullLeafConstPtr fullLeaf = dynamic_pointer_cast<const FullLeaf> (leaf);
BOOST_ASSERT (fullLeaf != 0);
@@ -78,7 +71,7 @@
}
// from State
-boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
FullState::update (NameInfoConstPtr info, const SeqNo &seq)
{
m_lastUpdated = ndn::time::system_clock::now();
@@ -89,7 +82,7 @@
LeafContainer::iterator item = m_leaves.find (info);
if (item == m_leaves.end ())
{
- m_leaves.insert (make_shared<FullLeaf> (info, cref (seq)));
+ m_leaves.insert (make_shared<FullLeaf> (info, seq));
return make_tuple (true, false, SeqNo ());
}
else
@@ -100,8 +93,7 @@
}
SeqNo old = (*item)->getSeq ();
- m_leaves.modify (item,
- ll::bind (&Leaf::setSeq, *ll::_1, seq));
+ m_leaves.modify (item, [&seq](LeafPtr data){ data->setSeq(seq); });
return make_tuple (false, true, old);
}
}
diff --git a/nsync/sync-full-state.h b/nsync/sync-full-state.h
index 4532d1d..0905004 100644
--- a/nsync/sync-full-state.h
+++ b/nsync/sync-full-state.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_FULL_STATE_H
@@ -29,8 +29,8 @@
namespace Sync {
class FullState;
-typedef boost::shared_ptr<FullState> FullStatePtr;
-typedef boost::shared_ptr<FullState> FullStateConstPtr;
+typedef shared_ptr<FullState> FullStatePtr;
+typedef shared_ptr<FullState> FullStateConstPtr;
/**
@@ -61,14 +61,14 @@
*/
DigestConstPtr
getDigest ();
-
+
// from State
- virtual boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+ virtual tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
update (NameInfoConstPtr info, const SeqNo &seq);
virtual bool
remove (NameInfoConstPtr info);
-
+
private:
ndn::time::system_clock::TimePoint m_lastUpdated; ///< @brief Time when state was updated last time
DigestPtr m_digest;
diff --git a/nsync/sync-interest-container.h b/nsync/sync-interest-container.h
index 1045355..96086fa 100644
--- a/nsync/sync-interest-container.h
+++ b/nsync/sync-interest-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_INTEREST_CONTAINER_H
@@ -51,14 +51,14 @@
, m_unknown (unknown)
{
}
-
+
DigestConstPtr m_digest;
std::string m_name;
ndn::time::system_clock::TimePoint m_time;
bool m_unknown;
};
-/// @cond include_hidden
+/// @cond include_hidden
struct named { };
struct hashed;
struct timed;
@@ -76,7 +76,7 @@
BOOST_MULTI_INDEX_MEMBER(Interest, std::string, m_name)
>
,
-
+
mi::hashed_non_unique<
mi::tag<hashed>,
BOOST_MULTI_INDEX_MEMBER(Interest, DigestConstPtr, m_digest),
@@ -84,7 +84,7 @@
DigestPtrEqual
>
,
-
+
mi::ordered_non_unique<
mi::tag<timed>,
BOOST_MULTI_INDEX_MEMBER(Interest, ndn::time::system_clock::TimePoint, m_time)
diff --git a/nsync/sync-interest-table.h b/nsync/sync-interest-table.h
index 7064e4f..13ea3bc 100644
--- a/nsync/sync-interest-table.h
+++ b/nsync/sync-interest-table.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_INTEREST_TABLE_H
@@ -36,7 +36,7 @@
/**
* \ingroup sync
* @brief A table to keep unanswered Sync Interest
- * all access operation to the table should grab the
+ * all access operation to the table should grab the
* mutex first
*/
class SyncInterestTable
@@ -63,7 +63,7 @@
*/
bool
remove (const std::string &name);
-
+
/**
* @brief pop a non-expired Interest from PIT
*/
diff --git a/nsync/sync-leaf.cc b/nsync/sync-leaf.cc
index 03e2217..e01b192 100644
--- a/nsync/sync-leaf.cc
+++ b/nsync/sync-leaf.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-leaf.h"
diff --git a/nsync/sync-leaf.h b/nsync/sync-leaf.h
index 345be46..aae1e80 100644
--- a/nsync/sync-leaf.h
+++ b/nsync/sync-leaf.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LEAF_H
@@ -42,7 +42,7 @@
*/
Leaf (NameInfoConstPtr info, const SeqNo &seq);
virtual ~Leaf ();
-
+
/**
* @brief Get name of the leaf
*/
@@ -63,14 +63,14 @@
*/
virtual void
setSeq (const SeqNo &seq);
-
+
private:
NameInfoConstPtr m_info;
SeqNo m_seq;
};
-typedef boost::shared_ptr<Leaf> LeafPtr;
-typedef boost::shared_ptr<const Leaf> LeafConstPtr;
+typedef shared_ptr<Leaf> LeafPtr;
+typedef shared_ptr<const Leaf> LeafConstPtr;
inline std::ostream &
operator << (std::ostream &os, const Leaf &leaf)
diff --git a/nsync/sync-logging.cc b/nsync/sync-logging.cc
index 9048964..3a63232 100644
--- a/nsync/sync-logging.cc
+++ b/nsync/sync-logging.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-logging.h"
@@ -43,7 +43,7 @@
static bool configured = false;
if (configured) return;
-
+
if (access ("log4cxx.properties", R_OK)==0)
PropertyConfigurator::configureAndWatch ("log4cxx.properties");
else
diff --git a/nsync/sync-logging.h b/nsync/sync-logging.h
index 865204a..2bdc36b 100644
--- a/nsync/sync-logging.h
+++ b/nsync/sync-logging.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LOG_H
diff --git a/nsync/sync-logic-event-container.h b/nsync/sync-logic-event-container.h
index ebab72a..11dd29a 100644
--- a/nsync/sync-logic-event-container.h
+++ b/nsync/sync-logic-event-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_LOGIC_EVENT_CONTAINER_H
@@ -25,7 +25,6 @@
#include "sync-event.h"
-#include <boost/function.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/multi_index_container.hpp>
@@ -49,7 +48,7 @@
, event (_event)
, lbl (_label)
{ }
-
+
boost::system_time time;
Event event;
uint32_t lbl;
diff --git a/nsync/sync-logic.cc b/nsync/sync-logic.cc
index 2a748c3..2e0169c 100644
--- a/nsync/sync-logic.cc
+++ b/nsync/sync-logic.cc
@@ -32,7 +32,15 @@
#include <vector>
using namespace std;
-using namespace ndn;
+
+using ndn::Data;
+using ndn::EventId;
+using ndn::KeyChain;
+using ndn::Face;
+using ndn::Name;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+using ndn::Validator;
INIT_LOGGER ("SyncLogic");
@@ -138,7 +146,7 @@
* Normal name: .../<hash>
* Recovery name: .../recovery/<hash>
*/
-boost::tuple<DigestConstPtr, std::string>
+tuple<DigestConstPtr, std::string>
SyncLogic::convertNameToDigestAndType (const Name &name)
{
BOOST_ASSERT (m_syncPrefix.isPrefixOf(name));
@@ -157,11 +165,11 @@
_LOG_DEBUG_ID (hash << ", " << interestType);
- DigestPtr digest = boost::make_shared<Digest> ();
+ DigestPtr digest = make_shared<Digest> ();
istringstream is (hash);
is >> *digest;
- return make_tuple (digest, interestType);
+ return make_tuple(digest, interestType);
}
void
@@ -332,7 +340,7 @@
SyncLogic::processSyncData (const Name &name, DigestConstPtr digest,
const char *wireData, size_t len)
{
- DiffStatePtr diffLog = boost::make_shared<DiffState> ();
+ DiffStatePtr diffLog = make_shared<DiffState> ();
bool ownInterestSatisfied = false;
try
@@ -354,7 +362,7 @@
vector<MissingDataInfo> v;
BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
{
- DiffLeafConstPtr diffLeaf = boost::dynamic_pointer_cast<const DiffLeaf> (leaf);
+ DiffLeafConstPtr diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
BOOST_ASSERT (diffLeaf != 0);
NameInfoConstPtr info = diffLeaf->getInfo();
@@ -366,7 +374,7 @@
bool updated = false;
SeqNo oldSeq;
{
- boost::tie (inserted, updated, oldSeq) = m_state->update (info, seq);
+ tie (inserted, updated, oldSeq) = m_state->update (info, seq);
}
if (inserted || updated)
@@ -484,7 +492,7 @@
void
SyncLogic::satisfyPendingSyncInterests (DiffStateConstPtr diffLog)
{
- DiffStatePtr fullStateLog = boost::make_shared<DiffState> ();
+ DiffStatePtr fullStateLog = make_shared<DiffState> ();
{
BOOST_FOREACH (LeafConstPtr leaf, m_state->getLeaves ()/*.get<timed> ()*/)
{
@@ -549,7 +557,7 @@
_LOG_DEBUG_ID ("addLocalNames (): new state " << *m_state->getDigest ());
- diff = boost::make_shared<DiffState>();
+ diff = make_shared<DiffState>();
diff->update(info, seqN);
insertToDiffLog (diff);
}
@@ -578,7 +586,7 @@
}
m_state->update (forwarderInfo, seqNo);
- diff = boost::make_shared<DiffState>();
+ diff = make_shared<DiffState>();
diff->remove(info);
diff->update(forwarderInfo, seqNo);
@@ -714,7 +722,7 @@
void
SyncLogic::printState () const
{
- BOOST_FOREACH (const boost::shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
+ BOOST_FOREACH (const shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
{
std::cout << *leaf << std::endl;
}
@@ -725,7 +733,7 @@
{
std::map<std::string, bool> m;
- BOOST_FOREACH (const boost::shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
+ BOOST_FOREACH (const shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
{
std::string prefix = leaf->getInfo()->toString();
// do not return forwarder prefix
diff --git a/nsync/sync-logic.h b/nsync/sync-logic.h
index 25c3aae..e43a9ac 100644
--- a/nsync/sync-logic.h
+++ b/nsync/sync-logic.h
@@ -63,9 +63,9 @@
class SyncLogic
{
public:
- typedef boost::function< void (const std::vector<MissingDataInfo> & ) > LogicUpdateCallback;
- typedef boost::function< void (const std::string &/*prefix*/ ) > LogicRemoveCallback;
- typedef boost::function< void (const std::string &)> LogicPerBranchCallback;
+ typedef function< void (const std::vector<MissingDataInfo> & ) > LogicUpdateCallback;
+ typedef function< void (const std::string &/*prefix*/ ) > LogicRemoveCallback;
+ typedef function< void (const std::string &)> LogicPerBranchCallback;
/**
* @brief Constructor
@@ -156,7 +156,7 @@
void
satisfyPendingSyncInterests (DiffStateConstPtr diff);
- boost::tuple<DigestConstPtr, std::string>
+ tuple<DigestConstPtr, std::string>
convertNameToDigestAndType (const ndn::Name &name);
void
diff --git a/nsync/sync-name-info.cc b/nsync/sync-name-info.cc
index 30986cd..3054eac 100644
--- a/nsync/sync-name-info.cc
+++ b/nsync/sync-name-info.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-name-info.h"
diff --git a/nsync/sync-name-info.h b/nsync/sync-name-info.h
index 2f7c165..0fa0b86 100644
--- a/nsync/sync-name-info.h
+++ b/nsync/sync-name-info.h
@@ -17,14 +17,14 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_NAME_INFO_H
#define SYNC_NAME_INFO_H
-#include <boost/shared_ptr.hpp>
-#include <boost/weak_ptr.hpp>
+#include "sync-common.h"
+
#include <map>
#include <string>
#include "sync-digest.h"
@@ -38,8 +38,8 @@
class NameInfo
{
private:
- typedef boost::weak_ptr<const NameInfo> const_weak_ptr;
-
+ typedef weak_ptr<const NameInfo> const_weak_ptr;
+
public:
virtual ~NameInfo () { };
@@ -75,7 +75,7 @@
*/
virtual std::string
toString () const = 0;
-
+
protected:
// actual stuff
size_t m_id; ///< @brief Identifies NameInfo throughout the library (for hash container, doesn't need to be strictly unique)
@@ -87,8 +87,8 @@
static NameMap m_names;
};
-typedef boost::shared_ptr<NameInfo> NameInfoPtr;
-typedef boost::shared_ptr<const NameInfo> NameInfoConstPtr;
+typedef shared_ptr<NameInfo> NameInfoPtr;
+typedef shared_ptr<const NameInfo> NameInfoConstPtr;
inline std::ostream &
operator << (std::ostream &os, const NameInfo &info)
diff --git a/nsync/sync-seq-no.cc b/nsync/sync-seq-no.cc
index fbbc53f..00d97ee 100644
--- a/nsync/sync-seq-no.cc
+++ b/nsync/sync-seq-no.cc
@@ -17,13 +17,10 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-seq-no.h"
-#include <boost/make_shared.hpp>
-
-using namespace boost;
namespace Sync {
diff --git a/nsync/sync-seq-no.h b/nsync/sync-seq-no.h
index bf21704..81955e2 100644
--- a/nsync/sync-seq-no.h
+++ b/nsync/sync-seq-no.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
* Yingdi Yu <yingdi@cs.ucla.edu>
*/
@@ -45,7 +45,7 @@
, m_seq (0)
{
}
-
+
/**
* @brief Copy constructor
* @param seq sequence number object to copy from
@@ -145,7 +145,7 @@
{
return m_valid;
}
-
+
/**
* @brief Get session id
*/
@@ -164,10 +164,10 @@
void
setSeq(uint64_t seq)
{ m_seq = seq; }
-
+
private:
bool m_valid;
-
+
/**
* @brief Session ID (e.g., after crash, application will choose new session ID.
*
diff --git a/nsync/sync-socket.cc b/nsync/sync-socket.cc
index 834dbee..9c5ea9f 100644
--- a/nsync/sync-socket.cc
+++ b/nsync/sync-socket.cc
@@ -23,7 +23,14 @@
#include <boost/lexical_cast.hpp>
using namespace std;
-using namespace ndn;
+
+using ndn::Data;
+using ndn::Face;
+using ndn::KeyChain;
+using ndn::Name;
+using ndn::OnDataValidated;
+using ndn::OnDataValidationFailed;
+using ndn::Validator;
INIT_LOGGER ("SyncSocket");
diff --git a/nsync/sync-socket.h b/nsync/sync-socket.h
index ef54a99..dce6fde 100644
--- a/nsync/sync-socket.h
+++ b/nsync/sync-socket.h
@@ -21,6 +21,8 @@
#ifndef _SYNC_SOCKET_H
#define _SYNC_SOCKET_H
+#include "sync-common.h"
+
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/validator.hpp>
#include <ndn-cxx/security/key-chain.hpp>
diff --git a/nsync/sync-state-leaf-container.h b/nsync/sync-state-leaf-container.h
index 48819aa..d14e635 100644
--- a/nsync/sync-state-leaf-container.h
+++ b/nsync/sync-state-leaf-container.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STATE_LEAF_CONTAINER
@@ -66,7 +66,7 @@
}
};
-/// @cond include_hidden
+/// @cond include_hidden
struct hashed { };
struct ordered { };
/// @endcond
@@ -85,7 +85,7 @@
NameInfoHash,
NameInfoEqual
>,
-
+
mi::ordered_unique<
mi::tag<ordered>,
mi::const_mem_fun<Leaf, NameInfoConstPtr, &Leaf::getInfo>,
diff --git a/nsync/sync-state.cc b/nsync/sync-state.cc
index 6c374a4..0fe12a6 100644
--- a/nsync/sync-state.cc
+++ b/nsync/sync-state.cc
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-state.h"
@@ -26,16 +26,13 @@
#include <boost/assert.hpp>
#include <boost/foreach.hpp>
-#include <boost/shared_ptr.hpp>
#include <boost/throw_exception.hpp>
#include <boost/lexical_cast.hpp>
-// using namespace std;
-using namespace boost;
-
-typedef error_info<struct tag_errmsg, std::string> info_str;
+typedef boost::error_info<struct tag_errmsg, std::string> info_str;
using namespace Sync::Error;
+using boost::lexical_cast;
namespace Sync {
@@ -44,7 +41,7 @@
operator << (std::ostream &os, const State &state)
{
os << "<state>"; DEBUG_ENDL;
-
+
BOOST_FOREACH (shared_ptr<const Leaf> leaf, state.getLeaves ().get<ordered> ())
{
shared_ptr<const DiffLeaf> diffLeaf = dynamic_pointer_cast<const DiffLeaf> (leaf);
@@ -106,7 +103,7 @@
if (doc.RootElement() == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("Empty XML"));
-
+
for (TiXmlElement *iterator = doc.RootElement()->FirstChildElement ("item");
iterator != 0;
iterator = iterator->NextSiblingElement("item"))
@@ -114,15 +111,15 @@
TiXmlElement *name = iterator->FirstChildElement ("name");
if (name == 0 || name->GetText() == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("<name> element is missing"));
-
+
NameInfoConstPtr info = StdNameInfo::FindOrCreate (name->GetText());
-
+
if (iterator->Attribute("action") == 0 || strcmp(iterator->Attribute("action"), "update") == 0)
{
TiXmlElement *seq = iterator->FirstChildElement ("seq");
if (seq == 0)
BOOST_THROW_EXCEPTION (SyncXmlDecodingFailure () << info_str ("<seq> element is missing"));
-
+
TiXmlElement *session = seq->FirstChildElement ("session");
TiXmlElement *seqno = seq->FirstChildElement ("seqno");
diff --git a/nsync/sync-state.h b/nsync/sync-state.h
index 54ac9d9..0e0e237 100644
--- a/nsync/sync-state.h
+++ b/nsync/sync-state.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STATE_H
@@ -25,7 +25,6 @@
#include "sync-state-leaf-container.h"
#include <boost/exception/all.hpp>
-#include "boost/tuple/tuple.hpp"
#include "sync-state.pb.h"
/**
@@ -38,16 +37,16 @@
/**
* \ingroup sync
* @brief this prefix will be used for the dummy node which increases its sequence number whenever
- * a remove operation happens; this is to prevent the reversion of root digest when we prune
+ * a remove operation happens; this is to prevent the reversion of root digest when we prune
* a branch, i.e. help the root digest to be forward only
- * No corresponding data msg would be published and no attempt would be made to retrieve the
+ * No corresponding data msg would be published and no attempt would be made to retrieve the
* data msg
*/
const std::string forwarderPrefix = "/d0n0t18ak/t0ps8cr8t";
class State;
-typedef boost::shared_ptr<State> StatePtr;
-typedef boost::shared_ptr<State> StateConstPtr;
+typedef shared_ptr<State> StatePtr;
+typedef shared_ptr<State> StateConstPtr;
/**
* \ingroup sync
@@ -57,14 +56,14 @@
{
public:
virtual ~State () { };
-
+
/**
* @brief Add or update leaf to the state tree
*
* @param info name of the leaf
* @param seq sequence number of the leaf
*/
- virtual boost::tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
+ virtual tuple<bool/*inserted*/, bool/*updated*/, SeqNo/*oldSeqNo*/>
update (NameInfoConstPtr info, const SeqNo &seq) = 0;
/**
@@ -78,9 +77,9 @@
* @brief Get state leaves
*/
const LeafContainer &
- getLeaves () const
+ getLeaves () const
{ return m_leaves; }
-
+
protected:
LeafContainer m_leaves;
};
diff --git a/nsync/sync-std-name-info.cc b/nsync/sync-std-name-info.cc
index 2c0313d..9f0fa0d 100644
--- a/nsync/sync-std-name-info.cc
+++ b/nsync/sync-std-name-info.cc
@@ -17,14 +17,11 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#include "sync-std-name-info.h"
-// using namespace std;
-using namespace boost;
-
namespace Sync {
@@ -32,9 +29,9 @@
StdNameInfo::FindOrCreate (const std::string &key)
{
// std::cout << "FindOrCreate: " << m_names.size () << "\n";
-
+
NameInfoConstPtr ret;
-
+
NameMap::iterator item = m_names.find (key);
if (item != m_names.end ())
{
@@ -47,7 +44,7 @@
weak_ptr<const NameInfo> value (ret);
std::pair<NameMap::iterator,bool> inserted =
m_names.insert (make_pair (key, value));
-
+
BOOST_ASSERT (inserted.second); // previous call has to insert value
item = inserted.first;
}
diff --git a/nsync/sync-std-name-info.h b/nsync/sync-std-name-info.h
index 83bbebb..2385074 100644
--- a/nsync/sync-std-name-info.h
+++ b/nsync/sync-std-name-info.h
@@ -17,7 +17,7 @@
*
* Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
* Chaoyi Bian <bcy@pku.edu.cn>
- * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ * Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
#ifndef SYNC_STD_NAME_INFO_H
@@ -42,7 +42,7 @@
* @brief Destructor which will clean up m_names structure
*/
virtual ~StdNameInfo ();
-
+
// from NameInfo
virtual bool
operator == (const NameInfo &info) const;
@@ -54,7 +54,7 @@
toString () const;
private:
- // implementing a singleton pattern.
+ // implementing a singleton pattern.
/**
* @brief Disabled default constructor. NameInfo object should be created through FindOrCreate static call.
*/
@@ -65,7 +65,7 @@
StdNameInfo () {}
StdNameInfo& operator = (const StdNameInfo &info) { (void)info; return *this; }
StdNameInfo (const std::string &name);
-
+
std::string m_name;
};