blob: df83544628337c796fbc7951a53c6ff89debb213 [file] [log] [blame]
akmhoquefa8ee9b2014-03-14 09:06:24 -05001#include <iostream>
2#include <list>
3#include <ndn-cpp-dev/face.hpp>
4#include "nlsr_wle.hpp"
5
6namespace nlsr
7{
8 static bool
9 waiteeCompare(std::string& w1, std::string& w2)
10 {
11 return w1 == w2 ;
12 }
13
14 bool
15 WaitingListEntry::addWaitee(std::string waiteeName)
16 {
17 std::list<std::string>::iterator it = std::find_if( waitingCerts.begin(),
18 waitingCerts.end(),ndn::bind(&waiteeCompare, _1, waiteeName));
19 if( it == waitingCerts.end() )
20 {
21 waitingCerts.push_back(waiteeName);
22 return true;
23 }
24
25 return false;
26 }
27
28 std::ostream&
29 operator<<(std::ostream& os, const WaitingListEntry& we)
30 {
31 os<<"-------------Wiating List Entry-------------"<<std::endl;
32 os<<"Responsible Certificate: "<<we.getResponsibleCert()<<std::endl;
33 std::list<std::string> waitee=we.getWaitingCerts();
34 int i=1;
35 for(std::list<std::string>::iterator it=waitee.begin();
36 it!=waitee.end(); ++i, ++it)
37 {
38 os<<"Waite "<<i<<": "<<*(it)<<std::endl;
39 }
40 return os;
41 }
42}