openvrml::event_emitter Class Reference

Abstract base class of event emitters. More...

#include <openvrml/event.h>

Inheritance diagram for openvrml::event_emitter:

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 std::string eventout_id () const throw ()
 The associated eventOut identifier.
double last_time () const throw ()
 The timestamp of the last event emitted.
template<typename FieldValue >
bool add (field_value_listener< FieldValue > &listener) throw ( std::bad_alloc )
 Add an event listener.
template<typename FieldValue >
bool remove (field_value_listener< FieldValue > &listener) throw ()
 Remove an event listener.

Protected Member Functions

 event_emitter (const field_value &value) throw ()
 Construct.
template<typename FieldValue >
const std::set
< field_value_listener
< FieldValue > * > 
listeners () const throw ( std::bad_alloc )
 The event listeners currently listening to the emitter.
template<typename FieldValue >
void emit_event (double timestamp) throw ( std::bad_alloc )
 Emit an event.

Private Member Functions

virtual const std::string do_eventout_id () const =0 throw ()
 The associated eventOut identifier.

Detailed Description

Abstract base class of event emitters.

Member Typedef Documentation

Constructor & Destructor Documentation

openvrml::event_emitter::~event_emitter ( ) throw ()
pure virtual
openvrml::event_emitter::event_emitter ( const field_value value) throw ()
explicitprotected

Construct.

Parameters
[in]valuefield_value associated with this emitter.

Member Function Documentation

const openvrml::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 std::string openvrml::event_emitter::eventout_id ( ) const throw ()

The associated eventOut identifier.

This function delegates to event_emitter::do_eventout_id.

Returns
the associated eventOut identifier.
double openvrml::event_emitter::last_time ( ) const throw ()

The timestamp of the last event emitted.

Returns
the timestamp of the last event emitted.
template<typename FieldValue >
bool openvrml::event_emitter::add ( field_value_listener< FieldValue > &  listener) throw ( std::bad_alloc )

Add an event listener.

Template Parameters
FieldValuea Field Value.
Parameters
[in]listeneran event listener.
Exceptions
std::bad_allocif memory allocation fails.

Reimplemented in openvrml::field_value_emitter< FieldValue >.

template<typename FieldValue >
bool openvrml::event_emitter::remove ( field_value_listener< FieldValue > &  listener) throw ()

Remove an event listener.

Template Parameters
FieldValuea Field Value.
Parameters
[in]listeneran event listener.

Reimplemented in openvrml::field_value_emitter< FieldValue >.

template<typename FieldValue >
const std::set< field_value_listener< FieldValue > * > openvrml::event_emitter::listeners ( ) const throw ( std::bad_alloc )
protected

The event listeners currently listening to the emitter.

Template Parameters
FieldValuea Field Value.
Returns
the event listeners currently listening to the emitter.

Reimplemented in openvrml::field_value_emitter< FieldValue >, and openvrml::field_value_emitter< sfnode >.

template<typename FieldValue >
void openvrml::event_emitter::emit_event ( double  timestamp) throw ( std::bad_alloc )
protected

Emit an event.

Template Parameters
FieldValuea Field Value.
Parameters
[in]timestampthe current time.
Exceptions
std::bad_allocif memory allocation fails.
Parameters
[in]timestampthe current time.
Exceptions
std::bad_allocif memory allocation fails.

This function is called by node::emit_event.

const std::string openvrml::event_emitter::do_eventout_id ( ) const throw ()
privatepure virtual

The associated eventOut identifier.

Concrete subclasses must implement this function.

Returns
the associated eventOut identifier.