Assigning numbers to router names. More...
#include <name-map.hpp>
Public Member Functions | |
void | addEntry (const ndn::Name &rtrName) |
Insert a router name. More... | |
std::optional< int32_t > | getMappingNoByRouterName (const ndn::Name &rtrName) const |
Find mapping number of a router name. More... | |
std::optional< ndn::Name > | getRouterNameByMappingNo (int32_t mn) const |
Find router name by its mapping number. More... | |
size_t | size () const |
Return number of entries in this container. More... | |
Static Public Member Functions | |
template<typename IteratorType > | |
static NameMap | createFromAdjLsdb (IteratorType first, IteratorType last) |
Create a NameMap populated with router names in Adjacency LSAs. More... | |
template<typename IteratorType > | |
static NameMap | createFromCoordinateLsdb (IteratorType first, IteratorType last) |
Create a NameMap populated with router names in Coordinate LSAs. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NameMap &map) |
Assigning numbers to router names.
NameMap assigns a "mapping number" to each inserted router name. It then provides bidirectional lookups between router names and their mapping numbers.
These numbers are non-negative integers assigned sequentially, starting from zero. They can support constructing a matrix of routers, where the mapping numbers are used as row and column indices in place of router names.
Definition at line 45 of file name-map.hpp.
void nlsr::NameMap::addEntry | ( | const ndn::Name & | rtrName | ) |
|
inlinestatic |
Create a NameMap populated with router names in Adjacency LSAs.
IteratorType | A LegacyInputIterator whose value type is convertible to std::shared_ptr<AdjLsa> . |
first | Range begin iterator. |
last | Range past-end iterator. It must be reachable by incrementing first . |
Definition at line 58 of file name-map.hpp.
|
inlinestatic |
Create a NameMap populated with router names in Coordinate LSAs.
IteratorType | A LegacyInputIterator whose value type is std::shared_ptr<Lsa> . |
first | Range begin iterator. |
last | Range past-end iterator. It must be reachable by incrementing first . |
Definition at line 82 of file name-map.hpp.
std::optional< int32_t > nlsr::NameMap::getMappingNoByRouterName | ( | const ndn::Name & | rtrName | ) | const |
Find mapping number of a router name.
rtrName | Router name. |
std::nullopt
if it does not exist. Definition at line 47 of file name-map.cpp.
std::optional< ndn::Name > nlsr::NameMap::getRouterNameByMappingNo | ( | int32_t | mn | ) | const |
Find router name by its mapping number.
mn | Mapping number. |
std::nullopt
if it does not exist. Definition at line 37 of file name-map.cpp.
|
inline |
Return number of entries in this container.
Definition at line 120 of file name-map.hpp.
|
friend |
Definition at line 56 of file name-map.cpp.