Ocean
Ocean::ScopedEvent< T > Class Template Reference

This class implements a scoped event. More...

Public Types

typedef Callback< void, const T & > EventCallback
 Definition of a callback function providing the event as single parameter. More...
 
typedef Callbacks< EventCallbackEventCallbacks
 Definition of a list of callback functions. More...
 

Public Member Functions

 ScopedEvent (const T &enterEvent, T &breakEvent, T &leaveEvent, const EventCallbacks &callbacks)
 Creates a new scoped event object. More...
 
 ~ScopedEvent ()
 Destructs this scoped event object. More...
 
void leave () const
 Activates the leave event of this object. More...
 
const T & breakEvent () const
 Returns the break-event of this object, nothing else will be done. More...
 
T & breakEvent ()
 Returns the break-event of this object, nothing else will be done. More...
 
const T & leaveEvent () const
 Returns the leave-event of this object, nothing else will be done. More...
 
T & leaveEvent ()
 Returns the leave-event of this object, nothing else will be done. More...
 

Protected Attributes

T & scopedBreakEvent
 Break event which will be invoked if the leave() function has not been called before this object is disposed. More...
 
T & scopedLeaveEvent
 Leave event which will be invoked if the leave() function has been called before this object is disposed. More...
 
const EventCallbacksscopedCallbacks
 A list of callback functions to those the events will be sent. More...
 
bool scopedEventLeave
 Leave statement of this object. More...
 

Detailed Description

template<typename T>
class Ocean::ScopedEvent< T >

This class implements a scoped event.

A scoped event stores three individual events.
One event is invoked when the scope is entered.
One event is invoked when the scope is left.
One optional event is invoked when the scope is paused.

Template Parameters
TEvent type that will be handled
See also
Event.

Member Typedef Documentation

◆ EventCallback

template<typename T >
typedef Callback<void, const T&> Ocean::ScopedEvent< T >::EventCallback

Definition of a callback function providing the event as single parameter.

◆ EventCallbacks

template<typename T >
typedef Callbacks<EventCallback> Ocean::ScopedEvent< T >::EventCallbacks

Definition of a list of callback functions.

Constructor & Destructor Documentation

◆ ScopedEvent()

template<typename T >
Ocean::ScopedEvent< T >::ScopedEvent ( const T &  enterEvent,
T &  breakEvent,
T &  leaveEvent,
const EventCallbacks callbacks 
)
inline

Creates a new scoped event object.

Parameters
enterEventEvent that will be invoked during the creation of this event
breakEventEvent that will be invoked when this object is disposed as long as the leave() function hasn't been called
leaveEventEvent that will be invoked when this object is disposed as long as the leave() function has been called
callbacksList of callback functions to those the events will be sent

◆ ~ScopedEvent()

template<typename T >
Ocean::ScopedEvent< T >::~ScopedEvent
inline

Destructs this scoped event object.

Member Function Documentation

◆ breakEvent() [1/2]

template<typename T >
T & Ocean::ScopedEvent< T >::breakEvent
inline

Returns the break-event of this object, nothing else will be done.

Returns
Event object

◆ breakEvent() [2/2]

template<typename T >
const T & Ocean::ScopedEvent< T >::breakEvent
inline

Returns the break-event of this object, nothing else will be done.

Returns
Event object

◆ leave()

template<typename T >
void Ocean::ScopedEvent< T >::leave
inline

Activates the leave event of this object.

If the leave event is activated, the leave event will be invoked instead of the break event in the moment this object is disposed.

◆ leaveEvent() [1/2]

template<typename T >
T & Ocean::ScopedEvent< T >::leaveEvent
inline

Returns the leave-event of this object, nothing else will be done.

Returns
Event object

◆ leaveEvent() [2/2]

template<typename T >
const T & Ocean::ScopedEvent< T >::leaveEvent
inline

Returns the leave-event of this object, nothing else will be done.

Returns
Event object

Field Documentation

◆ scopedBreakEvent

template<typename T >
T& Ocean::ScopedEvent< T >::scopedBreakEvent
protected

Break event which will be invoked if the leave() function has not been called before this object is disposed.

◆ scopedCallbacks

template<typename T >
const EventCallbacks& Ocean::ScopedEvent< T >::scopedCallbacks
protected

A list of callback functions to those the events will be sent.

◆ scopedEventLeave

template<typename T >
bool Ocean::ScopedEvent< T >::scopedEventLeave
mutableprotected

Leave statement of this object.

◆ scopedLeaveEvent

template<typename T >
T& Ocean::ScopedEvent< T >::scopedLeaveEvent
protected

Leave event which will be invoked if the leave() function has been called before this object is disposed.


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