blob: 251c64734c45ee86313efccc399d9d5d14a42dcd [file] [log] [blame]
akmhoque87347a32014-01-31 11:00:44 -06001#include<iostream>
2#include<algorithm>
3
akmhoque204e7542014-01-31 16:08:25 -06004#include "nlsr_npl.hpp"
akmhoque87347a32014-01-31 11:00:44 -06005
6using namespace std;
7
8Npl::Npl(){
9
10}
11
12Npl::~Npl(){
13
14}
15
16static bool
17nameCompare(string& s1, string& s2){
18 return s1==s2;
19}
20
21int
22Npl::insertIntoNpl(string& name){
23 std::list<string >::iterator it = std::find_if( nameList.begin(),
24 nameList.end(),
25 bind(&nameCompare, _1 , name));
26
27 if( it != nameList.end() ){
28 return -1;
29 }
30
31 nameList.push_back(name);
32 return 0;
33
34}
35
36void
37Npl::printNpl(){
akmhoquebd7c8e62014-02-01 14:57:40 -060038 int i=1;
akmhoque87347a32014-01-31 11:00:44 -060039 for( std::list<string>::iterator it=nameList.begin(); it != nameList.end(); it++){
akmhoquebd7c8e62014-02-01 14:57:40 -060040 cout<<"Name "<<i<<" : "<<(*it)<<endl;
41 i++;
akmhoque87347a32014-01-31 11:00:44 -060042 }
43}