namespace: resolve conflict of ndn and std
diff --git a/src/sync-digest.cc b/src/sync-digest.cc
index 6f41d3d..19ec240 100644
--- a/src/sync-digest.cc
+++ b/src/sync-digest.cc
@@ -41,7 +41,6 @@
using namespace boost;
using namespace boost::archive::iterators;
-using namespace std;
// Other options: VP_md2, EVP_md5, EVP_sha, EVP_sha1, EVP_sha256, EVP_dss, EVP_dss1, EVP_mdc2, EVP_ripemd160
#define HASH_FUNCTION EVP_sha256
@@ -95,7 +94,7 @@
}
};
-typedef transform_width<transform_iterator<hex_to_4_bit<string::const_iterator::value_type>, string::const_iterator>, 8, 4> string_to_binary;
+typedef transform_width<transform_iterator<hex_to_4_bit<std::string::const_iterator::value_type>, std::string::const_iterator>, 8, 4> string_to_binary;
namespace Sync {
@@ -224,7 +223,7 @@
{
BOOST_ASSERT (!digest.m_buffer.empty ());
- ostreambuf_iterator<char> out_it (os); // ostream iterator
+ std::ostreambuf_iterator<char> out_it (os); // ostream iterator
// need to encode to base64
copy (string_from_binary (digest.m_buffer.begin ()),
string_from_binary (digest.m_buffer.end ()),
@@ -236,7 +235,7 @@
std::istream &
operator >> (std::istream &is, Digest &digest)
{
- string str;
+ std::string str;
is >> str; // read string first
if (str.size () == 0)
diff --git a/src/sync-interest-table.cc b/src/sync-interest-table.cc
index 415b641..fc1d3bf 100644
--- a/src/sync-interest-table.cc
+++ b/src/sync-interest-table.cc
@@ -22,7 +22,6 @@
#include "sync-interest-table.h"
#include "sync-logging.h"
-using namespace std;
INIT_LOGGER ("SyncInterestTable");
@@ -54,7 +53,7 @@
}
bool
-SyncInterestTable::insert (DigestConstPtr digest, const string &name, bool unknownState/*=false*/)
+SyncInterestTable::insert (DigestConstPtr digest, const std::string& name, bool unknownState/*=false*/)
{
bool existent = false;
@@ -76,7 +75,7 @@
}
bool
-SyncInterestTable::remove (const string &name)
+SyncInterestTable::remove (const std::string& name)
{
InterestContainer::index<named>::type::iterator item = m_table.get<named> ().find (name);
if (item != m_table.get<named> ().end ())
diff --git a/src/sync-logic.cc b/src/sync-logic.cc
index 617830b..56692e5 100644
--- a/src/sync-logic.cc
+++ b/src/sync-logic.cc
@@ -31,7 +31,6 @@
#include <boost/lexical_cast.hpp>
#include <vector>
-using namespace std;
using namespace ndn;
INIT_LOGGER ("SyncLogic");
@@ -89,7 +88,7 @@
m_reexpressingInterestId = m_scheduler.scheduleEvent (time::seconds (0), // no need to add jitter
bind (&SyncLogic::sendSyncInterest, this));
- m_instanceId = string("Instance " + boost::lexical_cast<string>(m_instanceCounter++) + " ");
+ m_instanceId = std::string("Instance " + boost::lexical_cast<std::string>(m_instanceCounter++) + " ");
}
SyncLogic::SyncLogic (const Name& syncPrefix,
@@ -141,8 +140,8 @@
BOOST_ASSERT (nameLengthDiff > 0);
BOOST_ASSERT (nameLengthDiff < 3);
- string hash = name.get(-1).toEscapedString();
- string interestType;
+ std::string hash = name.get(-1).toEscapedString();
+ std::string interestType;
if(nameLengthDiff == 1)
interestType = "normal";
@@ -152,7 +151,7 @@
_LOG_DEBUG_ID (hash << ", " << interestType);
DigestPtr digest = boost::make_shared<Digest> ();
- istringstream is (hash);
+ std::istringstream is (hash);
is >> *digest;
return make_tuple (digest, interestType);
@@ -174,7 +173,7 @@
return;
DigestConstPtr digest;
- string type;
+ std::string type;
tie (digest, type) = convertNameToDigestAndType (name);
if (type == "normal") // kind of ineffective...
@@ -195,7 +194,7 @@
}
void
-SyncLogic::onSyncRegisterFailed(const Name& prefix, const string& msg)
+SyncLogic::onSyncRegisterFailed(const Name& prefix, const std::string& msg)
{
_LOG_DEBUG_ID("Sync prefix registration failed! " << msg);
}
@@ -232,7 +231,7 @@
_LOG_DEBUG_ID ("<< D " << name);
DigestConstPtr digest;
- string type;
+ std::string type;
tie (digest, type) = convertNameToDigestAndType (name);
if (type == "normal")
@@ -338,7 +337,7 @@
}
msg >> diff;
- vector<MissingDataInfo> v;
+ std::vector<MissingDataInfo> v;
BOOST_FOREACH (LeafConstPtr leaf, diff.getLeaves().get<ordered>())
{
DiffLeafConstPtr diffLeaf = boost::dynamic_pointer_cast<const DiffLeaf> (leaf);
@@ -372,15 +371,15 @@
{
MissingDataInfo mdi = {info->toString(), oldSeq, seq};
{
- ostringstream interestName;
+ std::ostringstream interestName;
interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
_LOG_DEBUG_ID("+++++++++++++++ " + interestName.str());
}
if (m_perBranch)
{
- ostringstream interestName;
- interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
- m_onUpdateBranch(interestName.str());
+ std::ostringstream interestName;
+ interestName << mdi.prefix << "/" << mdi.high.getSession() << "/" << mdi.high.getSeq();
+ m_onUpdateBranch(interestName.str());
}
else
{
@@ -575,7 +574,7 @@
{
m_outstandingInterestName = m_syncPrefix;
- ostringstream os;
+ std::ostringstream os;
os << *m_state->getDigest();
m_outstandingInterestName.append(os.str());
_LOG_DEBUG_ID (">> I " << m_outstandingInterestName);
@@ -599,7 +598,7 @@
void
SyncLogic::sendSyncRecoveryInterests (DigestConstPtr digest)
{
- ostringstream os;
+ std::ostringstream os;
os << *digest;
Name interestName = m_syncPrefix;
@@ -670,10 +669,10 @@
}
}
-string
+std::string
SyncLogic::getRootDigest()
{
- ostringstream os;
+ std::ostringstream os;
os << *m_state->getDigest();
return os.str();
}
@@ -704,7 +703,7 @@
// do not return forwarder prefix
if (prefix != forwarderPrefix)
{
- m.insert(pair<std::string, bool>(prefix, false));
+ m.insert(std::pair<std::string, bool>(prefix, false));
}
}
diff --git a/src/sync-socket.cc b/src/sync-socket.cc
index 9c31f79..f5e378f 100644
--- a/src/sync-socket.cc
+++ b/src/sync-socket.cc
@@ -21,7 +21,6 @@
#include "sync-socket.h"
#include "sync-logging.h"
-using namespace std;
using namespace ndn;
INIT_LOGGER ("SyncSocket");
@@ -107,8 +106,8 @@
Name dataName;
dataName.append(m_dataPrefix)
- .append(boost::lexical_cast<string>(m_dataSession))
- .append(boost::lexical_cast<string>(sequence));
+ .append(boost::lexical_cast<std::string>(m_dataSession))
+ .append(boost::lexical_cast<std::string>(sequence));
if(isCert)
dataName.append("INTRO-CERT");
data->setName(dataName);
@@ -118,8 +117,8 @@
{
Name wrappedName;
wrappedName.append(m_routableDataPrefix)
- .append(boost::lexical_cast<string>(m_dataSession))
- .append(boost::lexical_cast<string>(sequence));
+ .append(boost::lexical_cast<std::string>(m_dataSession))
+ .append(boost::lexical_cast<std::string>(sequence));
Data wrappedData(wrappedName);
wrappedData.setContent(data->wireEncode());
@@ -141,7 +140,7 @@
SyncSocket::fetchData(const Name& prefix, const SeqNo& seq, const OnDataValidated& dataCallback, int retry)
{
Name interestName = prefix;
- interestName.append(boost::lexical_cast<string>(seq.getSession())).append(boost::lexical_cast<string>(seq.getSeq()));
+ interestName.append(boost::lexical_cast<std::string>(seq.getSession())).append(boost::lexical_cast<std::string>(seq.getSeq()));
ndn::Interest interest(interestName);
interest.setMustBeFresh(true);
diff --git a/src/sync-validator.cc b/src/sync-validator.cc
index e1d40d8..f2c05bb 100644
--- a/src/sync-validator.cc
+++ b/src/sync-validator.cc
@@ -14,12 +14,13 @@
#include <queue>
using namespace ndn;
-using namespace std;
INIT_LOGGER ("SyncValidator");
namespace Sync {
+using ndn::shared_ptr;
+
const shared_ptr<CertificateCache> SyncValidator::DefaultCertificateCache = shared_ptr<CertificateCache>();
const shared_ptr<SecRuleRelative> SyncValidator::DefaultDataRule = shared_ptr<SecRuleRelative>();
@@ -56,7 +57,7 @@
void
SyncValidator::deriveTrustNodes()
{
- queue<Name> nodeQueue;
+ std::queue<Name> nodeQueue;
// Clear existing trust nodes.
m_trustedNodes.clear();
@@ -151,7 +152,7 @@
catch(SignatureSha256WithRsa::Error& e)
{
return onValidationFailed(data.shared_from_this(),
- "Not SignatureSha256WithRsa signature: " + string(e.what()));
+ "Not SignatureSha256WithRsa signature: " + std::string(e.what()));
}
catch(KeyLocator::Error& e)
{
@@ -194,13 +195,13 @@
catch(IntroCertificate::Error& e)
{
return onValidationFailed(data,
- "Intro cert decoding error: " + string(e.what()));
+ "Intro cert decoding error: " + std::string(e.what()));
}
}
void
SyncValidator::onCertificateValidationFailed(const shared_ptr<const Data>& signCertificate,
- const string& failureInfo,
+ const std::string& failureInfo,
const shared_ptr<const Data>& data,
const OnDataValidationFailed& onValidationFailed)
{
@@ -223,7 +224,7 @@
}
void
-SyncValidator::onCertRegisterFailed(const Name& prefix, const string& msg)
+SyncValidator::onCertRegisterFailed(const Name& prefix, const std::string& msg)
{
_LOG_DEBUG("SyncValidator::onCertRegisterFailed: " << msg);
}