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

# openvrml::node_type Class Reference

Type information object for `nodes`. More...

`#include <openvrml/node.h>`

Inheritance diagram for openvrml::node_type:
[legend]

List of all members.

## Public Member Functions
virtual | ~node_type ()=0 throw ()
| Destructor.
const node_metatype & | metatype () const throw ()
| The class object associated with the `node_type`.
const std::string & | id () const throw ()
| The name of the `node_type`.
const node_interface_set & | interfaces () const throw ()
| Get the set of interfaces for the `node_type`.
const boost::intrusive_ptr< node > | create_node (const boost::shared_ptr< scope > &scope, const initial_value_map &initial_values=initial_value_map()) const throw ( unsupported_interface , std::bad_cast , std::bad_alloc )
| Create a new node with this `node_type`.
## Protected Member Functions
| node_type (const node_metatype &c, const std::string &id) throw ( std::bad_alloc )
| Constructor.
## Private Member Functions
virtual const node_interface_set & | do_interfaces () const =0 throw ()
| Get the set of interfaces for the `node_type`.
virtual const boost::intrusive_ptr< node > | do_create_node (const boost::shared_ptr< scope > &scope, const initial_value_map &initial_values) const =0 throw ( unsupported_interface , std::bad_cast , std::bad_alloc )
| Create a new node with this `node_type`.
## Private Attributes
const node_metatype & | metatype_
| The class object associated with the `node_type`.
const std::string | id_
| The name of the `node_type`.
## Related Functions
(Note that these are not member functions.)
bool | operator!= (const node_type &lhs, const node_type &rhs) throw()
| Compare for inequality.

## Detailed Description

Type information object for `nodes`.

## Constructor & Destructor Documentation

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

Destructor.

openvrml::node_type::node_type | ( | const node_metatype & | c,
|  | const std::string & | id |
| ) |  |  | throw ( std::bad_alloc )`[protected]`

Constructor.

Parameters:

  `[in]` | c | the class object associated with the `node_type`.
  `[in]` | id | the name for the `node_type`.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

## Member Function Documentation

const openvrml::node_metatype & openvrml::node_type::metatype | ( |  | ) | const throw ()

The class object associated with the `node_type`.

Returns:
  the class object associated with the `node_type`.

const std::string & openvrml::node_type::id | ( |  | ) | const throw ()

The name of the `node_type`.

Returns:
  the name of the `node_type`.

const openvrml::node_interface_set & openvrml::node_type::interfaces | ( |  | ) | const throw ()

Get the set of interfaces for the `node_type`.

This function delegates to `do_interfaces`.

Returns:
  the set of interfaces.

const boost::intrusive_ptr< openvrml::node > openvrml::node_type::create_node | ( | const boost::shared_ptr< scope > & | scope,
|  | const initial_value_map & | initial_values = `initial_value_map()` |
| ) |  |  | const throw ( unsupported_interface , std::bad_cast , std::bad_alloc )

Create a new node with this `node_type`.

Parameters:

  `[in]` | scope | the `scope` to which the new `node` should belong.
  `[in]` | initial_values | a map of initial values for the `node`'s fields and `exposedFields`.

Returns:
  a `boost::intrusive_ptr` to a new node.

Exceptions:

  | unsupported_interface | if `initial_values` specifies a field name that is not supported by the node type.
  | std::bad_cast | if a value in `initial_values` is the wrong type.
  | std::bad_alloc | if memory allocation fails.

See also:
  http://boost.org/libs/smart_ptr/intrusive_ptr.html

const openvrml::node_interface_set & openvrml::node_type::do_interfaces | ( |  | ) | const throw ()`[private, pure virtual]`

Get the set of interfaces for the `node_type`.

Subclasses must implement this function.

Returns:
  the set of interfaces.

Implemented in openvrml::null_node_type, openvrml::node_impl_util::node_type_impl< Node >, and openvrml::script_node::script_node_type.

const boost::intrusive_ptr< openvrml::node > openvrml::node_type::do_create_node | ( | const boost::shared_ptr< scope > & | scope,
|  | const initial_value_map & | initial_values |
| ) |  |  | const throw ( unsupported_interface , std::bad_cast , std::bad_alloc )`[private, pure virtual]`

Create a new node with this `node_type`.

Subclasses must implement this function.

Parameters:

  `[in]` | scope | the `scope` to which the new `node` should belong.
  `[in]` | initial_values | a map of initial values for the `node`'s fields and `exposedFields`.

Returns:
  a `boost::intrusive_ptr` to a new node.

Exceptions:

  | unsupported_interface | if `initial_values` specifies a field name that is not supported by the node type.
  | std::bad_cast | if a value in `initial_values` is the wrong type.
  | std::bad_alloc | if memory allocation fails.

See also:
  http://boost.org/libs/smart_ptr/intrusive_ptr.html

## Friends And Related Function Documentation

bool operator!= | ( | const node_type & | lhs,
|  | const node_type & | rhs |
| ) |  |  | throw()`[related]`

Compare for inequality.

Parameters:

  `[in]` | lhs |
  `[in]` | rhs |

Returns:
  `true` if `lhs` and `rhs` are not equal; `false` otherwise.

## Member Data Documentation

openvrml::node_metatype & openvrml::node_type::metatype_`[private]`

The class object associated with the `node_type`.

For internal use only.

const std::string openvrml::node_type::id_`[private]`

The name of the `node_type`.

For internal use only.