Home | Download | Screen shots | Discussion | Documentation
--- | --- | --- | --- | ---

Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class Members | Related Pages

# openvrml::event_emitter Class Reference

Inheritance diagram for openvrml::event_emitter:

[legend]
List of all members.

## Detailed Description

Abstract base class of event emitters.

## Public Types

typedef std::set< event_listener * > | listener_set
| Set of event_listeners.

## Public Member Functions

virtual | ~event_emitter ()=0 throw ()
| Destroy.
const field_value & | value () const throw ()
| A reference to the `field_value` for the `event_emitter`.
const listener_set & | listeners () const throw ()
| Registered listeners.
double | last_time () const throw ()
| The timestamp of the last event emitted.

## Static Public Member Functions

static std::auto_ptr< event_emitter > | create (const field_value &value) throw (std::bad_alloc)
| Create an event_emitter.

## Protected Member Functions

listener_set & | listeners () throw ()
| Registered listeners.
void | last_time (double t) throw ()
| Set the timestamp of the last event emitted.
| event_emitter (const field_value &value) throw ()
| Construct.

## Private Member Functions

virtual void | emit_event (double timestamp)=0 throw (std::bad_alloc)
| Emit an event.

## Private Attributes

const field_value & | value_
| A reference to the field_value for the event_emitter.
std::set< event_listener * > | listeners_
| The listeners registered for this emitter.
double | last_time_
| The timestamp of the last event emitted.

## Friends

class | node
| The implementation of `node` calls `event_emitter::emit_event`.

## Member Typedef Documentation

openvrml::event_emitter::listener_set

| Set of event_listeners.

## Constructor & Destructor Documentation

openvrml::event_emitter::~event_emitter | ( |  | ) | throw ()`[pure virtual]`

| Destroy.

openvrml::event_emitter::event_emitter | ( | const field_value & | value | ) | throw ()`[explicit, protected]`

Construct.

Parameters:

  | value | field_value associated with this emitter.

## Member Function Documentation

std::auto_ptr< event_emitter > openvrml::event_emitter::create | ( | const field_value & | value | ) | throw (std::bad_alloc)`[static]`

Create an event_emitter.

Parameters:

  | value | value to emit.

Returns:
  an event_emitter.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

const field_value & openvrml::event_emitter::value | ( |  | ) | const throw ()

A reference to the `field_value` for the `event_emitter`.

Returns:
  a reference to the `field_value` for the `event_emitter`.

const event_emitter::listener_set & openvrml::event_emitter::listeners | ( |  | ) | const throw ()

Registered listeners.

Returns:
  the set of registered event_listeners.

double openvrml::event_emitter::last_time | ( |  | ) | const throw ()

The timestamp of the last event emitted.

Returns:
  the timestamp of the last event emitted.

event_emitter::listener_set & openvrml::event_emitter::listeners | ( |  | ) | throw ()`[protected]`

Registered listeners.

Returns:
  the set of registered event_listeners.

void openvrml::event_emitter::last_time | ( | double | t | ) | throw ()`[protected]`

Set the timestamp of the last event emitted.

Parameters:

  | t | the timestamp of the last event emitted.

void openvrml::event_emitter::emit_event | ( | double | timestamp | ) | throw (std::bad_alloc)`[private, pure virtual]`

Emit an event.

Parameters:

  | timestamp | the current time.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

This function is called by node::emit_event.

Implemented in openvrml::field_value_emitter< FieldValue >, openvrml::field_value_emitter< mfcolor >, openvrml::field_value_emitter< sffloat >, openvrml::field_value_emitter< sftime >, openvrml::field_value_emitter< sfstring >, openvrml::field_value_emitter< mfnode >, openvrml::field_value_emitter< mfrotation >, openvrml::field_value_emitter< mfvec2f >, openvrml::field_value_emitter< mfvec3f >, openvrml::field_value_emitter< sfcolor >, openvrml::field_value_emitter< mffloat >, openvrml::field_value_emitter< sfbool >, openvrml::field_value_emitter< sfimage >, openvrml::field_value_emitter< mfstring >, openvrml::field_value_emitter< sfnode >, openvrml::field_value_emitter< sfrotation >, openvrml::field_value_emitter< sfvec2f >, openvrml::field_value_emitter< sfint32 >, and openvrml::field_value_emitter< sfvec3f >.

## Friends And Related Function Documentation

class openvrml::event_emitter::node`[friend]`

| The implementation of `node` calls `event_emitter::emit_event`. The only things that should be emitting events are `node`s. Subclasses of `node` should call `node::emit_event` to emit an event.

## Member Data Documentation

const field_value & openvrml::event_emitter::value_ `[private]`

| A reference to the field_value for the event_emitter. For internal use only.

event_emitter::listener_set openvrml::event_emitter::listeners_ `[private]`

| The listeners registered for this emitter. When emit_event is called, each of the registered listeners will be sent an event.

double openvrml::event_emitter::last_time_ `[private]`

| The timestamp of the last event emitted.