route.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_RIB_ROUTE_HPP
27 #define NFD_RIB_ROUTE_HPP
28 
29 #include "core/scheduler.hpp"
30 #include <ndn-cxx/encoding/nfd-constants.hpp>
31 #include <ndn-cxx/mgmt/nfd/route-flags-traits.hpp>
32 #include <type_traits>
33 
34 namespace nfd {
35 namespace rib {
36 
39 class Route : public ndn::nfd::RouteFlagsTraits<Route>
40 {
41 public:
42  Route();
43 
44  void
45  setExpirationEvent(const scheduler::EventId eid)
46  {
47  m_expirationEvent = eid;
48  }
49 
50  const scheduler::EventId&
52  {
53  return m_expirationEvent;
54  }
55 
56  std::underlying_type<ndn::nfd::RouteFlags>::type
57  getFlags() const
58  {
59  return flags;
60  }
61 
62 public:
63  uint64_t faceId;
64  ndn::nfd::RouteOrigin origin;
65  uint64_t cost;
66  std::underlying_type<ndn::nfd::RouteFlags>::type flags;
67  ndn::optional<time::steady_clock::TimePoint> expires;
68 
69 private:
70  scheduler::EventId m_expirationEvent;
71 };
72 
73 bool
74 operator==(const Route& lhs, const Route& rhs);
75 
76 inline bool
77 operator!=(const Route& lhs, const Route& rhs)
78 {
79  return !(lhs == rhs);
80 }
81 
82 inline bool
83 compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
84 {
85  return (lhs.faceId == rhs.faceId && lhs.origin == rhs.origin);
86 }
87 
88 inline bool
89 compareFaceId(const Route& route, const uint64_t faceId)
90 {
91  return (route.faceId == faceId);
92 }
93 
94 std::ostream&
95 operator<<(std::ostream& os, const Route& route);
96 
97 } // namespace rib
98 } // namespace nfd
99 
100 #endif // NFD_RIB_ROUTE_HPP
uint64_t faceId
Definition: route.hpp:63
uint64_t cost
Definition: route.hpp:65
bool operator==(const Route &lhs, const Route &rhs)
Definition: route.cpp:41
std::ostream & operator<<(std::ostream &os, const FibUpdate &update)
Definition: fib-update.hpp:74
bool compareFaceIdAndOrigin(const Route &lhs, const Route &rhs)
Definition: route.hpp:83
bool operator!=(const Route &lhs, const Route &rhs)
Definition: route.hpp:77
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
ndn::nfd::RouteOrigin origin
Definition: route.hpp:64
void setExpirationEvent(const scheduler::EventId eid)
Definition: route.hpp:45
represents a route for a name prefix
Definition: route.hpp:39
const scheduler::EventId & getExpirationEvent() const
Definition: route.hpp:51
ndn::optional< time::steady_clock::TimePoint > expires
Definition: route.hpp:67
bool compareFaceId(const Route &route, const uint64_t faceId)
Definition: route.hpp:89
std::underlying_type< ndn::nfd::RouteFlags >::type getFlags() const
Definition: route.hpp:57
std::underlying_type< ndn::nfd::RouteFlags >::type flags
Definition: route.hpp:66