21 #ifndef NLSR_NAME_MAP_HPP
22 #define NLSR_NAME_MAP_HPP
27 #include <boost/bimap.hpp>
28 #include <boost/bimap/unordered_set_of.hpp>
29 #include <boost/concept_check.hpp>
56 template<
typename IteratorType>
60 BOOST_CONCEPT_ASSERT((boost::InputIterator<IteratorType>));
62 for (
auto it = first; it != last; ++it) {
64 auto lsa =
static_cast<const AdjLsa*
>(it->get());
65 map.addEntry(lsa->getOriginRouter());
66 for (
const auto& adjacent : lsa->getAdl().getAdjList()) {
67 map.addEntry(adjacent.getName());
80 template<
typename IteratorType>
84 BOOST_CONCEPT_ASSERT((boost::InputIterator<IteratorType>));
86 for (
auto it = first; it != last; ++it) {
87 map.addEntry((*it)->getOriginRouter());
104 std::optional<ndn::Name>
112 std::optional<int32_t>
122 return m_bimap.size();
128 boost::bimaps::unordered_set_of<
129 boost::bimaps::tagged<ndn::Name, ndn::Name>,
132 boost::bimaps::unordered_set_of<
133 boost::bimaps::tagged<int32_t, MappingNo>
Represents an LSA of adjacencies of the origin router in link-state mode.
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.
size_t size() const
Return number of entries in this container.
friend std::ostream & operator<<(std::ostream &os, const NameMap &map)
static NameMap createFromCoordinateLsdb(IteratorType first, IteratorType last)
Create a NameMap populated with router names in Coordinate LSAs.
static NameMap createFromAdjLsdb(IteratorType first, IteratorType last)
Create a NameMap populated with router names in Adjacency LSAs.
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
std::ostream & operator<<(std::ostream &os, const Adjacent &adjacent)