blob: 49b724e2373870b7d5d391a536fa2d035d846b13 [file] [log] [blame]
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
Alexander Afanasyevad3757f2012-04-17 10:27:59 -07004 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08005 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
Alexander Afanasyevad3757f2012-04-17 10:27:59 -07007 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08008 * ndnSIM is free software: you can redistribute it and/or modify it under the terms
9 * of the GNU General Public License as published by the Free Software Foundation,
10 * either version 3 of the License, or (at your option) any later version.
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070011 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080012 * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070015 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080016 * You should have received a copy of the GNU General Public License along with
17 * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18 **/
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070019
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070020#ifndef BOOST_GRAPH_NDN_GLOBAL_ROUTING_HELPER_H
21#define BOOST_GRAPH_NDN_GLOBAL_ROUTING_HELPER_H
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070022
Alexander Afanasyev6315ef72012-06-01 20:56:31 -070023/// @cond include_hidden
24
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070025#include "ns3/ndnSIM/model/ndn-common.hpp"
26
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070027#include <boost/graph/graph_traits.hpp>
28#include <boost/graph/properties.hpp>
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -070029#include <boost/ref.hpp>
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070030
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -080031#include "ns3/ndnSIM/model/ndn-global-router.hpp"
32
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070033#include "ns3/node-list.h"
34#include "ns3/channel-list.h"
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -080035
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070036#include <list>
37#include <map>
38
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039namespace boost {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070040
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080041class NdnGlobalRouterGraph {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070042public:
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080043 typedef ns3::Ptr<ns3::ndn::GlobalRouter> Vertice;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070044 typedef uint16_t edge_property_type;
45 typedef uint32_t vertex_property_type;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070046
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080047 NdnGlobalRouterGraph()
48 {
49 for (ns3::NodeList::Iterator node = ns3::NodeList::Begin(); node != ns3::NodeList::End();
50 node++) {
51 ns3::Ptr<ns3::ndn::GlobalRouter> gr = (*node)->GetObject<ns3::ndn::GlobalRouter>();
52 if (gr != 0)
53 m_vertices.push_back(gr);
54 }
55
56 for (ns3::ChannelList::Iterator channel = ns3::ChannelList::Begin();
57 channel != ns3::ChannelList::End(); channel++) {
58 ns3::Ptr<ns3::ndn::GlobalRouter> gr = (*channel)->GetObject<ns3::ndn::GlobalRouter>();
59 if (gr != 0)
60 m_vertices.push_back(gr);
61 }
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070062 }
63
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080064 const std::list<Vertice>&
65 GetVertices() const
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070066 {
67 return m_vertices;
68 }
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080069
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070070public:
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080071 std::list<Vertice> m_vertices;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070072};
73
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080074class ndn_global_router_graph_category : public virtual vertex_list_graph_tag,
75 public virtual incidence_graph_tag {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070076};
77
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070078template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080079struct graph_traits<NdnGlobalRouterGraph> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070080 // Graph concept
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070081 typedef NdnGlobalRouterGraph::Vertice vertex_descriptor;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070082 typedef ns3::ndn::GlobalRouter::Incidency edge_descriptor;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070083 typedef directed_tag directed_category;
84 typedef disallow_parallel_edge_tag edge_parallel_category;
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070085 typedef ndn_global_router_graph_category traversal_category;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070086
87 // VertexList concept
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080088 typedef std::list<vertex_descriptor>::const_iterator vertex_iterator;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070089 typedef size_t vertices_size_type;
90
91 // AdjacencyGraph concept
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070092 typedef ns3::ndn::GlobalRouter::IncidencyList::iterator out_edge_iterator;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -070093 typedef size_t degree_size_type;
94
95 // typedef size_t edges_size_type;
96};
97
98} // namespace boost
99
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800100namespace boost {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700101
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800102inline graph_traits<NdnGlobalRouterGraph>::vertex_descriptor
103source(graph_traits<NdnGlobalRouterGraph>::edge_descriptor e, const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700104{
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800105 return std::get<0>(e);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700106}
107
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800108inline graph_traits<NdnGlobalRouterGraph>::vertex_descriptor
109target(graph_traits<NdnGlobalRouterGraph>::edge_descriptor e, const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700110{
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800111 return std::get<2>(e);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700112}
113
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800114inline std::pair<graph_traits<NdnGlobalRouterGraph>::vertex_iterator,
115 graph_traits<NdnGlobalRouterGraph>::vertex_iterator>
116vertices(const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700117{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800118 return make_pair(g.GetVertices().begin(), g.GetVertices().end());
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700119}
120
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800121inline graph_traits<NdnGlobalRouterGraph>::vertices_size_type
122num_vertices(const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700123{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800124 return g.GetVertices().size();
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700125}
126
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800127inline std::pair<graph_traits<NdnGlobalRouterGraph>::out_edge_iterator,
128 graph_traits<NdnGlobalRouterGraph>::out_edge_iterator>
129out_edges(graph_traits<NdnGlobalRouterGraph>::vertex_descriptor u, const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700130{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800131 return std::make_pair(u->GetIncidencies().begin(), u->GetIncidencies().end());
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700132}
133
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800134inline graph_traits<NdnGlobalRouterGraph>::degree_size_type
135out_degree(graph_traits<NdnGlobalRouterGraph>::vertex_descriptor u, const NdnGlobalRouterGraph& g)
136{
137 return u->GetIncidencies().size();
138}
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700139
140//////////////////////////////////////////////////////////////
141// Property maps
142
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800143struct EdgeWeights {
144 EdgeWeights(const NdnGlobalRouterGraph& graph)
145 : m_graph(graph)
146 {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700147 }
148
149private:
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800150 const NdnGlobalRouterGraph& m_graph;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700151};
152
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800153struct VertexIds {
154 VertexIds(const NdnGlobalRouterGraph& graph)
155 : m_graph(graph)
156 {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700157 }
158
159private:
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800160 const NdnGlobalRouterGraph& m_graph;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700161};
162
163template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800164struct property_map<NdnGlobalRouterGraph, edge_weight_t> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700165 typedef const EdgeWeights const_type;
166 typedef EdgeWeights type;
167};
168
169template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800170struct property_map<NdnGlobalRouterGraph, vertex_index_t> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700171 typedef const VertexIds const_type;
172 typedef VertexIds type;
173};
174
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700175template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800176struct property_traits<EdgeWeights> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700177 // Metric property map
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800178 typedef std::tuple<std::shared_ptr<nfd::Face>, uint16_t, double> value_type;
179 typedef std::tuple<std::shared_ptr<nfd::Face>, uint16_t, double> reference;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700180 typedef ns3::ndn::GlobalRouter::Incidency key_type;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700181 typedef readable_property_map_tag category;
182};
183
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000184const property_traits<EdgeWeights>::value_type WeightZero(nullptr, 0, 0.0);
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800185const property_traits<EdgeWeights>::value_type
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000186 WeightInf(nullptr, std::numeric_limits<uint16_t>::max(), 0.0);
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700187
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800188struct WeightCompare : public std::binary_function<property_traits<EdgeWeights>::reference,
189 property_traits<EdgeWeights>::reference, bool> {
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700190 bool
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800191 operator()(std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> a,
192 std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> b) const
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700193 {
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800194 return std::get<1>(a) < std::get<1>(b);
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700195 }
196
197 bool
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800198 operator()(property_traits<EdgeWeights>::reference a, uint32_t b) const
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700199 {
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800200 return std::get<1>(a) < b;
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700201 }
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800202
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700203 bool
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800204 operator()(uint32_t a, uint32_t b) const
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700205 {
206 return a < b;
207 }
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700208};
209
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800210struct WeightCombine
211 : public std::binary_function<uint32_t, property_traits<EdgeWeights>::reference, uint32_t> {
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700212 uint32_t
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800213 operator()(uint32_t a, property_traits<EdgeWeights>::reference b) const
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700214 {
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800215 return a + std::get<1>(b);
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700216 }
217
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800218 std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>
219 operator()(std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> a,
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800220 property_traits<EdgeWeights>::reference b) const
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700221 {
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000222 if (std::get<0>(a) == nullptr)
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800223 return std::make_tuple(std::get<0>(b), std::get<1>(a) + std::get<1>(b),
224 std::get<2>(a) + std::get<2>(b));
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700225 else
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800226 return std::make_tuple(std::get<0>(a), std::get<1>(a) + std::get<1>(b),
227 std::get<2>(a) + std::get<2>(b));
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700228 }
229};
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800230
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700231template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800232struct property_traits<VertexIds> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700233 // Metric property map
234 typedef uint32_t value_type;
235 typedef uint32_t reference;
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800236 typedef ns3::Ptr<ns3::ndn::GlobalRouter> key_type;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700237 typedef readable_property_map_tag category;
238};
239
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700240inline EdgeWeights
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800241get(edge_weight_t, const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700242{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800243 return EdgeWeights(g);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700244}
245
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700246inline VertexIds
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800247get(vertex_index_t, const NdnGlobalRouterGraph& g)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700248{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800249 return VertexIds(g);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700250}
251
Alexander Afanasyeva5abcd92012-04-17 13:34:43 -0700252template<class M, class K, class V>
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700253inline void
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800254put(reference_wrapper<M> mapp, K a, V p)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700255{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800256 mapp.get()[a] = p;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700257}
258
259// void
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -0700260// put (cref< std::map< ns3::Ptr<ns3::ndn::GlobalRouter>, ns3::Ptr<ns3::ndn::GlobalRouter> > > map,
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700261
Alexander Afanasyevb2a11fe2012-12-12 11:38:39 -0800262inline uint32_t
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800263get(const boost::VertexIds&, ns3::Ptr<ns3::ndn::GlobalRouter>& gr)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700264{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800265 return gr->GetId();
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700266}
267
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800268inline property_traits<EdgeWeights>::reference
269get(const boost::EdgeWeights&, ns3::ndn::GlobalRouter::Incidency& edge)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700270{
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800271 if (std::get<1>(edge) == 0)
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000272 return property_traits<EdgeWeights>::reference(nullptr, 0, 0.0);
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800273 else {
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800274 return property_traits<EdgeWeights>::reference(std::get<1>(edge),
275 static_cast<uint16_t>(
276 std::get<1>(edge)->getMetric()),
277 0.0);
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800278 }
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700279}
280
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800281struct PredecessorsMap
282 : public std::map<ns3::Ptr<ns3::ndn::GlobalRouter>, ns3::Ptr<ns3::ndn::GlobalRouter>> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700283};
284
285template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800286struct property_traits<reference_wrapper<PredecessorsMap>> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700287 // Metric property map
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800288 typedef ns3::Ptr<ns3::ndn::GlobalRouter> value_type;
289 typedef ns3::Ptr<ns3::ndn::GlobalRouter> reference;
290 typedef ns3::Ptr<ns3::ndn::GlobalRouter> key_type;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700291 typedef read_write_property_map_tag category;
292};
293
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800294struct DistancesMap : public std::map<ns3::Ptr<ns3::ndn::GlobalRouter>,
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800295 std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700296};
297
298template<>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800299struct property_traits<reference_wrapper<DistancesMap>> {
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700300 // Metric property map
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800301 typedef std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> value_type;
302 typedef std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> reference;
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800303 typedef ns3::Ptr<ns3::ndn::GlobalRouter> key_type;
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700304 typedef read_write_property_map_tag category;
305};
306
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000307} // boost
308
309namespace std {
310template<>
311class numeric_limits<std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>>
312{
313public:
314 typedef std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double> value;
315 static value
316 max()
317 {
318 return boost::WeightInf;
319 }
320};
321}
322
323namespace boost {
324
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800325inline std::tuple<std::shared_ptr<nfd::Face>, uint32_t, double>
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800326get(DistancesMap& map, ns3::Ptr<ns3::ndn::GlobalRouter> key)
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700327{
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -0800328 boost::DistancesMap::iterator i = map.find(key);
329 if (i == map.end())
Spyridon Mastorakis60f4b992014-11-07 15:51:38 -0800330 return std::tuple<std::shared_ptr<nfd::Face>, uint32_t,
Alexander Afanasyev8e60bcd2015-01-15 20:55:40 +0000331 double>(nullptr, std::numeric_limits<uint32_t>::max(), 0.0);
Alexander Afanasyevad3757f2012-04-17 10:27:59 -0700332 else
333 return i->second;
334}
335
336} // namespace boost
337
Alexander Afanasyev6315ef72012-06-01 20:56:31 -0700338/// @endcond
339
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700340#endif // BOOST_GRAPH_NDN_GLOBAL_ROUTING_HELPER_H