libfilezilla
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
event_with_source< UniqueType, Values > Class Template Referencefinal

Events with associated source. More...

#include <event.hpp>

Inheritance diagram for event_with_source< UniqueType, Values >:
Inheritance graph
[legend]
Collaboration diagram for event_with_source< UniqueType, Values >:
Collaboration graph
[legend]

Public Types

typedef UniqueType unique_type
 
typedef std::tuple< Values... > tuple_type
 

Public Member Functions

template<typename First_Value , typename... Remaining_Values>
 event_with_source (First_Value &&value, Remaining_Values &&...values)
 
virtual size_t derived_type () const override
 
virtual event_sourcesource () const override
 

Static Public Member Functions

static size_t type ()
 

Public Attributes

tuple_type v_
 

Detailed Description

template<typename UniqueType, typename... Values>
class fz::event_with_source< UniqueType, Values >

Events with associated source.

This is similar to simple_event, except that the type of the first event value is derived from event_source.

Pending events from a given source can easily be removed using event_handler::remove_events

Member Function Documentation

virtual size_t derived_type ( ) const
inlineoverridevirtual

The returned pointer must be unique for the derived type such that: event_base& a = ... event_base& b = ... assert((a.derived_type() == b.derived_type()) == (typeid(a) == typeid(b)));

Warning
Using &typeid is tempting, but unspecifined (sic)
According to the C++ standard, the address of a static member function is unique for each type. Unfortunately this does not prevent optimizing compilers to pool identical functions.

Best solution is to have your derived type return the address of a static data member of it, as done in simple_event.

Implements event_base.


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