nfd::FaceTable Class Reference

Container of all faces. More...

#include <daemon/fw/face-table.hpp>

+ Inheritance diagram for nfd::FaceTable:
+ Collaboration diagram for nfd::FaceTable:

Public Types

using const_iterator = boost::range_iterator< ForwardRange >::type
 
using FaceMap = std::map< FaceId, shared_ptr< Face > >
 
using ForwardRange = boost::indirected_range< const boost::select_second_const_range< FaceMap > >
 

Public Member Functions

void add (shared_ptr< Face > face)
 Add a face. More...
 
void addReserved (shared_ptr< Face > face, FaceId faceId)
 Add a special face with a reserved FaceId. More...
 
const_iterator begin () const
 
const_iterator end () const
 
Faceget (FaceId id) const noexcept
 Get face by FaceId. More...
 
size_t size () const noexcept
 Return the total number of faces. More...
 

Public Attributes

signal::Signal< FaceTable, FaceafterAdd
 Fires immediately after a face is added. More...
 
signal::Signal< FaceTable, FacebeforeRemove
 Fires immediately before a face is removed. More...
 

Detailed Description

Container of all faces.

Definition at line 41 of file face-table.hpp.

Member Typedef Documentation

◆ const_iterator

using nfd::FaceTable::const_iterator = boost::range_iterator<ForwardRange>::type

Definition at line 72 of file face-table.hpp.

◆ FaceMap

using nfd::FaceTable::FaceMap = std::map<FaceId, shared_ptr<Face> >

Definition at line 70 of file face-table.hpp.

◆ ForwardRange

using nfd::FaceTable::ForwardRange = boost::indirected_range<const boost::select_second_const_range<FaceMap> >

Definition at line 71 of file face-table.hpp.

Member Function Documentation

◆ add()

void nfd::FaceTable::add ( shared_ptr< Face face)

Add a face.

FaceTable obtains shared ownership of the face. The channel or protocol factory that creates the face may retain ownership.

Definition at line 51 of file face-table.cpp.

◆ addReserved()

void nfd::FaceTable::addReserved ( shared_ptr< Face face,
FaceId  faceId 
)

Add a special face with a reserved FaceId.

Definition at line 64 of file face-table.cpp.

◆ begin()

FaceTable::const_iterator nfd::FaceTable::begin ( ) const

Definition at line 115 of file face-table.cpp.

◆ end()

FaceTable::const_iterator nfd::FaceTable::end ( ) const

Definition at line 121 of file face-table.cpp.

◆ get()

Face * nfd::FaceTable::get ( FaceId  id) const
noexcept

Get face by FaceId.

Returns
A pointer to the face if found, nullptr otherwise; face->shared_from_this() can be used if a shared_ptr is desired.

Definition at line 38 of file face-table.cpp.

◆ size()

size_t nfd::FaceTable::size ( ) const
noexcept

Return the total number of faces.

Definition at line 45 of file face-table.cpp.

Member Data Documentation

◆ afterAdd

signal::Signal<FaceTable, Face> nfd::FaceTable::afterAdd

Fires immediately after a face is added.

Definition at line 83 of file face-table.hpp.

◆ beforeRemove

signal::Signal<FaceTable, Face> nfd::FaceTable::beforeRemove

Fires immediately before a face is removed.

When this signal is emitted, the face is still in FaceTable and has a valid FaceId.

Definition at line 89 of file face-table.hpp.