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

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

# openvrml::field_value Class Reference
[Field Values]

Inheritance diagram for openvrml::field_value:

[legend]
List of all members.

## Detailed Description

Abstract base class for the VRML field types.

## Public Types

enum | type_id { invalid_type_id, sfbool_id, sfcolor_id, sffloat_id, sfimage_id, sfint32_id, sfnode_id, sfrotation_id, sfstring_id, sftime_id, sfvec2f_id, sfvec3f_id, mfcolor_id, mffloat_id, mfint32_id, mfnode_id, mfrotation_id, mfstring_id, mftime_id, mfvec2f_id, mfvec3f_id }
| Used to identify field_value types. More...

## Public Member Functions

virtual | ~field_value ()=0 throw ()
| Destroy.
virtual std::auto_ptr< field_value > | clone () const =0 throw (std::bad_alloc)
| Virtual copy constructor.
virtual field_value & | assign (const field_value &value)=0 throw (std::bad_cast, std::bad_alloc)
| Virtual assignment.
virtual type_id | type () const =0 throw ()
| Get the field type.

## Static Public Member Functions

static std::auto_ptr< field_value > | create (type_id type) throw (std::bad_alloc)
| Create a default instance of the type specified by `type`.

## Protected Member Functions

| field_value () throw ()
| Construct.
| field_value (const field_value &value) throw ()
| Copy constructor.
field_value & | operator= (const field_value &value) throw ()
| Assignment operator.

## Private Member Functions

virtual void | print (std::ostream &out) const =0
| Print to an output stream.

## Friends

std::ostream & | operator<< (std::ostream &out, const field_value &value)
| Stream output.

## Related Functions

(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &out, const field_value::type_id type_id)
| Stream output.
std::istream & | operator>> (std::istream &in, field_value::type_id &type_id)
| Stream input.

## Member Enumeration Documentation

enum openvrml::field_value::type_id

Used to identify field_value types.

These tags are typically used to designate an expected type or to avoid a `dynamic_cast`.

Enumerator:

  invalid_type_id | Zero value typically used to indicate failure.
  sfbool_id | Designates an sfbool.
  sfcolor_id | Designates an sfcolor.
  sffloat_id | Designates an sffloat.
  sfimage_id | Designates an sfimage.
  sfint32_id | Designates an sfint32.
  sfnode_id | Designates an sfnode.
  sfrotation_id | Designates an sfrotation.
  sfstring_id | Designates an sfstring.
  sftime_id | Designates an sftime.
  sfvec2f_id | Designates an sfvec2f.
  sfvec3f_id | Designates an sfvec3f.
  mfcolor_id | Designates an mfcolor.
  mffloat_id | Designates an mffloat.
  mfint32_id | Designates an mfint32.
  mfnode_id | Designates an mfnode.
  mfrotation_id | Designates an mfrotation.
  mfstring_id | Designates an mfstring.
  mftime_id | Designates an mftime.
  mfvec2f_id | Designates an mfvec2f.
  mfvec3f_id | Designates an mfvec3f.

## Constructor & Destructor Documentation

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

| Destroy.

openvrml::field_value::field_value | ( |  | ) | throw ()`[protected]`

| Construct.

openvrml::field_value::field_value | ( | const field_value & | value | ) | throw ()`[protected]`

Copy constructor.

Parameters:

  | value | field value to copy.

## Member Function Documentation

std::auto_ptr< field_value > openvrml::field_value::create | ( | type_id | type | ) | throw (std::bad_alloc)`[static]`

Create a default instance of the type specified by `type`.

Parameters:

  | type | field value type identifier.

Returns:
  a default instance of the type specified by `type`.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

std::auto_ptr< field_value > openvrml::field_value::clone | ( |  | ) | const throw (std::bad_alloc)`[pure virtual]`

Virtual copy constructor.

Returns:
  a new field_value identical to this one.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sffloat, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec3f, openvrml::mfcolor, openvrml::mffloat, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, and openvrml::mfvec3f.

field_value & openvrml::field_value::assign | ( | const field_value & | value | ) | throw (std::bad_cast, std::bad_alloc)`[pure virtual]`

Virtual assignment.

Parameters:

  | value | the value to assign to the object.

Returns:
  this object.

Exceptions:

  | std::bad_cast | if `value` is not of the same concrete type as this object.
  | std::bad_alloc | if memory allocation fails.

Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sffloat, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec3f, openvrml::mfcolor, openvrml::mffloat, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, and openvrml::mfvec3f.

field_value::type_id openvrml::field_value::type | ( |  | ) | const throw ()`[pure virtual]`

Get the field type.

Returns:
  the type_id enumerant corresponding to the field_value's type

Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sffloat, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec3f, openvrml::mfcolor, openvrml::mffloat, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, and openvrml::mfvec3f.

field_value & openvrml::field_value::operator= | ( | const field_value & | value | ) | throw ()`[protected]`

Assignment operator.

Parameters:

  | value | field value to assign.

void openvrml::field_value::print | ( | std::ostream & | out | ) | const`[private, pure virtual]`

Print to an output stream.

Parameters:

  | out | an output stream.

Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sffloat, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec3f, openvrml::mfcolor, openvrml::mffloat, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, and openvrml::mfvec3f.

## Friends And Related Function Documentation

std::ostream& operator<< | ( | std::ostream & | out,
|  | const field_value & | value
| ) | `[friend]`

Stream output.

Parameters:

  | out | an output stream.
  | value | a field value.

Returns:
  `out`.

std::ostream & operator<< | ( | std::ostream & | out,
|  | const field_value::type_id | type_id
| ) | `[related]`

Stream output.

If `type` is field_value::invalid_type, `failbit` is set on `out`.

Parameters:

  | out | output stream.
  | type_id | field_value type identifier.

Returns:
  `out`.

std::istream & operator>> | ( | std::istream & | in,
|  | field_value::type_id & | type_id
| ) | `[related]`

Stream input.

Parameters:

  | in | input stream.
  | type_id | field_value type identifier.

Returns:
  `in`.