add function to return all branch prefixes

This commit is contained in:
Zhenkai Zhu committed 2012-10-09 12:01:19 -07:00
1 parent 7f68029294
commit d5aec4ba14
2 files changed
+23

No files matched your search

+4
View File
@@ -27,6 +27,7 @@
#include <boost/thread/recursive_mutex.hpp>
#include <boost/random.hpp>
#include <memory>
#include <map>
#include "sync-ccnx-wrapper.h"
#include "sync-interest-table.h"
@@ -126,6 +127,9 @@ public:
void
printState () const;
std::map<std::string, bool>
getBranchPrefixes() const;
private:
void
delayedChecksLoop ();
+19
View File
@@ -601,5 +601,24 @@ SyncLogic::printState () const
}
}
std::map<std::string, bool>
SyncLogic::getBranchPrefixes() const
{
recursive_mutex::scoped_lock lock (m_stateMutex);
std::map<std::string, bool> m;
BOOST_FOREACH (const boost::shared_ptr<Sync::Leaf> leaf, m_state->getLeaves ())
{
std::string prefix = leaf->getInfo()->toString();
// do not return forwarder prefix
if (prefix != forwarderPrefix)
{
m.insert(pair<std::string, bool>(prefix, false));
}
}
return m;
}
}