Home | Download | Screen shots | Discussion | Documentation |
---|
#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_value & | value () const throw () |
A reference to the field_value for the event_emitter . | |
const std::string | eventout_id () const throw () |
The associated eventOut identifier. | |
const listener_set & | listeners () const throw () |
double | last_time () const throw () |
The timestamp of the last event emitted. | |
Protected Member Functions | |
boost::recursive_mutex & | mutex () const throw () |
Get the mutex for the event_emitter . | |
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 const std::string | do_eventout_id () const=0 throw () |
The associated eventOut identifier. | |
virtual void | emit_event (double timestamp)=0 throw ( std::bad_alloc ) |
Emit an event. | |
Private Attributes | |
boost::recursive_mutex | mutex_ |
Object mutex. | |
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 . |
openvrml::event_emitter::~event_emitter | ( | ) | throw () [pure virtual] |
Destroy.
Implemented in openvrml::node_impl_util::abstract_node< Derived >::event_emitter< FieldValue >.
openvrml::event_emitter::event_emitter | ( | const field_value & | value | ) | throw () [explicit, protected] |
const openvrml::field_value & openvrml::event_emitter::value | ( | ) | const throw () |
A reference to the field_value
for the event_emitter
.
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
.
eventOut
identifier. const openvrml::event_emitter::listener_set & openvrml::event_emitter::listeners | ( | ) | const throw () |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
event_listeners
. double openvrml::event_emitter::last_time | ( | ) | const throw () |
The timestamp of the last event emitted.
boost::recursive_mutex & openvrml::event_emitter::mutex | ( | ) | const throw () [protected] |
openvrml::event_emitter::listener_set & openvrml::event_emitter::listeners | ( | ) | throw () [protected] |
void openvrml::event_emitter::last_time | ( | double | t | ) | throw () [protected] |
Set the timestamp of the last event emitted.
[in] | t | the timestamp of the last event emitted. |
const std::string openvrml::event_emitter::do_eventout_id | ( | ) | const throw () [private, pure virtual] |
The associated eventOut
identifier.
Concrete subclasses must implement this function.
Implemented in openvrml::node_impl_util::event_emitter_base< Node >, openvrml::script_node::url_changed_emitter, openvrml::script_node::metadata_changed_emitter, and openvrml::node_impl_util::event_emitter_base< Derived >.
void openvrml::event_emitter::emit_event | ( | double | timestamp | ) | throw ( std::bad_alloc ) [private, pure virtual] |
Emit an event.
[in] | timestamp | the current time. |
std::bad_alloc | if memory allocation fails. |
node::emit_event
.
Implemented in openvrml::field_value_emitter< FieldValue >, openvrml::field_value_emitter< openvrml::mfstring >, and openvrml::field_value_emitter< openvrml::sfnode >.
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.
boost::recursive_mutex openvrml::event_emitter::mutex_ [mutable, private] |
Object mutex.
For internal use only.
const openvrml::field_value & openvrml::event_emitter::value_ [private] |
The listeners registered for this emitter.
For internal use only.
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.
For internal use only.