Antkeeper  0.0.1
Public Types | Public Member Functions | List of all members
event::subscription Class Reference

Unsubscribes a subscriber on destruction. More...

#include <subscription.hpp>

Public Types

typedef std::function< void()> unsubscribe_type
 Unsubscribe function object type. More...
 

Public Member Functions

 subscription (std::weak_ptr< void > &&subscriber, unsubscribe_type &&unsubscriber)
 Constructs a subscription. More...
 
 ~subscription ()
 Unsubscribes the subscriber and destructs the subscription. More...
 
bool expired () const noexcept
 Returns true if the subscription is no longer active, false otherwise. More...
 
void unsubscribe ()
 Unsubscribes the subscriber. More...
 

Detailed Description

Unsubscribes a subscriber on destruction.

Definition at line 31 of file subscription.hpp.

Member Typedef Documentation

◆ unsubscribe_type

typedef std::function<void()> event::subscription::unsubscribe_type

Unsubscribe function object type.

Definition at line 35 of file subscription.hpp.

Constructor & Destructor Documentation

◆ subscription()

event::subscription::subscription ( std::weak_ptr< void > &&  subscriber,
unsubscribe_type &&  unsubscriber 
)

Constructs a subscription.

Parameters
subscriberWeak pointer to the subscriber.
unsubscriberUnsubscribe function object.

Definition at line 25 of file subscription.cpp.

◆ ~subscription()

event::subscription::~subscription ( )

Unsubscribes the subscriber and destructs the subscription.

Definition at line 30 of file subscription.cpp.

Member Function Documentation

◆ expired()

bool event::subscription::expired ( ) const
noexcept

Returns true if the subscription is no longer active, false otherwise.

Definition at line 35 of file subscription.cpp.

◆ unsubscribe()

void event::subscription::unsubscribe ( )

Unsubscribes the subscriber.

Definition at line 40 of file subscription.cpp.


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