Freeciv-3.1: listener< _type_ > Class Template Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | Protected Member Functions | Static Private Attributes
listener< _type_ > Class Template Reference

`#include <listener.h>`

## Public Types

typedef _type_ | type_t

## Static Public Member Functions

template<class _member_fct_ >
static void | invoke (_member_fct_ function)
template<class _member_fct_ , class _arg1_t_ >
static void | invoke (_member_fct_ function, _arg1_t_ arg)
template<class _member_fct_ , class _arg1_t_ , class _arg2_t_ >
static void | invoke (_member_fct_ function, _arg1_t_ arg1, _arg2_t_ arg2)

## Protected Member Functions

| listener ()
virtual | ~listener ()
void | listen ()

## Static Private Attributes

static std::set< type_t * > | instances

## Detailed Description

template<class _type_>
class listener< _type_ >

Definition at line 104 of file listener.h.

## Member Typedef Documentation

## ◆ type_t

template<class _type_ >

typedef _type_ listener< _type_ >::type_t

Definition at line 108 of file listener.h.

## Constructor & Destructor Documentation

## ◆ listener()

template<class _type_ >

listener< _type_ >::listener | ( |  | ) |

explicitprotected

Constructor

Definition at line 142 of file listener.h.

## ◆ ~listener()

template<class _type_ >

listener< _type_ >::~listener | ( |  | ) |

protectedvirtual

Destructor

Definition at line 160 of file listener.h.

## Member Function Documentation

## ◆ invoke() [1/3]

template<class _type_ >
template<class _member_fct_ >

void listener< _type_ >::invoke | ( | _member_fct_ | function | ) |

static

Invokes a member function on all instances of an listener type. Template parameters are meant to be automatically deduced.

Zero-parameter overload.

Parameters

  function | The member function to call

Definition at line 175 of file listener.h.

## ◆ invoke() [2/3]

template<class _type_ >
template<class _member_fct_ , class _arg1_t_ >

void listener< _type_ >::invoke | ( | _member_fct_ | function,
|  | _arg1_t_ | arg
| ) |  |

static

Invokes a member function on all instances of an listener type. Template parameters are meant to be automatically deduced.

One-parameter overload.

Parameters

  function | The member function to call
  arg | The argument to call the function with

Definition at line 195 of file listener.h.

## ◆ invoke() [3/3]

template<class _type_ >
template<class _member_fct_ , class _arg1_t_ , class _arg2_t_ >

void listener< _type_ >::invoke | ( | _member_fct_ | function,
|  | _arg1_t_ | arg1,
|  | _arg2_t_ | arg2
| ) |  |

static

Invokes a member function on all instances of an listener type. Template parameters are meant to be automatically deduced.

Two-parameters overload.

Parameters

  function | The member function to call
  arg1 | The first argument to pass to the function
  arg2 | The second argument to pass to the function

Definition at line 216 of file listener.h.

## ◆ listen()

template<class _type_ >

void listener< _type_ >::listen | ( |  | ) |

protected

Starts listening to events

Definition at line 149 of file listener.h.

## Field Documentation

## ◆ instances

template<class _type_ >

std::set<type_t *> listener< _type_ >::instances

staticprivate

Definition at line 112 of file listener.h.