openvrml::script Class Reference

Abstract class implemented by scripting language bindings. More...

#include <openvrml/script.h>

List of all members.

Public Member Functions

virtual ~script ()=0
 Destroy.
void initialize (double timestamp)
 Initialize the Script node.
void process_event (const std::string &id, const field_value &value, double timestamp)
 Process an event.
void events_processed (double timestamp)
 Execute script code after processing events.
void shutdown (double timestamp)
 Shut down the Script node.

Protected Member Functions

 script (script_node &node)
 Construct.
bool direct_output () const throw ()
 Whether direct output is enabled for the Script node.
bool must_evaluate () const throw ()
 Whether the browser may delay sending input events to the script until its outputs are needed by the browser.
void field (const std::string &id, const field_value &value) throw ( unsupported_interface , std::bad_cast , std::bad_alloc )
 Set the value of a field.
void direct_output (event_listener &listener, const boost::shared_ptr< field_value > &value) throw ( field_value_type_mismatch , std::bad_alloc )
 Add an event for direct output processing at the end of script execution.

Protected Attributes

script_nodenode
 A reference to the script_node that uses this script object.

Private Member Functions

virtual void do_initialize (double timestamp)=0
 Initialize the Script node.
virtual void do_process_event (const std::string &id, const field_value &value, double timestamp)=0
 Process an event.
virtual void do_events_processed (double timestamp)=0
 Execute script code after processing events.
virtual void do_shutdown (double timestamp)=0
 Shut down the Script node.

Detailed Description

Abstract class implemented by scripting language bindings.

The runtime instantiates subclasses of script for each VRML97 Script node; and calls its methods appropriately to execute script code.


Constructor & Destructor Documentation

openvrml::script::~script ( ) [pure virtual]

Destroy.

openvrml::script::script ( script_node node) [explicit, protected]

Construct.

Parameters:
[in]nodea reference to the script_node that uses this script object.

Member Function Documentation

void openvrml::script::initialize ( double  timestamp)

Initialize the Script node.

Delegates to do_initialize.

Parameters:
[in]timestampthe current time.
void openvrml::script::process_event ( const std::string &  id,
const field_value value,
double  timestamp 
)

Process an event.

Delegates to do_process_event.

Parameters:
[in]ideventIn identifier.
[in]valueevent value.
[in]timestampthe current time.
void openvrml::script::events_processed ( double  timestamp)

Execute script code after processing events.

Delegates to do_events_processed.

Parameters:
[in]timestampthe current time.
void openvrml::script::shutdown ( double  timestamp)

Shut down the Script node.

Delegates to do_shutdown.

Parameters:
[in]timestampthe current time.
bool openvrml::script::direct_output ( ) const throw () [protected]

Whether direct output is enabled for the Script node.

Returns:
true if direct output is enabled for the Script node; false otherwise.
bool openvrml::script::must_evaluate ( ) const throw () [protected]

Whether the browser may delay sending input events to the script until its outputs are needed by the browser.

Returns:
true if the browser may delay sending input events to the script until its outputs are needed by the browser; false otherwise.
void openvrml::script::field ( const std::string &  id,
const field_value value 
) throw ( unsupported_interface , std::bad_cast , std::bad_alloc ) [protected]

Set the value of a field.

Parameters:
[in]idfield identifier.
[in]valuenew value.
Exceptions:
unsupported_interfaceif the Script node has no field id.
std::bad_castif value is the wrong type.
std::bad_allocif memory allocation fails.
void openvrml::script::direct_output ( event_listener listener,
const boost::shared_ptr< field_value > &  value 
) throw ( field_value_type_mismatch , std::bad_alloc ) [protected]

Add an event for direct output processing at the end of script execution.

Parameters:
[in]listenerthe event_listener to which the event should be sent.
[in]valuethe value to send.
Exceptions:
field_value_type_mismatchif listener is not the correct type to process events of value's type.
std::bad_allocif memory allocation fails.
void openvrml::script::do_initialize ( double  timestamp) [private, pure virtual]

Initialize the Script node.

Parameters:
[in]timestampthe current time.
void openvrml::script::do_process_event ( const std::string &  id,
const field_value value,
double  timestamp 
) [private, pure virtual]

Process an event.

Parameters:
[in]ideventIn identifier.
[in]valueevent value.
[in]timestampthe current time.
void openvrml::script::do_events_processed ( double  timestamp) [private, pure virtual]

Execute script code after processing events.

Parameters:
[in]timestampthe current time.
void openvrml::script::do_shutdown ( double  timestamp) [private, pure virtual]

Shut down the Script node.

Parameters:
[in]timestampthe current time.

Member Data Documentation

A reference to the script_node that uses this script object.