## Public API Reference

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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csEventHandlerRegistry Class Reference
[Event handling]

The csEventHandlerRegistry maintains a global one-to-one mapping from strings to csHandlerIDs, and a one-to-(zero or one) mapping from csHandlerIDs to iEventHandler pointers. More...

`#include <csutil/eventhandlers.h>`

Inheritance diagram for csEventHandlerRegistry:

[legend]
List of all members.

## Public Member Functions

csHandlerID const | GetGeneric (csHandlerID id)
| Returns the csHandleID for the generic name for instance name id.
csHandlerID | GetGenericID (const char *)
| Get a csHandlerID based upon some string.
iEventHandler * | GetHandler (csHandlerID id)
| Returns the handler registered for a csHandlerID (will be 0 if csHandlerID is a generic name, i.e., if (!csEventHandlerRegistry->IsInstance(id)).
csHandlerID | GetID (const char *)
| Get the ID for a given event handler name.
csHandlerID | GetID (iEventHandler *)
| Get the csHandlerID for a specified event handler, which provides its own name via the iEventHandler::GetInstanceName() method.
const char * | GetString (csHandlerID id)
| Returns the string name for a csHandlerID.
bool const | IsInstance (csHandlerID id)
| returns true if id is a handler instance (i.e., not a generic name).
bool const | IsInstanceOf (csHandlerID instanceid, csHandlerID genericid)
| returns true if instanceid is a handler instance, genericid is a generic instance, and instanceid is an instance of genericid in particular.
csHandlerID | RegisterID (iEventHandler *)
| Register an event handler to obtain a handler ID.
void | ReleaseID (iEventHandler *)
| Used when an iEventHandler is destroyed to remove our reference.
void | ReleaseID (csHandlerID id)
| Used when an iEventHandler is desroyed to remove our reference.

## Static Public Member Functions

static csHandlerID | GetGeneric (iObjectRegistry *reg, csHandlerID id)
static csHandlerID | GetGenericID (iObjectRegistry *reg, const char *name)
static csHandlerID | GetGenericPostBoundID (iObjectRegistry *reg, csHandlerID id)
static csHandlerID | GetGenericPreBoundID (iObjectRegistry *reg, csHandlerID id)
static iEventHandler * | GetHandler (iObjectRegistry *reg, csHandlerID id)
static csHandlerID | GetID (iObjectRegistry *reg, const char *name)
static csHandlerID | GetID (iObjectRegistry *reg, iEventHandler *h)
static const char * | GetString (iObjectRegistry *reg, csHandlerID id)
static bool | IsInstance (iObjectRegistry *reg, csHandlerID id)
static bool | IsInstanceOf (iObjectRegistry *reg, csHandlerID instanceid, csHandlerID genericid)
static csHandlerID | RegisterID (iObjectRegistry *reg, iEventHandler *h)
static void | ReleaseID (iObjectRegistry *reg, iEventHandler *h)
static void | ReleaseID (iObjectRegistry *reg, csHandlerID id)

## Detailed Description

The csEventHandlerRegistry maintains a global one-to-one mapping from strings to csHandlerIDs, and a one-to-(zero or one) mapping from csHandlerIDs to iEventHandler pointers.

Definition at line 51 of file eventhandlers.h.

## Member Function Documentation

csHandlerID const csEventHandlerRegistry::GetGeneric | ( | csHandlerID | id | ) | `[virtual]`

Returns the csHandleID for the generic name for instance name id.

Implements iEventHandlerRegistry.

csHandlerID csEventHandlerRegistry::GetGenericID | ( | const char * |  | ) | `[virtual]`

Get a csHandlerID based upon some string.

This should only ever be done to reference generic (non-instantiated) handler names or single-instance handlers.

Implements iEventHandlerRegistry.

iEventHandler* csEventHandlerRegistry::GetHandler | ( | csHandlerID | id | ) | `[virtual]`

Returns the handler registered for a csHandlerID (will be 0 if csHandlerID is a generic name, i.e., if (!csEventHandlerRegistry->IsInstance(id)).

Implements iEventHandlerRegistry.

csHandlerID csEventHandlerRegistry::GetID | ( | const char * |  | ) | `[virtual]`

Get the ID for a given event handler name.

This should usually not be used, since it does not handle magic creation of ":pre" and ":post" signpost handlers or any other such bookkeeping magic.

Implements iEventHandlerRegistry.

csHandlerID csEventHandlerRegistry::GetID | ( | iEventHandler * |  | ) | `[virtual]`

Get the csHandlerID for a specified event handler, which provides its own name via the iEventHandler::GetInstanceName() method.

Implements iEventHandlerRegistry.

const char* csEventHandlerRegistry::GetString | ( | csHandlerID | id | ) | `[virtual]`

Returns the string name for a csHandlerID.

Implements iEventHandlerRegistry.

bool const csEventHandlerRegistry::IsInstance | ( | csHandlerID | id | ) | `[virtual]`

returns true if id is a handler instance (i.e., not a generic name).

Implements iEventHandlerRegistry.

bool const csEventHandlerRegistry::IsInstanceOf | ( | csHandlerID | instanceid,
|  | csHandlerID | genericid |
| ) |  |  | `[virtual]`

returns true if instanceid is a handler instance, genericid is a generic instance, and instanceid is an instance of genericid in particular.

Implements iEventHandlerRegistry.

csHandlerID csEventHandlerRegistry::RegisterID | ( | iEventHandler * |  | ) | `[virtual]`

Register an event handler to obtain a handler ID.

Remarks:
  Every call must be balanced with a call to ReleaseID() to ensure proper housekeeping. Otherwise, event handler instances may be leaking.

Implements iEventHandlerRegistry.

void csEventHandlerRegistry::ReleaseID | ( | iEventHandler * |  | ) | `[virtual]`

Used when an iEventHandler is destroyed to remove our reference.

Implements iEventHandlerRegistry.

void csEventHandlerRegistry::ReleaseID | ( | csHandlerID | id | ) | `[virtual]`

Used when an iEventHandler is desroyed to remove our reference.

Implements iEventHandlerRegistry.

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

- csutil/eventhandlers.h