dpp::timed_listener
timed_listener.h
typename attached_event
class listening_function
time_t time_t dpp::timed_listener< attached_event, listening_function >::duration duration dpp::timed_listener::duration

Duration of listen.

attached_event & attached_event& dpp::timed_listener< attached_event, listening_function >::ev ev dpp::timed_listener::ev

Reference to attached event in cluster.

event_handle event_handle dpp::timed_listener< attached_event, listening_function >::listener_handle listener_handle dpp::timed_listener::listener_handle

Event handle.

cluster * cluster* dpp::timed_listener< attached_event, listening_function >::owner owner dpp::timed_listener::owner

Owning cluster.

timer timer dpp::timed_listener< attached_event, listening_function >::th th dpp::timed_listener::th

Timer handle.

dpp::timed_listener< attached_event, listening_function >::timed_listener
(cluster *cl, uint64_t _duration, attached_event &event, listening_function listener, timer_callback_t on_end={})
timed_listener
dpp::timed_listener::timed_listener
cluster * cl
uint64_t _duration
attached_event & event
listening_function listener
timer_callback_t on_end {}

Construct a new timed listener object.

cl

Owning cluster

_duration

Duration of timed event in seconds

event

Event to hook, e.g. cluster.on_message_create

on_end

An optional void() lambda to trigger when the timed_listener times out. Calling the destructor before the timeout is reached does not call this lambda.

listener

Lambda to receive events. Type must match up properly with that passed into the 'event' parameter.

dpp::timed_listener< attached_event, listening_function >::~timed_listener
()
~timed_listener
dpp::timed_listener::~timed_listener

Destroy the timed listener object.

A timed_listener is a way to temporarily attach to an event for a specific timeframe, then detach when complete. A lambda may also be optionally called when the timeout is reached. Destructing the timed_listener detaches any attached event listeners, and cancels any created timers, but does not call any timeout lambda.

attached_event

Event within cluster to attach to within the cluster::dispatch member (dpp::dispatcher object)

listening_function

Definition of lambda function that matches up with the attached_event.

dpp::timed_listener< attached_event, listening_function >
dpp::timed_listener< dpp::event_router_t< T >, std::function< void(const T &)> >
< dpp::event_router_t< T >, std::function< void(const T &)> >
- dpp::timed_listener
  duration
- dpp::timed_listener
  ev
- dpp::timed_listener
  listener_handle
- dpp::timed_listener
  owner
- dpp::timed_listener
  th
- dpp::timed_listener
  timed_listener
- dpp::timed_listener
  ~timed_listener