47 auto i = m_faces.find(
id);
48 if (i == m_faces.end()) {
51 return i->second.get();
57 return m_faces.size();
64 NFD_LOG_WARN(
"Trying to add existing face id=" << face->getId() <<
" to the face table");
68 FaceId faceId = ++m_lastFaceId;
70 this->addImpl(face, faceId);
77 BOOST_ASSERT(m_faces.count(face->getId()) == 0);
79 this->addImpl(face, faceId);
83 FaceTable::addImpl(shared_ptr<Face> face,
FaceId faceId)
86 m_faces[faceId] = face;
87 NFD_LOG_INFO(
"Added face id=" << faceId <<
" remote=" << face->getRemoteUri()
88 <<
" local=" << face->getLocalUri());
96 FaceTable::remove(
FaceId faceId)
98 auto i = m_faces.find(faceId);
99 BOOST_ASSERT(i != m_faces.end());
100 shared_ptr<Face> face = i->second;
108 " remote=" << face->getRemoteUri() <<
109 " local=" << face->getLocalUri());
116 FaceTable::getForwardRange()
const
118 return m_faces | boost::adaptors::map_values | boost::adaptors::indirected;
124 return this->getForwardRange().begin();
130 return this->getForwardRange().end();
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for Face&.
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
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
boost::indirected_range< const boost::select_second_const_range< FaceMap > > ForwardRange
const_iterator begin() const
#define NFD_LOG_WARN(expression)
#define NFD_LOG_INFO(expression)
void add(shared_ptr< Face > face)
add a face
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
signal::Signal< FaceTable, Face & > beforeRemove
fires before a face is removed
const FaceId FACEID_RESERVED_MAX
upper bound of reserved FaceIds
signal::Signal< FaceTable, Face & > afterAdd
fires after a face is added
#define NFD_LOG_INIT(name)
NFD_ASSERT_FORWARD_ITERATOR(FaceTable::const_iterator)
uint64_t FaceId
identifies a face
const FaceId INVALID_FACEID
indicates an invalid FaceId
const_iterator end() const
boost::asio::io_service & getGlobalIoService()