nlsr::NamePrefixList Class Reference

#include <name-prefix-list.hpp>

Public Types

using NamePair = std::tuple< ndn::Name, std::vector< std::string > >
 
enum  NamePairIndex {
  NAME ,
  SOURCES
}
 

Public Member Functions

 NamePrefixList ()
 
 NamePrefixList (ndn::span< const ndn::Name > names)
 
void clear ()
 
uint32_t countSources (const ndn::Name &name) const
 
std::list< ndn::Name > getNames () const
 
const std::vector< std::string > getSources (const ndn::Name &name) const
 
bool insert (const ndn::Name &name, const std::string &source="")
 inserts name into NamePrefixList More...
 
bool operator== (const NamePrefixList &other) const
 
bool remove (const ndn::Name &name, const std::string &source="")
 removes name from NamePrefixList More...
 
size_t size () const
 
void sort ()
 

Detailed Description

Definition at line 37 of file name-prefix-list.hpp.

Member Typedef Documentation

◆ NamePair

using nlsr::NamePrefixList::NamePair = std::tuple<ndn::Name, std::vector<std::string> >

Definition at line 40 of file name-prefix-list.hpp.

Member Enumeration Documentation

◆ NamePairIndex

Enumerator
NAME 
SOURCES 

Definition at line 42 of file name-prefix-list.hpp.

Constructor & Destructor Documentation

◆ NamePrefixList() [1/2]

nlsr::NamePrefixList::NamePrefixList ( )
default

◆ NamePrefixList() [2/2]

nlsr::NamePrefixList::NamePrefixList ( ndn::span< const ndn::Name >  names)
explicit

Definition at line 29 of file name-prefix-list.cpp.

Member Function Documentation

◆ clear()

void nlsr::NamePrefixList::clear ( )
inline

Definition at line 109 of file name-prefix-list.hpp.

◆ countSources()

uint32_t nlsr::NamePrefixList::countSources ( const ndn::Name &  name) const

Returns how many unique sources this name has.

Return values
0if the name is not in the list, else the number of sources.

Definition at line 115 of file name-prefix-list.cpp.

◆ getNames()

std::list< ndn::Name > nlsr::NamePrefixList::getNames ( ) const

Definition at line 105 of file name-prefix-list.cpp.

◆ getSources()

const std::vector< std::string > nlsr::NamePrefixList::getSources ( const ndn::Name &  name) const

Returns the sources that this name has.

Return values
anempty vector if the name is not in the list, else a vector containing the sources.

Definition at line 121 of file name-prefix-list.cpp.

◆ insert()

bool nlsr::NamePrefixList::insert ( const ndn::Name &  name,
const std::string &  source = "" 
)

inserts name into NamePrefixList

Return values
trueIf the name was successfully inserted.
falseIf the name could not be inserted.

Definition at line 55 of file name-prefix-list.cpp.

◆ operator==()

bool nlsr::NamePrefixList::operator== ( const NamePrefixList other) const

Definition at line 93 of file name-prefix-list.cpp.

◆ remove()

bool nlsr::NamePrefixList::remove ( const ndn::Name &  name,
const std::string &  source = "" 
)

removes name from NamePrefixList

Return values
trueIf the name is removed
falseIf the name failed to be removed.

Definition at line 75 of file name-prefix-list.cpp.

◆ size()

size_t nlsr::NamePrefixList::size ( ) const
inline

Definition at line 82 of file name-prefix-list.hpp.

◆ sort()

void nlsr::NamePrefixList::sort ( )

Definition at line 99 of file name-prefix-list.cpp.