KS.Reactor.ksEventMap< K, E > Class Template Reference

A dictionary of events. More...

Inheritance diagram for KS.Reactor.ksEventMap< K, E >:

Public Member Functions

void Clear ()
 Unregisters all events. More...
 
bool HasHandlers (K key)
 Checks if there are any handlers registered for a key. More...
 
bool TryGet (K key, out E ev)
 Tries to get the events for a key. More...
 

Protected Member Functions

virtual E CreateEventGroup (K key)
 Creates an event group for a key. More...
 

Protected Attributes

Dictionary< K, E > m_map
 

Properties

this[K key] [get, set]
 Gets the event object for a key. Creates one if none exists. More...
 

Detailed Description

A dictionary of events.

Example Usage:

// Add an event handl map[key] += handler;

// Remove an event ha map[key] -= handler;

Template Parameters
TDelegate type

Example Usage:

// Add an event handl map[key] += handler;

// Remove an event ha map[key] -= handler;

Template Parameters
KKey type
EksEvent<T> or a class that derives from it.
Type Constraints
E :ksIEvent 
E :new() 

Member Function Documentation

◆ Clear()

void KS.Reactor.ksEventMap< K, E >.Clear ( )

Unregisters all events.

◆ CreateEventGroup()

virtual E KS.Reactor.ksEventMap< K, E >.CreateEventGroup ( key)
protectedvirtual

Creates an event group for a key.

Parameters
keyKey to create event group for.
Returns
Event group

◆ HasHandlers()

bool KS.Reactor.ksEventMap< K, E >.HasHandlers ( key)

Checks if there are any handlers registered for a key.

Parameters
keyKey to check for.
Returns
True if there are any handlers registered for the key.

◆ TryGet()

bool KS.Reactor.ksEventMap< K, E >.TryGet ( key,
out E  ev 
)

Tries to get the events for a key.

Parameters
keyKey to get the events for.
evEvents for the given key, or null if none were found.
Returns
True if there was an events object for the given key.

Property Documentation

◆ this[K key]

E KS.Reactor.ksEventMap< K, E >.this[K key]
getset

Gets the event object for a key. Creates one if none exists.