csBaseEventHandler::EventHandlerImpl Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Friends
csBaseEventHandler::EventHandlerImpl Class Reference

Actual iEventHandler implementation. More...

`#include <csutil/csbaseeventh.h>`

Inheritance diagram for csBaseEventHandler::EventHandlerImpl:

List of all members.

## Public Member Functions
virtual csHandlerID | GenericID (csRef< iEventHandlerRegistry > &reg) const
| This function returns a csHandlerID corresponding with GenericName, i.e., it should always return csHandlerRegistry::GetGenericID (this->GenericName()).
virtual const char * | GenericName () const
| This function returns a string which "names" this event handler generically (i.e., it identifies all instances of this event handler as a group).
virtual const csHandlerID * | GenericPrec (csRef< iEventHandlerRegistry > &hreg, csRef< iEventNameRegistry > &nreg, csEventID id) const
| This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called before this one (if they have been instantiated).
virtual const csHandlerID * | GenericSucc (csRef< iEventHandlerRegistry > &hreg, csRef< iEventNameRegistry > &nreg, csEventID id) const
| This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called after this one (if they have been instantiated).
virtual bool | HandleEvent (iEvent &event)
| This is the basic event handling function.
virtual const csHandlerID * | InstancePrec (csRef< iEventHandlerRegistry > &hreg, csRef< iEventNameRegistry > &nreg, csEventID id) const
| This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called before this one.
virtual const csHandlerID * | InstanceSucc (csRef< iEventHandlerRegistry > &hreg, csRef< iEventNameRegistry > &nreg, csEventID id) const
| This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called after this one.
## Friends
class | csBaseEventHandler

## Detailed Description

Actual iEventHandler implementation.

This is in a wrapper class so it can be properly refcounted and the csBaseEventHandler can be used in co-inheritance with non-refcounted classes.

Definition at line 74 of file csbaseeventh.h.

## Member Function Documentation

virtual csHandlerID csBaseEventHandler::EventHandlerImpl::GenericID | ( | csRef< iEventHandlerRegistry > & |  | ) | const`[inline, virtual]`

This function returns a csHandlerID corresponding with GenericName, i.e., it should always return csHandlerRegistry::GetGenericID (this->GenericName()).

Normally, it will actually wrap a static method StaticID() which can be used to reference a class of event handlers abstractly without it having been instantiated. Usually, you will want to use the CS_EVENTHANDLER_NAMES macro instead of defining this yourself.

See also:
  iEventHandler::GenericName
  CS_EVENTHANDLER_NAMES

Implements iEventHandler.

Definition at line 91 of file csbaseeventh.h.

virtual const char* csBaseEventHandler::EventHandlerImpl::GenericName | ( |  | ) | const`[inline, virtual]`

This function returns a string which "names" this event handler generically (i.e., it identifies all instances of this event handler as a group).

For example, the core application logic would be "application", a window system plugin would be "crystalspace.windowsystem", etc. This is used, in combination with the GenericPrec, GenericSucc, InstancePrec, and InstanceSucc functions, by the subscription scheduler to establish the order in which event handlers are to be called.

Too bad C++ doesn't allow virtual static functions, because this would be one. To make up for this, it is conventional to also define a static method StaticHandlerName() which can be used to reference a class of event handlers abstractly without it having been instantiated, e.g., csBaseEventHandler::StaticHandlerName().

The csEventHandlerRegistry also uses this method to construct a unique instance name for each iEventHandler.

Usually, you will want to use the CS_EVENTHANDLER_NAMES macro instead of defining this yourself.

See also:
  csHandlerRegistry::GetID
  csHandlerRegistry::ReleaseID
  CS_EVENTHANDLER_NAMES

Implements iEventHandler.

Definition at line 86 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::EventHandlerImpl::GenericPrec | ( | csRef< iEventHandlerRegistry > & | ,
|  | csRef< iEventNameRegistry > & | ,
|  | csEventID |
| ) |  | const`[inline, virtual]`

This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called before this one (if they have been instantiated).

Should only return generic identifiers, not instance identifiers; in other words, every member of the array should be the result of a call to csHandlerRegistry::GetGenericID("name"), where "name" may be some class's static GenericName() function or a literal string.

This should also be a "virtual static" function, but C++ doesn't have them.

Implements iEventHandler.

Definition at line 97 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::EventHandlerImpl::GenericSucc | ( | csRef< iEventHandlerRegistry > & | ,
|  | csRef< iEventNameRegistry > & | ,
|  | csEventID |
| ) |  | const`[inline, virtual]`

This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called after this one (if they have been instantiated).

Should only return generic identifiers, not instance identifiers; in other words, every member of the array should be the result of a call to csHandlerRegistry::GetGenericID("name"), where "name" may be some class's static GenericString() function or a literal string.

This should also be a "virtual static" function, but C++ doesn't have them.

Implements iEventHandler.

Definition at line 104 of file csbaseeventh.h.

virtual bool csBaseEventHandler::EventHandlerImpl::HandleEvent | ( | iEvent & |  | ) | `[inline, virtual]`

This is the basic event handling function.

To receive events, a component must implement iEventHandler and register with an event queue using iEventQueue::RegisterListener() and iEventQueue::Subscribe(). The event handler should return true if the event was handled. Returning true prevents the event from being passed along to other event handlers (unless the event's Broadcast flag has been set, in which case it is sent to all subscribers regardless of the return value). If the event was not handled, then false should be returned, in which case other event handlers are given a shot at the event. Do not return true unless you really handled the event and want event dispatch to stop at your handler.

Implements iEventHandler.

Definition at line 81 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::EventHandlerImpl::InstancePrec | ( | csRef< iEventHandlerRegistry > & | ,
|  | csRef< iEventNameRegistry > & | ,
|  | csEventID |
| ) |  | const`[inline, virtual]`

This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called before this one.

May include both generic and instance identifiers, i.e., the results of both csHandlerRegistry::GetGenericID() and csHandlerRegistry::GetID() calls.

If the instance constraints are the same as the generic ones, use the CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS macro instead of defining this for yourself.

See also:
  CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS

Implements iEventHandler.

Definition at line 111 of file csbaseeventh.h.

virtual const csHandlerID* csBaseEventHandler::EventHandlerImpl::InstanceSucc | ( | csRef< iEventHandlerRegistry > & | ,
|  | csRef< iEventNameRegistry > & | ,
|  | csEventID |
| ) |  | const`[inline, virtual]`

This function takes a csEventID as an argument and returns an array of csHandlerIDs identifying those event handlers which must, for the given event, only be called after this one.

May include both generic and instance identifiers, i.e., the results of both csHandlerRegistry::GetGenericID() and csHandlerRegistry::GetID() calls.

If the instance constraints are the same as the generic ones, use the CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS macro instead of defining this for yourself.

See also:
  CS_EVENTHANDLER_DEFAULT_INSTANCE_CONSTRAINTS

Implements iEventHandler.

Definition at line 118 of file csbaseeventh.h.

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

- csutil/csbaseeventh.h