NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
face-table.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FW_FACE_TABLE_HPP
27 #define NFD_DAEMON_FW_FACE_TABLE_HPP
28 
29 #include "face/face.hpp"
30 #include <boost/range/adaptor/map.hpp>
31 
32 namespace nfd {
33 
34 class Forwarder;
35 
38 class FaceTable : noncopyable
39 {
40 public:
41  explicit
42  FaceTable(Forwarder& forwarder);
43 
45  ~FaceTable();
46 
48  add(shared_ptr<Face> face);
49 
52  addReserved(shared_ptr<Face> face, FaceId faceId);
53 
54  VIRTUAL_WITH_TESTS shared_ptr<Face>
55  get(FaceId id) const;
56 
57  size_t
58  size() const;
59 
60 public: // enumeration
61  typedef std::map<FaceId, shared_ptr<Face>> FaceMap;
62 
63  typedef boost::select_second_const_range<FaceMap> ForwardRange;
64 
67  typedef boost::range_iterator<ForwardRange>::type const_iterator;
68 
69  const_iterator
70  begin() const;
71 
72  const_iterator
73  end() const;
74 
75 public: // signals
79 
85 
86 private:
87  void
88  addImpl(shared_ptr<Face> face, FaceId faceId);
89 
90  void
91  remove(shared_ptr<Face> face);
92 
93  ForwardRange
94  getForwardRange() const;
95 
96 private:
97  Forwarder& m_forwarder;
98  FaceId m_lastFaceId;
99  FaceMap m_faces;
100 };
101 
102 } // namespace nfd
103 
104 #endif // NFD_DAEMON_FW_FACE_TABLE_HPP
signal::Signal< FaceTable, shared_ptr< Face > > afterAdd
fires after a Face is added
Definition: face-table.hpp:78
size_t size() const
Definition: face-table.cpp:55
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for shared_ptr<Face>
Definition: face-table.hpp:67
void add(shared_ptr< Face > face)
Definition: face-table.cpp:61
main class of NFD
Definition: forwarder.hpp:55
const_iterator begin() const
Definition: face-table.cpp:131
provides a lightweight signal / event system
signal::Signal< FaceTable, shared_ptr< Face > > beforeRemove
fires before a Face is removed
Definition: face-table.hpp:84
std::map< FaceId, shared_ptr< Face > > FaceMap
Definition: face-table.hpp:61
container of all Faces
Definition: face-table.hpp:38
const_iterator end() const
Definition: face-table.cpp:137
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
#define VIRTUAL_WITH_TESTS
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: common.hpp:37
Forwarder
Definition: forwarder.cpp:38
boost::select_second_const_range< FaceMap > ForwardRange
Definition: face-table.hpp:63
FaceTable(Forwarder &forwarder)
Definition: face-table.cpp:36
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special Face with a reserved FaceId
Definition: face-table.cpp:74
uint64_t FaceId
identifies a face
Definition: face.hpp:39