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

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

# openvrml::node_class Class Reference
[Nodes]

Inheritance diagram for openvrml::node_class:

[legend]
List of all members.

## Detailed Description

A class object for node instances.

`node_class` can be thought of as a "supertype" of sorts. A given node implementation can support as many node types as there are unique combinations of the interfaces it supports. The most readily apparent role of the `node_class` object for a node implementation is to serve as a factory for these `node_type`s.

## Public Member Functions

virtual | ~node_class ()=0 throw ()
| Destructor.
openvrml::browser & | browser () const throw ()
| The `browser` associated with this `node_class`.
void | initialize (viewpoint_node *initial_viewpoint, double time) throw ()
| `node_class`-specific initialization.
void | render (viewer &v) const throw ()
| `node_class`-specific rendering.
const node_type_ptr | create_type (const std::string &id, const node_interface_set &interfaces) throw (unsupported_interface, std::bad_alloc)
| Create a new `node_type`.

## Protected Member Functions

| node_class (openvrml::browser &b) throw ()
| Constructor.

## Private Member Functions

virtual void | do_initialize (viewpoint_node *initial_viewpoint, double time) throw ()
| `node_class`-specific initialization.
virtual void | do_render (viewer &v) const throw ()
| `node_class`-specific rendering.
virtual const node_type_ptr | do_create_type (const std::string &id, const node_interface_set &interfaces) const =0 throw (unsupported_interface, std::bad_alloc)
| Create a new `node_type`.

## Private Attributes

openvrml::browser * | browser_
| The browser associated with this `node_class`.

## Constructor & Destructor Documentation

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

| Destructor.

openvrml::node_class::node_class | ( | openvrml::browser & | b | ) | throw ()`[explicit, protected]`

Constructor.

A `node_class` is constructed using a `browser`. All `node` instances that share a particular `node_class` "belong to" the `browser` associated with the `node_class`.

Parameters:

  | b | the `browser` to be associated with the `node_class`.

## Member Function Documentation

browser & openvrml::node_class::browser | ( |  | ) | const throw ()

The `browser` associated with this `node_class`.

Returns:
  the `browser` associated with this `node_class`.

void openvrml::node_class::initialize | ( | viewpoint_node * | initial_viewpoint,
|  | double | time
| ) | throw ()

`node_class`-specific initialization.

This method is called during initialization of a `browser` object with a new root `scene`. It is called after the individual `node` instances have been initialized, and before the world starts running. It delegates to `node_class::do_initialize`.

Parameters:

  | initial_viewpoint | the `viewpoint_node` that should be bound initially; or 0 if the default `viewpoint_node` should be bound.
  | time | the current time.

void openvrml::node_class::render | ( | viewer & | v | ) | const throw ()

`node_class`-specific rendering.

This function delegates to `node_class::do_render`.

Parameters:

  | v | the viewer to render to.

const node_type_ptr openvrml::node_class::create_type | ( | const std::string & | id,
|  | const node_interface_set & | interfaces
| ) | throw (unsupported_interface, std::bad_alloc)

Create a new `node_type`.

`node_type`s can be said to subset the master type provided by the `node_class`. Each `node_class` instance can support certain `node` interfaces; the `node_interface_set` passed to `node_class::create_type` must be a subset of those supported interfaces.

This function delegates to `node_class::do_create_type`.

Parameters:

  | id | the name for the new `node_type`.
  | interfaces | a `node_interface_set` containing the interfaces for the new type.

Returns:
  a `node_type_ptr` to the newly created `node_type`.

Exceptions:

  | unsupported_interface | if the `node_class` cannot support one of the `node_interface`s in `interfaces`.
  | std::bad_alloc | if memory allocation fails.

void openvrml::node_class::do_initialize | ( | viewpoint_node * | initial_viewpoint,
|  | double | time
| ) | throw ()`[private, virtual]`

`node_class`-specific initialization.

Node implementations should override this method to perform any `node_class`-wide initialization.

Parameters:

  | initial_viewpoint | the `viewpoint_node` that should be bound initially; or 0 if the default `viewpoint_node` should be bound.
  | time | the current time.

See also:
  node_class::initialize

Reimplemented in openvrml::vrml97_node::viewpoint_class.

void openvrml::node_class::do_render | ( | viewer & | v | ) | const throw ()`[private, virtual]`

`node_class`-specific rendering.

The default implementation of this method does nothing.

Parameters:

  | v | the viewer to render to.

See also:
  node_class::render

Reimplemented in openvrml::vrml97_node::background_class, and openvrml::vrml97_node::fog_class.

const node_type_ptr openvrml::node_class::do_create_type | ( | const std::string & | id,
|  | const node_interface_set & | interfaces
| ) | const throw (unsupported_interface, std::bad_alloc)`[private, pure virtual]`

Create a new `node_type`.

Parameters:

  | id | the name for the new `node_type`.
  | interfaces | a `node_interface_set` containing the interfaces for the new type.

Returns:
  a `node_type_ptr` to the newly created `node_type`.

Exceptions:

  | unsupported_interface | if the `node_class` cannot support one of the `node_interface`s in `interfaces`.
  | std::bad_alloc | if memory allocation fails.

See also:
  node_class::create_type

Implemented in openvrml::script_node_class, openvrml::vrml97_node::group_class, openvrml::vrml97_node::anchor_class, openvrml::vrml97_node::appearance_class, openvrml::vrml97_node::audio_clip_class, openvrml::vrml97_node::background_class, openvrml::vrml97_node::billboard_class, openvrml::vrml97_node::box_class, openvrml::vrml97_node::collision_class, openvrml::vrml97_node::color_class, openvrml::vrml97_node::color_interpolator_class, openvrml::vrml97_node::cone_class, openvrml::vrml97_node::coordinate_class, openvrml::vrml97_node::coordinate_interpolator_class, openvrml::vrml97_node::cylinder_class, openvrml::vrml97_node::cylinder_sensor_class, openvrml::vrml97_node::directional_light_class, openvrml::vrml97_node::elevation_grid_class, openvrml::vrml97_node::extrusion_class, openvrml::vrml97_node::fog_class, openvrml::vrml97_node::font_style_class, openvrml::vrml97_node::image_texture_class, openvrml::vrml97_node::indexed_face_set_class, openvrml::vrml97_node::indexed_line_set_class, openvrml::vrml97_node::inline_class, openvrml::vrml97_node::lod_class, openvrml::vrml97_node::material_class, openvrml::vrml97_node::movie_texture_class, openvrml::vrml97_node::navigation_info_class, openvrml::vrml97_node::normal_class, openvrml::vrml97_node::normal_interpolator_class, openvrml::vrml97_node::orientation_interpolator_class, openvrml::vrml97_node::pixel_texture_class, openvrml::vrml97_node::plane_sensor_class, openvrml::vrml97_node::point_light_class, openvrml::vrml97_node::point_set_class, openvrml::vrml97_node::position_interpolator_class, openvrml::vrml97_node::proximity_sensor_class, openvrml::vrml97_node::scalar_interpolator_class, openvrml::vrml97_node::shape_class, openvrml::vrml97_node::sound_class, openvrml::vrml97_node::sphere_class, openvrml::vrml97_node::sphere_sensor_class, openvrml::vrml97_node::spot_light_class, openvrml::vrml97_node::switch_class, openvrml::vrml97_node::text_class, openvrml::vrml97_node::texture_coordinate_class, openvrml::vrml97_node::texture_transform_class, openvrml::vrml97_node::time_sensor_class, openvrml::vrml97_node::touch_sensor_class, openvrml::vrml97_node::transform_class, openvrml::vrml97_node::viewpoint_class, openvrml::vrml97_node::visibility_sensor_class, and openvrml::vrml97_node::world_info_class.

## Member Data Documentation

openvrml::browser * openvrml::node_class::browser_ `[private]`

| The browser associated with this `node_class`. For internal use only.