Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
feed::impl::TrackableSignalMap< Key, Session, Args > Class Template Reference

Class to manage a map of key and its associative signal. More...

#include <TrackableSignalMap.hpp>

Public Member Functions

bool connectTrackableSlot (ConnectionSharedPtr const &trackable, Key const &key, std::function< void(Args...)> slot)
 Connect a slot to the signal, the slot will be called when the signal is emitted and trackable is still alive.
 
bool disconnect (ConnectionPtr trackablePtr, Key const &key)
 Disconnect a slot from the key's associative signal.
 
void emit (Key const &key, Args const &... args)
 Emit the signal with the given key and arguments.
 

Detailed Description

template<Hashable Key, typename Session, typename... Args>
class feed::impl::TrackableSignalMap< Key, Session, Args >

Class to manage a map of key and its associative signal.

Parameters
KeyThe type of the key.
SessionThe type of the object that will be tracked, when the object is destroyed, the connection will be removed lazily.
ArgsThe types of the arguments that will be passed to the slot

Member Function Documentation

◆ connectTrackableSlot()

template<Hashable Key, typename Session , typename... Args>
bool feed::impl::TrackableSignalMap< Key, Session, Args >::connectTrackableSlot ( ConnectionSharedPtr const & trackable,
Key const & key,
std::function< void(Args...)> slot )
inline

Connect a slot to the signal, the slot will be called when the signal is emitted and trackable is still alive.

Parameters
trackableTrack this object's lifttime, if the object is destroyed, the connection will be removed lazily. When the slot is being called, the object is guaranteed to be alive.
keyThe key to the signal.
slotThe slot connecting to the signal, the slot will be called when the assocaiative signal is emitted.
Returns
true if the connection is successfully added, false if the connection already exists for the key.

◆ disconnect()

template<Hashable Key, typename Session , typename... Args>
bool feed::impl::TrackableSignalMap< Key, Session, Args >::disconnect ( ConnectionPtr trackablePtr,
Key const & key )
inline

Disconnect a slot from the key's associative signal.

Parameters
trackablePtrThe pointer to the object that is being tracked.
keyThe key to the signal.
Returns
true if the connection is successfully removed, false if the connection does not exist.

◆ emit()

template<Hashable Key, typename Session , typename... Args>
void feed::impl::TrackableSignalMap< Key, Session, Args >::emit ( Key const & key,
Args const &... args )
inline

Emit the signal with the given key and arguments.

Parameters
keyThe key to the signal.
argsThe arguments to be passed to the slot.

The documentation for this class was generated from the following file: