46 auto i = m_faces.find(
id);
47 return i == m_faces.end() ?
nullptr : i->second.get();
53 return m_faces.size();
60 NFD_LOG_WARN(
"Trying to add existing face id=" << face->getId() <<
" to the face table");
64 FaceId faceId = ++m_lastFaceId;
66 this->addImpl(std::move(face), faceId);
74 this->addImpl(std::move(face), faceId);
78 FaceTable::addImpl(shared_ptr<Face> face,
FaceId faceId)
81 auto ret = m_faces.emplace(faceId, face);
82 BOOST_VERIFY(ret.second);
85 " remote=" << face->getRemoteUri() <<
86 " local=" << face->getLocalUri());
94 FaceTable::remove(
FaceId faceId)
96 auto i = m_faces.find(faceId);
97 BOOST_ASSERT(i != m_faces.end());
98 shared_ptr<Face> face = i->second;
106 " remote=" << face->getRemoteUri() <<
107 " local=" << face->getLocalUri());
114 FaceTable::getForwardRange()
const 116 return m_faces | boost::adaptors::map_values | boost::adaptors::indirected;
122 return this->getForwardRange().begin();
128 return this->getForwardRange().end();
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
void connectFaceClosedSignal(Face &face, const std::function< void()> &f)
invokes a callback when the face is closed
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for Face&.
const_iterator begin() const
boost::indirected_range< const boost::select_second_const_range< FaceMap >> ForwardRange
#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()