31 #include <ndn-cxx/util/concepts.hpp> 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();
boost::indirected_range< const boost::select_second_const_range< FaceMap > > ForwardRange
const_iterator end() const
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
signal::Signal< FaceTable, Face > afterAdd
Fires immediately after a face is added.
boost::range_iterator< ForwardRange >::type const_iterator
ForwardIterator for Face&.
void connectFaceClosedSignal(Face &face, std::function< void()> f)
Invokes a callback when a face is closed.
signal::Signal< FaceTable, Face > beforeRemove
Fires immediately before a face is removed.
void add(shared_ptr< Face > face)
add a face
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
const FaceId FACEID_RESERVED_MAX
upper bound of reserved FaceIds
generalization of a network interface
#define NFD_LOG_INIT(name)
const_iterator begin() const
NDN_CXX_ASSERT_FORWARD_ITERATOR(FaceTable::const_iterator)
uint64_t FaceId
Identifies a face.
const FaceId INVALID_FACEID
indicates an invalid FaceId
boost::asio::io_service & getGlobalIoService()
Returns the global io_service instance for the calling thread.