Main Page   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

FieldValue Class Reference

Abstract base class for the VRML field types. More...

Inheritance diagram for FieldValue:

MFColor MFFloat MFInt32 MFNode MFRotation MFString MFTime MFVec2f MFVec3f SFBool SFColor SFFloat SFImage SFInt32 SFNode SFRotation SFString SFTime SFVec2f SFVec3f List of all members.

Public Types

enum  Type {
  invalidType,
  sfbool,
  sfcolor,
  sffloat,
  sfimage,
  sfint32,
  sfnode,
  sfrotation,
  sfstring,
  sftime,
  sfvec2f,
  sfvec3f,
  mfcolor,
  mffloat,
  mfint32,
  mfnode,
  mfrotation,
  mfstring,
  mftime,
  mfvec2f,
  mfvec3f
}
 Used to identify FieldValue types. More...


Public Methods

virtual ~FieldValue ()=0 throw ()
 Destructor.

virtual std::auto_ptr< FieldValue > clone () const=0 throw (std::bad_alloc)
 Virtual copy constructor.

virtual FieldValue & assign (const FieldValue &value)=0 throw (std::bad_cast, std::bad_alloc)
 Virtual assignment.

virtual Type type () const=0 throw ()
 Get the field type.


Protected Methods

 FieldValue () throw ()
 Constructor.

 FieldValue (const FieldValue &value) throw ()
 Copy constructor.

FieldValue & operator= (const FieldValue &value) throw ()
 Assignment operator.


Private Methods

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


Friends

std::ostream & operator<< (std::ostream &out, const FieldValue &fieldValue)
 Stream output.


Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, const FieldValue::Type type)
 Stream output.

std::istream & operator>> (std::istream &in, FieldValue::Type &type)
 Stream input.


Detailed Description

Abstract base class for the VRML field types.


Member Enumeration Documentation

enum Type
 

Used to identify FieldValue types.

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

Enumeration values:
invalidType  Zero value typically used to indicate failure.

sfbool  Designates an SFBool.

sfcolor  Designates an SFColor.

sffloat  Designates an SFFloat.

sfimage  Designates an SFImage.

sfint32  Designates an SFInt32.

sfnode  Designates an SFNode.

sfrotation  Designates an SFRotation.

sfstring  Designates an SFString.

sftime  Designates an SFTime.

sfvec2f  Designates an SFVec2f.

sfvec3f  Designates an SFVec3f.

mfcolor  Designates an MFColor.

mffloat  Designates an MFFloat.

mfint32  Designates an MFInt32.

mfnode  Designates an MFNode.

mfrotation  Designates an MFRotation.

mfstring  Designates an MFString.

mftime  Designates an MFTime.

mfvec2f  Designates an MFVec2f.

mfvec3f  Designates an MFVec3f.


Constructor & Destructor Documentation

~FieldValue   throw () [pure virtual]
 

Destructor.

FieldValue   throw () [protected]
 

Constructor.

FieldValue const FieldValue &    value throw () [protected]
 

Copy constructor.


Member Function Documentation

FieldValue & assign const FieldValue &    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 SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f, MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, and MFVec3f.

std::auto_ptr< FieldValue > clone   const throw (std::bad_alloc) [pure virtual]
 

Virtual copy constructor.

Returns:
a new FieldValue identical to this one.
Exceptions:
std::bad_alloc if memory allocation fails.

Implemented in SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f, MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, and MFVec3f.

FieldValue & operator= const FieldValue &    value throw () [protected]
 

Assignment operator.

void print std::ostream &    out const [private, pure virtual]
 

Print to an output stream.

Parameters:
out an output stream.

Implemented in SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f, MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, and MFVec3f.

FieldValue::Type type   const throw () [pure virtual]
 

Get the field type.

Returns:
the Type enumerant corresponding to this FieldValue's type

Implemented in SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, SFRotation, SFString, SFTime, SFVec2f, SFVec3f, MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, MFVec2f, and MFVec3f.


Friends And Related Function Documentation

std::ostream & operator<< std::ostream &    out,
const FieldValue::Type    type
[related]
 

Stream output.

If type is FieldValue::invalidType, failbit is set on out.

Parameters:
out an output stream.
type a FieldValue type identifier.
Returns:
out.

std::ostream& operator<< std::ostream &    out,
const FieldValue &    fieldValue
[friend]
 

Stream output.

Parameters:
out an output stream.
fieldValue a FieldValue.
Returns:
out.

std::istream & operator>> std::istream &    in,
FieldValue::Type   type
[related]
 

Stream input.

Parameters:
in an input stream.
type a FieldValue type identifier.
Returns:
in.