Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex > Class Template Reference

#include <AbstractEvent.h>

+ Collaboration diagram for Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >:

Classes

struct  NotifyAsyncParams
 

Public Types

typedef TDelegate * DelegateHandle
 

Public Member Functions

 AbstractEvent ()
 
 AbstractEvent (const TStrategy &strat)
 
virtual ~AbstractEvent ()
 
void operator+= (const TDelegate &aDelegate)
 
void operator-= (const TDelegate &aDelegate)
 
DelegateHandle add (const TDelegate &aDelegate)
 
void remove (DelegateHandle delegateHandle)
 
void operator() (const void *pSender)
 Shortcut for notify(pSender, args);.
 
void operator() ()
 Shortcut for notify(args).
 
void notify (const void *pSender)
 
ActiveResult< void > notifyAsync (const void *pSender)
 
void enable ()
 Enables the event.
 
void disable ()
 
bool isEnabled () const
 
void clear ()
 Removes all delegates.
 
bool empty () const
 Checks if any delegates are registered at the delegate.
 

Protected Member Functions

void executeAsyncImpl (const NotifyAsyncParams &par)
 

Protected Attributes

ActiveMethod< void, NotifyAsyncParams, AbstractEvent_executeAsync
 
TStrategy _strategy
 
bool _enabled
 The strategy used to notify observers.
 
TMutex _mutex
 

Private Member Functions

 AbstractEvent (const AbstractEvent &other)
 
AbstractEventoperator= (const AbstractEvent &other)
 

Detailed Description

template<class TStrategy, class TDelegate, class TMutex>
class Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >

Definition at line 359 of file AbstractEvent.h.

Member Typedef Documentation

◆ DelegateHandle

template<class TStrategy , class TDelegate , class TMutex >
typedef TDelegate* Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::DelegateHandle

Definition at line 362 of file AbstractEvent.h.

Constructor & Destructor Documentation

◆ AbstractEvent() [1/3]

template<class TStrategy , class TDelegate , class TMutex >
Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::AbstractEvent ( )
inline

Definition at line 364 of file AbstractEvent.h.

◆ AbstractEvent() [2/3]

template<class TStrategy , class TDelegate , class TMutex >
Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::AbstractEvent ( const TStrategy & strat)
inline

Definition at line 370 of file AbstractEvent.h.

◆ ~AbstractEvent()

template<class TStrategy , class TDelegate , class TMutex >
virtual Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::~AbstractEvent ( )
inlinevirtual

Definition at line 377 of file AbstractEvent.h.

◆ AbstractEvent() [3/3]

template<class TStrategy , class TDelegate , class TMutex >
Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::AbstractEvent ( const AbstractEvent< void, TStrategy, TDelegate, TMutex > & other)
private

Member Function Documentation

◆ add()

template<class TStrategy , class TDelegate , class TMutex >
DelegateHandle Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::add ( const TDelegate & aDelegate)
inline

Adds a delegate to the event.

Exact behavior is determined by the TStrategy.

Returns a DelegateHandle which can be used in call to remove() to remove the delegate.

Definition at line 399 of file AbstractEvent.h.

◆ clear()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::clear ( )
inline

Removes all delegates.

Definition at line 506 of file AbstractEvent.h.

◆ disable()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::disable ( )
inline

Disables the event. notify and notifyAsnyc will be ignored, but adding/removing delegates is still allowed.

Definition at line 492 of file AbstractEvent.h.

◆ empty()

template<class TStrategy , class TDelegate , class TMutex >
bool Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::empty ( ) const
inline

Checks if any delegates are registered at the delegate.

Definition at line 513 of file AbstractEvent.h.

◆ enable()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::enable ( )
inline

Enables the event.

Definition at line 485 of file AbstractEvent.h.

◆ executeAsyncImpl()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::executeAsyncImpl ( const NotifyAsyncParams & par)
inlineprotected

Definition at line 535 of file AbstractEvent.h.

◆ isEnabled()

template<class TStrategy , class TDelegate , class TMutex >
bool Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::isEnabled ( ) const
inline

Definition at line 500 of file AbstractEvent.h.

◆ notify()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::notify ( const void * pSender)
inline

Sends a notification to all registered delegates. The order is determined by the TStrategy. This method is blocking. While executing, the list of delegates may be modified. These changes don't influence the current active notifications but are activated with the next notify. If a delegate is removed during a notify(), the delegate will no longer be invoked (unless it has already been invoked prior to removal). If one of the delegates throws an exception, the notify method is immediately aborted and the exception is propagated to the caller.

Definition at line 433 of file AbstractEvent.h.

◆ notifyAsync()

template<class TStrategy , class TDelegate , class TMutex >
ActiveResult< void > Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::notifyAsync ( const void * pSender)
inline

Sends a notification to all registered delegates. The order is determined by the TStrategy. This method is not blocking and will immediately return. The delegates are invoked in a separate thread. Call activeResult.wait() to wait until the notification has ended. While executing, other objects can change the delegate list. These changes don't influence the current active notifications but are activated with the next notify. If a delegate is removed during a notify(), the delegate will no longer be invoked (unless it has already been invoked prior to removal). If one of the delegates throws an exception, the execution is aborted and the exception is propagated to the caller.

Definition at line 456 of file AbstractEvent.h.

◆ operator()() [1/2]

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::operator() ( )
inline

Shortcut for notify(args).

Definition at line 427 of file AbstractEvent.h.

◆ operator()() [2/2]

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::operator() ( const void * pSender)
inline

Shortcut for notify(pSender, args);.

Definition at line 421 of file AbstractEvent.h.

◆ operator+=()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::operator+= ( const TDelegate & aDelegate)
inline

Adds a delegate to the event.

Exact behavior is determined by the TStrategy.

Definition at line 381 of file AbstractEvent.h.

◆ operator-=()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::operator-= ( const TDelegate & aDelegate)
inline

Removes a delegate from the event.

If the delegate is not found, this function does nothing.

Definition at line 390 of file AbstractEvent.h.

◆ operator=()

template<class TStrategy , class TDelegate , class TMutex >
AbstractEvent & Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::operator= ( const AbstractEvent< void, TStrategy, TDelegate, TMutex > & other)
private

◆ remove()

template<class TStrategy , class TDelegate , class TMutex >
void Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::remove ( DelegateHandle delegateHandle)
inline

Removes a delegate from the event using a DelegateHandle returned by add().

If the delegate is not found, this function does nothing.

Definition at line 411 of file AbstractEvent.h.

Member Data Documentation

◆ _enabled

template<class TStrategy , class TDelegate , class TMutex >
bool Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::_enabled
protected

The strategy used to notify observers.

Definition at line 548 of file AbstractEvent.h.

◆ _executeAsync

template<class TStrategy , class TDelegate , class TMutex >
ActiveMethod<void, NotifyAsyncParams, AbstractEvent> Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::_executeAsync
protected

Definition at line 533 of file AbstractEvent.h.

◆ _mutex

template<class TStrategy , class TDelegate , class TMutex >
TMutex Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::_mutex
mutableprotected

Stores if an event is enabled. Notifies on disabled events have no effect but it is possible to change the observers.

Definition at line 550 of file AbstractEvent.h.

◆ _strategy

template<class TStrategy , class TDelegate , class TMutex >
TStrategy Poco::AbstractEvent< void, TStrategy, TDelegate, TMutex >::_strategy
protected

Definition at line 547 of file AbstractEvent.h.


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