Home | Download | Screen shots | Discussion | Documentation |
---|
#include <openvrml/field_value.h>
Inheritance diagram for openvrml::field_value:
Subclasses of field_value
are models of Field Value. These subclasses have copy-on-write semantics.
Public Types | |
enum | type_id { invalid_type_id, sfbool_id, sfcolor_id, sfcolorrgba_id, sffloat_id, sfdouble_id, sfimage_id, sfint32_id, sfnode_id, sfrotation_id, sfstring_id, sftime_id, sfvec2f_id, sfvec2d_id, sfvec3f_id, sfvec3d_id, mfbool_id, mfcolor_id, mfcolorrgba_id, mffloat_id, mfdouble_id, mfimage_id, mfint32_id, mfnode_id, mfrotation_id, mfstring_id, mftime_id, mfvec2f_id, mfvec2d_id, mfvec3f_id, mfvec3d_id } |
Used to identify field_value types. More... | |
Public Member Functions | |
virtual | ~field_value ()=0 throw () |
Destroy. | |
std::auto_ptr< field_value > | clone () const throw ( std::bad_alloc ) |
Polymorphically construct a copy. | |
field_value & | assign (const field_value &value) throw ( std::bad_cast , std::bad_alloc ) |
Virtual assignment. | |
type_id | type () const throw () |
Get the field type. | |
template<typename FieldValue> | |
const FieldValue::value_type & | value () const throw () |
Access. | |
template<typename FieldValue> | |
void | value (const typename FieldValue::value_type &val) throw ( std::bad_alloc ) |
Mutate. | |
template<typename FieldValue> | |
void | swap (FieldValue &val) throw () |
Swap. | |
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 | |
template<typename ValueType> | |
field_value (const ValueType &value, const value_type_constructor_tag &) throw ( std::bad_alloc ) | |
Construct. | |
field_value (const field_value &value) throw ( std::bad_alloc ) | |
Construct a copy. | |
template<typename FieldValue> | |
FieldValue & | operator= (const FieldValue &fv) throw ( std::bad_alloc ) |
Assignment operator. | |
Private Member Functions | |
virtual std::auto_ptr< field_value > | do_clone () const=0 throw ( std::bad_alloc ) |
Polymorphically construct a copy. | |
virtual field_value & | do_assign (const field_value &value)=0 throw ( std::bad_cast , std::bad_alloc ) |
Virtual assignment. | |
virtual type_id | do_type () const=0 throw () |
Get the field type. | |
virtual void | print (std::ostream &out) const =0 |
Print to an output stream. | |
Private Attributes | |
std::auto_ptr< counted_impl_base > | counted_impl_ |
Reference-counted implementation. | |
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. | |
Classes | |
class | counted_impl |
Concrete reference-counted implementation. More... | |
class | counted_impl_base |
Base class for the internal reference-counted objects. More... | |
class | value_type_constructor_tag |
This struct exists only to disambiguate field_value 's constructor template from its copy constructor. More... |
Used to identify field_value types.
These tags are typically used to designate an expected type or to avoid a dynamic_cast
.
invalid_type_id | Zero value typically used to indicate failure. |
sfbool_id |
Designates an sfbool . |
sfcolor_id |
Designates an sfcolor . |
sfcolorrgba_id |
Designates an sfcolorrgba . |
sffloat_id |
Designates an sffloat . |
sfdouble_id |
Designates an sfdouble . |
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 . |
sfvec2d_id |
Designates an sfvec2d . |
sfvec3f_id |
Designates an sfvec3f . |
sfvec3d_id |
Designates an sfvec3d . |
mfbool_id |
Designates an mfbool . |
mfcolor_id |
Designates an mfcolor . |
mfcolorrgba_id |
Designates an mfcolorrgba . |
mffloat_id |
Designates an mffloat . |
mfdouble_id |
Designates an mfdouble . |
mfimage_id |
Designates an mfimage . |
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 . |
mfvec2d_id |
Designates an mfvec2d . |
mfvec3f_id |
Designates an mfvec3f . |
mfvec3d_id |
Designates an mfvec3d . |
openvrml::field_value::~field_value | ( | ) | throw () [pure virtual] |
Destroy.
openvrml::field_value::field_value | ( | const ValueType & | value, | |
const value_type_constructor_tag & | ||||
) | throw ( std::bad_alloc ) [protected] |
Construct.
[in] | value | initial value. |
std::bad_alloc | if memory allocation fails. |
openvrml::field_value::field_value | ( | const field_value & | fv | ) | throw ( std::bad_alloc ) [protected] |
Construct a copy.
[in] | fv | field value to copy. |
std::bad_alloc | if memory allocation fails. |
std::auto_ptr< openvrml::field_value > openvrml::field_value::create | ( | type_id | type | ) | throw ( std::bad_alloc ) [static] |
Create a default instance of the type specified by type
.
[in] | type | field value type identifier. |
type
.std::bad_alloc | if memory allocation fails. |
std::auto_ptr< openvrml::field_value > openvrml::field_value::clone | ( | ) | const throw ( std::bad_alloc ) |
Polymorphically construct a copy.
This function delegates to field_value::do_clone
.
field_value
identical to this one.std::bad_alloc | if memory allocation fails. |
openvrml::field_value & openvrml::field_value::assign | ( | const field_value & | value | ) | throw ( std::bad_cast , std::bad_alloc ) |
Virtual assignment.
Thus function delegates to field_value::do_assign
.
[in] | value | the value to assign to the object. |
openvrml::field_value::type_id openvrml::field_value::type | ( | ) | const throw () |
Get the field type.
This function delegates to field_value::do_type
.
type_id
enumerant corresponding to the field_value
's type. const FieldValue::value_type & openvrml::field_value::value | ( | ) | const throw () |
Access.
Reimplemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sfcolorrgba, openvrml::sffloat, openvrml::sfdouble, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec2d, openvrml::sfvec3f, openvrml::sfvec3d, openvrml::mfbool, openvrml::mfcolor, openvrml::mfcolorrgba, openvrml::mffloat, openvrml::mfdouble, openvrml::mfimage, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, openvrml::mfvec2d, openvrml::mfvec3f, and openvrml::mfvec3d.
void openvrml::field_value::value | ( | const typename FieldValue::value_type & | val | ) | throw ( std::bad_alloc ) |
Mutate.
[in] | val | new value. |
std::bad_alloc | if memory allocation fails. |
void openvrml::field_value::swap | ( | FieldValue & | val | ) | throw () |
Swap.
[in,out] | val | the value to swap with this one. |
FieldValue & openvrml::field_value::operator= | ( | const FieldValue & | fv | ) | throw ( std::bad_alloc ) [protected] |
Assignment operator.
[in] | fv | field value to assign. |
std::auto_ptr< openvrml::field_value > openvrml::field_value::do_clone | ( | ) | const throw ( std::bad_alloc ) [private, pure virtual] |
Polymorphically construct a copy.
std::bad_alloc | if memory allocation fails. |
Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sfcolorrgba, openvrml::sffloat, openvrml::sfdouble, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec2d, openvrml::sfvec3f, openvrml::sfvec3d, openvrml::mfbool, openvrml::mfcolor, openvrml::mfcolorrgba, openvrml::mffloat, openvrml::mfdouble, openvrml::mfimage, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, openvrml::mfvec2d, openvrml::mfvec3f, and openvrml::mfvec3d.
openvrml::field_value & openvrml::field_value::do_assign | ( | const field_value & | value | ) | throw ( std::bad_cast , std::bad_alloc ) [private, pure virtual] |
Virtual assignment.
[in] | value | the value to assign to the object. |
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::sfcolorrgba, openvrml::sffloat, openvrml::sfdouble, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec2d, openvrml::sfvec3f, openvrml::sfvec3d, openvrml::mfbool, openvrml::mfcolor, openvrml::mfcolorrgba, openvrml::mffloat, openvrml::mfdouble, openvrml::mfimage, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, openvrml::mfvec2d, openvrml::mfvec3f, and openvrml::mfvec3d.
openvrml::field_value::type_id openvrml::field_value::do_type | ( | ) | const throw () [private, pure virtual] |
Get the field type.
type_id
enumerant corresponding to the field_value
's type. Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sfcolorrgba, openvrml::sffloat, openvrml::sfdouble, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec2d, openvrml::sfvec3f, openvrml::sfvec3d, openvrml::mfbool, openvrml::mfcolor, openvrml::mfcolorrgba, openvrml::mffloat, openvrml::mfdouble, openvrml::mfimage, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, openvrml::mfvec2d, openvrml::mfvec3f, and openvrml::mfvec3d.
void openvrml::field_value::print | ( | std::ostream & | out | ) | const [private, pure virtual] |
Print to an output stream.
[in,out] | out | an output stream. |
Implemented in openvrml::sfbool, openvrml::sfcolor, openvrml::sfcolorrgba, openvrml::sffloat, openvrml::sfdouble, openvrml::sfimage, openvrml::sfint32, openvrml::sfnode, openvrml::sfrotation, openvrml::sfstring, openvrml::sftime, openvrml::sfvec2f, openvrml::sfvec2d, openvrml::sfvec3f, openvrml::sfvec3d, openvrml::mfbool, openvrml::mfcolor, openvrml::mfcolorrgba, openvrml::mffloat, openvrml::mfdouble, openvrml::mfimage, openvrml::mfint32, openvrml::mfnode, openvrml::mfrotation, openvrml::mfstring, openvrml::mftime, openvrml::mfvec2f, openvrml::mfvec2d, openvrml::mfvec3f, and openvrml::mfvec3d.
std::ostream& operator<< | ( | std::ostream & | out, | |
const field_value & | value | |||
) | [friend] |
Stream output.
[in,out] | out | an output stream. |
[in] | value | a field value. |
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
.
[in,out] | out | output stream. |
[in] | type_id | field_value type identifier. |
out
. std::istream & operator>> | ( | std::istream & | in, | |
field_value::type_id & | type_id | |||
) | [related] |
Stream input.
[in,out] | in | input stream. |
[in] | type_id | field_value type identifier. |
in
.
std::auto_ptr< openvrml::field_value::counted_impl_base > openvrml::field_value::counted_impl_ [private] |
Reference-counted implementation.