PLaSK library

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
plask::EventWithSourceAndFlags< SourceType, _FlagsType > Class Template Reference

Base class for classes which store information about event generated by objects of type `SourceType`. More...

`#include <plask/utils/event.hpp>`

## Public Types
typedef _FlagsType | FlagsType

## Public Member Functions
const SourceType * | source () const
| Get source of event.
SourceType * | source ()
| Get source of event.
template<typename T >
const T * | source () const
| Get source of event casted (using dynamic_cast) to given type T.
template<typename T >
T * | source ()
| Get source of event casted (using dynamic_cast) to given type T.
FlagsType | flags () const
| Get event's flags.
FlagsType | flagsWithout (FlagsType flagsToRemove) const
| Get event's flags with excluded `flagsToRemove`.
bool | hasAllFlags (FlagsType flags) const
| Check if given all of `flags` are set.
bool | hasAnyFlag (FlagsType flags) const
| Check if one of given `flags` are set.
| EventWithSourceAndFlags (SourceType *source, FlagsType flags=0)
| Construct event.
virtual | ~EventWithSourceAndFlags ()
| Virtual destructor for eventual subclassing.

## Detailed Description

template<typename SourceType, typename _FlagsType = unsigned char>
class plask::EventWithSourceAndFlags< SourceType, _FlagsType >

Base class for classes which store information about event generated by objects of type `SourceType`.

It contains flags field which describes additional event properties. Subclasses of subclasses of this can also contains additional information about specific type of event.

Definition at line 30 of file event.hpp.

## Member Typedef Documentation

## ◆ FlagsType

template<typename SourceType , typename _FlagsType = unsigned char>

typedef _FlagsType plask::EventWithSourceAndFlags< SourceType, _FlagsType >::FlagsType

Definition at line 40 of file event.hpp.

## Constructor & Destructor Documentation

## ◆ EventWithSourceAndFlags()

template<typename SourceType , typename _FlagsType = unsigned char>

plask::EventWithSourceAndFlags< SourceType, _FlagsType >::EventWithSourceAndFlags | ( | SourceType * | source,
|  | FlagsType | flags = `0`
| ) |  |
| inline explicit

Construct event.

Parameters

  source | source of event
  flags | falgs which describes event's properties

Definition at line 110 of file event.hpp.

## ◆ ~EventWithSourceAndFlags()

template<typename SourceType , typename _FlagsType = unsigned char>

virtual plask::EventWithSourceAndFlags< SourceType, _FlagsType >::~EventWithSourceAndFlags | ( |  | ) |
| inline virtual

Virtual destructor for eventual subclassing.

Definition at line 113 of file event.hpp.

## Member Function Documentation

## ◆ flags()

template<typename SourceType , typename _FlagsType = unsigned char>

FlagsType plask::EventWithSourceAndFlags< SourceType, _FlagsType >::flags | ( |  | ) | const
| inline

Get event's flags.

Returns
  flags which describes event's properties

Definition at line 82 of file event.hpp.

## ◆ flagsWithout()

template<typename SourceType , typename _FlagsType = unsigned char>

FlagsType plask::EventWithSourceAndFlags< SourceType, _FlagsType >::flagsWithout | ( | FlagsType | flagsToRemove | ) | const
| inline

Get event's flags with excluded `flagsToRemove`.

Parameters

  flagsToRemove | flags to exclude from result

Returns
  flags which describes event properties without `flagsToRemove`

Definition at line 89 of file event.hpp.

## ◆ hasAllFlags()

template<typename SourceType , typename _FlagsType = unsigned char>

bool plask::EventWithSourceAndFlags< SourceType, _FlagsType >::hasAllFlags | ( | FlagsType | flags | ) | const
| inline

Check if given all of `flags` are set.

Parameters

  flags | flags to check

Returns
  `true` only if all of `flags` are set

Definition at line 96 of file event.hpp.

## ◆ hasAnyFlag()

template<typename SourceType , typename _FlagsType = unsigned char>

bool plask::EventWithSourceAndFlags< SourceType, _FlagsType >::hasAnyFlag | ( | FlagsType | flags | ) | const
| inline

Check if one of given `flags` are set.

Parameters

  flags | flags to check

Returns
  `true` only if one or more of `flags` are set

Definition at line 103 of file event.hpp.

## ◆ source() [1/4]

template<typename SourceType , typename _FlagsType = unsigned char>

SourceType * plask::EventWithSourceAndFlags< SourceType, _FlagsType >::source | ( |  | ) |
| inline

Get source of event.

Returns
  source of event

Definition at line 52 of file event.hpp.

## ◆ source() [2/4]

template<typename SourceType , typename _FlagsType = unsigned char>
template<typename T >

T * plask::EventWithSourceAndFlags< SourceType, _FlagsType >::source | ( |  | ) |
| inline

Get source of event casted (using dynamic_cast) to given type T.

Returns
  source of event as T

Template Parameters

  T | required type

Definition at line 72 of file event.hpp.

## ◆ source() [3/4]

template<typename SourceType , typename _FlagsType = unsigned char>

const SourceType * plask::EventWithSourceAndFlags< SourceType, _FlagsType >::source | ( |  | ) | const
| inline

Get source of event.

Returns
  source of event

Definition at line 46 of file event.hpp.

## ◆ source() [4/4]

template<typename SourceType , typename _FlagsType = unsigned char>
template<typename T >

const T * plask::EventWithSourceAndFlags< SourceType, _FlagsType >::source | ( |  | ) | const
| inline

Get source of event casted (using dynamic_cast) to given type T.

Returns
  source of event as T

Template Parameters

  T | required type

Definition at line 60 of file event.hpp.

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

- plask/utils/event.hpp