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();
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
#define NFD_LOG_INFO(expression)
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
#define NFD_LOG_WARN(expression)
void addReserved(shared_ptr< Face > face, FaceId faceId)
add a special face with a reserved FaceId
NFD_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