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_valuevalue () const throw ()
 A reference to the field_value for the event_emitter.
const listener_setlisteners () 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_emittercreate (const field_value &value) throw (std::bad_alloc)
 Create an event_emitter.

Protected Member Functions

listener_setlisteners () 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_valuevalue_
 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

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]


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 nodes. Subclasses of node should call node::emit_event to emit an event.


Member Data Documentation

A reference to the field_value for the event_emitter.

For internal use only.

The listeners registered for this emitter.

When emit_event is called, each of the registered listeners will be sent an event.

The timestamp of the last event emitted.