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

# openvrml::exposedfield< FieldValue > Class Template Reference

Class template to simplify implementation of `exposedFields`. More...

`#include <openvrml/exposedfield.h>`

Inheritance diagram for openvrml::exposedfield< FieldValue >:
[legend]

List of all members.

## Public Member Functions
virtual | ~exposedfield () throw ()
| Destroy.
## Protected Member Functions
| exposedfield (openvrml::node &node, const typename FieldValue::value_type &value=typename FieldValue::value_type())
| Construct.
| exposedfield (const exposedfield< FieldValue > &obj)
| Construct a copy.
## Private Member Functions
virtual void | do_process_event (const FieldValue &value, double timestamp) throw ( std::bad_alloc )
| Process an event.
virtual void | event_side_effect (const FieldValue &value, double timestamp) throw ( std::bad_alloc )
| Called by `exposedfield<FieldValue>::do_process_event`.

## Detailed Description

### template<typename FieldValue>
class openvrml::exposedfield< FieldValue >

Class template to simplify implementation of `exposedFields`.

`exposedfield` conveniently implements an `event_listener` and an `event_emitter`. Trivial `exposedFields` can be implemented simply by instantiating this template with a FieldValue . For the purposes of OpenVRML, a trivial `exposedField` is one that has no side-effects. That is, it simply receives an event, updates an internal value, and fires an `eventOut`. Nontrivial `exposedFields` (i.e., those with side-effects) can generally be implemented by inheriting an instance of this class template and overriding `exposedfield<FieldValue>::event_side_effect`.

Template Parameters:

  | FieldValue | a Field Value.

## Constructor & Destructor Documentation

template<typename FieldValue >

openvrml::exposedfield< FieldValue >::~exposedfield | ( |  | ) | throw ()`[inline, virtual]`

Destroy.

Template Parameters:

  | FieldValue | a Field Value.

Reimplemented in openvrml::node_impl_util::abstract_node< Derived >::exposedfield< FieldValue >, and openvrml::node_impl_util::abstract_node< Derived >::exposedfield< sfnode >.

template<typename FieldValue>

openvrml::exposedfield< FieldValue >::exposedfield | ( | openvrml::node & | node,
|  | const typename FieldValue::value_type & | value = `typename FieldValue::value_type()` |
| ) |  |  | `[inline, protected]`

Construct.

Template Parameters:

  | FieldValue | a Field Value.

Parameters:

  `[in]` | node | a reference to the `node` to which the `exposedField` belongs.
  `[in]` | value | default value.

Reimplemented in openvrml::node_impl_util::abstract_node< Derived >::exposedfield< FieldValue >.

template<typename FieldValue>

openvrml::exposedfield< FieldValue >::exposedfield | ( | const exposedfield< FieldValue > & | obj | ) | `[inline, protected]`

Construct a copy.

Template Parameters:

  | FieldValue | a Field Value.

Parameters:

  `[in]` | obj | the instance to copy.

Reimplemented in openvrml::node_impl_util::abstract_node< Derived >::exposedfield< FieldValue >.

## Member Function Documentation

template<typename FieldValue>

void openvrml::exposedfield< FieldValue >::do_process_event | ( | const FieldValue & | value,
|  | double | timestamp |
| ) |  |  | throw ( std::bad_alloc )`[inline, private, virtual]`

Process an event.

This function performs the following steps:

1. set the `exposedField` value.
2. call `exposedfield<FieldValue>::event_side_effect`.
3. set the modified flag.
4. emit the event.

Warning:
  This function should not be overridden by subclasses. Subclasses should override `exposedfield<FieldValue>::event_side_effect` instead.

Template Parameters:

  | FieldValue | a Field Value.

Parameters:

  `[in]` | value | new value.
  `[in]` | timestamp | the current time.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

Implements openvrml::field_value_listener< FieldValue >.

template<typename FieldValue>

void openvrml::exposedfield< FieldValue >::event_side_effect | ( | const FieldValue & | value,
|  | double | timestamp |
| ) |  |  | throw ( std::bad_alloc )`[inline, private, virtual]`

Called by `exposedfield<FieldValue>::do_process_event`.

Subclasses should override this method to implement event handling functionality specific to a particular `exposedField`. The default implementation of this function does nothing.

Template Parameters:

  | FieldValue | a Field Value.

Parameters:

  `[in]` | value | new value.
  `[in]` | timestamp | the current time.

Exceptions:

  | std::bad_alloc | if memory allocation fails.