blob: df83544628337c796fbc7951a53c6ff89debb213 [file] [log] [blame]
#include <iostream>
#include <list>
#include <ndn-cpp-dev/face.hpp>
#include "nlsr_wle.hpp"
namespace nlsr
{
static bool
waiteeCompare(std::string& w1, std::string& w2)
{
return w1 == w2 ;
}
bool
WaitingListEntry::addWaitee(std::string waiteeName)
{
std::list<std::string>::iterator it = std::find_if( waitingCerts.begin(),
waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
if( it == waitingCerts.end() )
{
waitingCerts.push_back(waiteeName);
return true;
}
return false;
}
std::ostream&
operator<<(std::ostream& os, const WaitingListEntry& we)
{
os<<"-------------Wiating List Entry-------------"<<std::endl;
os<<"Responsible Certificate: "<<we.getResponsibleCert()<<std::endl;
std::list<std::string> waitee=we.getWaitingCerts();
int i=1;
for(std::list<std::string>::iterator it=waitee.begin();
it!=waitee.end(); ++i, ++it)
{
os<<"Waite "<<i<<": "<<*(it)<<std::endl;
}
return os;
}
}