47 auto i = m_faces.find(
id);
48 return i == m_faces.end() ? nullptr : i->second.get();
54 return m_faces.size();
61 NFD_LOG_WARN(
"Trying to add existing face id=" << face->getId() <<
" to the face table");
65 FaceId faceId = ++m_lastFaceId;
67 this->addImpl(std::move(face), faceId);
75 this->addImpl(std::move(face), faceId);
79 FaceTable::addImpl(shared_ptr<Face> face,
FaceId faceId)
82 auto ret = m_faces.emplace(faceId, face);
83 BOOST_VERIFY(ret.second);
86 " remote=" << face->getRemoteUri() <<
87 " local=" << face->getLocalUri());
95 FaceTable::remove(
FaceId faceId)
97 auto i = m_faces.find(faceId);
98 BOOST_ASSERT(i != m_faces.end());
99 shared_ptr<Face> face = i->second;
107 " remote=" << face->getRemoteUri() <<
108 " local=" << face->getLocalUri());
115 FaceTable::getForwardRange()
const 117 return m_faces | boost::adaptors::map_values | boost::adaptors::indirected;
123 return this->getForwardRange().begin();
129 return this->getForwardRange().end();
signal::Signal< FaceTable, Face & > afterAdd
fires after a face is added
boost::indirected_range< const boost::select_second_const_range< FaceMap > > ForwardRange
generalization of a network interface
void add(shared_ptr< Face > face)
add a face
detail::SimulatorIo & getGlobalIoService()
signal::Signal< FaceTable, Face & > beforeRemove
fires before a face is removed
const_iterator begin() const
void connectFaceClosedSignal(Face &face, const std::function< void()> &f)
invokes a callback when the face is closed
Face * get(FaceId id) const
get face by FaceId
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for Face&.
const_iterator end() const
Copyright (c) 2011-2015 Regents of the University of California.
void post(const std::function< void()> &callback)
const FaceId FACEID_RESERVED_MAX
upper bound of reserved FaceIds
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
NDN_CXX_ASSERT_FORWARD_ITERATOR(FaceTable::const_iterator)
uint64_t FaceId
identifies a face
#define NFD_LOG_INIT(name)
const FaceId INVALID_FACEID
indicates an invalid FaceId