44 auto i = m_faces.find(
id);
45 if (i == m_faces.end()) {
48 return 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(face, faceId);
74 BOOST_ASSERT(m_faces.count(face->getId()) == 0);
76 this->addImpl(face, faceId);
80 FaceTable::addImpl(shared_ptr<Face>
face,
FaceId faceId)
83 m_faces[faceId] = face;
84 NFD_LOG_INFO(
"Added face id=" << faceId <<
" remote=" << face->getRemoteUri()
85 <<
" local=" << face->getLocalUri());
93 FaceTable::remove(
FaceId faceId)
95 auto i = m_faces.find(faceId);
96 BOOST_ASSERT(i != m_faces.end());
97 shared_ptr<Face> face = i->second;
105 " remote=" << face->getRemoteUri() <<
106 " local=" << face->getLocalUri());
113 FaceTable::getForwardRange()
const 115 return m_faces | boost::adaptors::map_values | boost::adaptors::indirected;
121 return this->getForwardRange().begin();
127 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
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for Face&.
generalization of a network interface
void add(shared_ptr< Face > face)
add a face
void connectFaceClosedSignal(Face &face, const std::function< void()> &f)
invokes a callback when the face is closed
detail::SimulatorIo & getGlobalIoService()
signal::Signal< FaceTable, Face & > beforeRemove
fires before a face is removed
const_iterator begin() const
#define NFD_LOG_INFO(expression)
Face * get(FaceId id) const
get face by FaceId
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
uint64_t FaceId
identifies a face
#define NFD_LOG_INIT(name)
const FaceId INVALID_FACEID
indicates an invalid FaceId