test for name and ccnx-wrapper
diff --git a/src/ccnx-name.cpp b/src/ccnx-name.cpp
index ce5f270..748410f 100644
--- a/src/ccnx-name.cpp
+++ b/src/ccnx-name.cpp
@@ -37,8 +37,15 @@
{
stringstream ss(name);
string compStr;
+ bool first = true;
while(getline(ss, compStr, '/'))
{
+ // discard the first empty comp before the first '/'
+ if (first)
+ {
+ first = false;
+ continue;
+ }
Bytes comp(compStr.begin(), compStr.end());
m_comps.push_back(comp);
}
@@ -74,13 +81,13 @@
return *this;
}
bool
-Name::operator==(const string &str)
+Name::operator==(const string &str) const
{
return this->toString() == str;
}
bool
-Name::operator!=(const string &str)
+Name::operator!=(const string &str) const
{
return !(*this == str);
}
diff --git a/src/ccnx-wrapper.cpp b/src/ccnx-wrapper.cpp
index ac65cba..78e9ac7 100644
--- a/src/ccnx-wrapper.cpp
+++ b/src/ccnx-wrapper.cpp
@@ -49,10 +49,10 @@
CcnxWrapper::connectCcnd()
{
UniqueRecLock(m_mutex);
- if (m_handle != 0) {
- ccn_disconnect (m_handle);
- ccn_destroy (&m_handle);
- }
+ //if (m_handle != 0) {
+ //ccn_disconnect (m_handle);
+ //ccn_destroy (&m_handle);
+ //}
m_handle = ccn_create ();
if (ccn_connect(m_handle, NULL) < 0)
@@ -61,14 +61,14 @@
}
m_connected = true;
- if (!m_registeredInterests.empty())
- {
- for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
- {
+ //if (!m_registeredInterests.empty())
+ //{
+ // for (map<Name, InterestCallback>::const_iterator it = m_registeredInterests.begin(); it != m_registeredInterests.end(); ++it)
+ //{
// clearInterestFilter(it->first);
- setInterestFilter(it->first, it->second);
- }
- }
+ // setInterestFilter(it->first, it->second);
+ //}
+ //}
}
CcnxWrapper::~CcnxWrapper()