NEvent1 Class Template Reference

NEvent1 class abstracts the concept of an event, notifying the handlers whenever an event happens. More...

Inheritance diagram for NEvent1:

NSignal1

List of all members.

Public Types

typedef NMap< nint32,
NEventHandlerBase1< Param1 > * > 
HandlersMap
 Type definition for the event handlers map.

Public Member Functions

 NEvent1 ()
 Creates a NEvent1 object.
virtual ~NEvent1 ()
 Destroys a NEvent1 object.
template<typename ListenerT>
NEventId attach (ListenerT *object, void(ListenerT::*member)(Param1))
 Attaches a handler to the event.
bool detach (NEventId id)
 Detaches a handler from the event.
bool isAttached (NEventId id)
 Checks whether a handler is attached.
void notify (Param1 param) const
 Notify all the attached handlers.


Detailed Description

template<typename Param1>
class NEvent1< Param1 >

NEvent1 class abstracts the concept of an event, notifying the handlers whenever an event happens.

See also:
See the files in examples/raven for examples

Definition at line 36 of file nevent1.hpp.


Member Function Documentation

NEventId attach ( ListenerT *  object,
void(ListenerT::*)(Param1)  member 
) [inline]

Attaches a handler to the event.

Parameters:
object Pointer to the object that will react to an event
(ListenerT::*member)(Param1) Member function pointer to be executed on response of a event

Definition at line 108 of file nevent1.hpp.

References NMap::insert().

bool detach ( NEventId  id  )  [inline]

Detaches a handler from the event.

Parameters:
id Handler id
Returns:
true is successfully detached or false otherwise

Definition at line 124 of file nevent1.hpp.

References NMap::end(), NMap::erase(), NMap::find(), and NMap::iterator::value().

Referenced by NSlot1::~NSlot1().

bool isAttached ( NEventId  id  )  [inline]

Checks whether a handler is attached.

Parameters:
id Handler id to be checked against the event
Returns:
true if it's attached or false otherwise

Definition at line 140 of file nevent1.hpp.

References NMap::end(), and NMap::find().

Referenced by NSignal1::~NSignal1().

void notify ( Param1  param  )  const [inline]

Notify all the attached handlers.

Parameters:
param Any given parameter to be passed to the handlers

Definition at line 145 of file nevent1.hpp.

References NMap::constBegin(), and NMap::constEnd().

Referenced by NSignal1::emit_sig().


The documentation for this class was generated from the following file:
Generated on Wed Mar 5 23:10:36 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4