32 int32_t mappingNo =
static_cast<int32_t
>(m_bimap.size());
33 m_bimap.by<ndn::Name>().insert({rtrName, mappingNo});
36 std::optional<ndn::Name>
39 auto it = m_bimap.by<MappingNo>().find(mn);
40 if (it == m_bimap.by<MappingNo>().end()) {
43 return it->get<ndn::Name>();
46 std::optional<int32_t>
49 auto it = m_bimap.by<ndn::Name>().find(rtrName);
50 if (it == m_bimap.by<ndn::Name>().end()) {
53 return it->get<MappingNo>();
59 os <<
"---------------NameMap---------------";
60 for (
const auto& entry :
map.m_bimap) {
61 os <<
"\nMapEntry: ( Router: " << entry.get<ndn::Name>()
62 <<
" Mapping No: " << entry.get<NameMap::MappingNo>() <<
" )";
Assigning numbers to router names.
std::optional< ndn::Name > getRouterNameByMappingNo(int32_t mn) const
Find router name by its mapping number.
std::optional< int32_t > getMappingNoByRouterName(const ndn::Name &rtrName) const
Find mapping number of a router name.
void addEntry(const ndn::Name &rtrName)
Insert a router name.
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)