H3D::MField< Type > Class Template Reference
[Field template modifiers.]

Template class that adds the Field mechanism to a vector of values. More...

#include <MField.h>

Inheritance diagram for H3D::MField< Type >:

Inheritance graph
List of all members.

Public Types

typedef vector< Type >::iterator iterator
 iterator used to iterate through a vector.

Public Member Functions

 H3D_VALUE_EXCEPTION (typename BaseMField::size_type, InvalidIndex)
 Thrown if the index given to getValueByIndex() is outside the boundaries.
 MField ()
 Default constructor. Creates an empty MField.
 MField (typename BaseMField::size_type sz)
 Creates an MField with space reserved for size nodes.
virtual const vector< Type > & getValue (int id=0)
 Get the value of the MField.
virtual MField< Type >::const_reference getValueByIndex (typename BaseMField::size_type i, int id=0)
 Get the value of an element of the MField.
virtual void setValue (const vector< Type > &v, int id=0)
 Set the value of the field.
virtual void setValue (typename BaseMField::size_type i, const Type &v, int id=0)
 Change the value of one element in the MField.
virtual void setValueFromString (const string &s)
 Set the value of the field given a string.
virtual void addElementFromString (const string &s)
 Add a new element to an MField from a string value.
virtual string getValueAsString (const string &separator=" ")
 Get the value of the field as a string.
iterator insert (iterator pos, const Type &x, int id=0)
 Inserts x before pos.
template<class InputIterator>
void insert (iterator pos, InputIterator first, InputIterator last, int id=0)
 Inserts the range [first, last) before pos.
void insert (iterator pos, typename BaseMField::size_type n, const Type &x, int id=0)
 Inserts n copies of x before pos.
virtual void erase (iterator pos, int id=0)
 Erases the element at position pos.
virtual void erase (iterator first, iterator last, int id=0)
 Erases the range [first, last).
virtual void erase (const Type &a, int id=0)
 Erase the first element equal to a.
virtual string getTypeName ()
 Returns a string name for this field type e.g. MFInt32.
virtual size_t getSize ()
 Set the value of the field given a string.
virtual string getElementAsString (size_t element)
 Get the value of the field as a string.

Protected Member Functions

virtual void update ()
 Make the field up to date given that an event has occured.

Detailed Description

template<class Type>
class H3D::MField< Type >

Template class that adds the Field mechanism to a vector of values.

Parameters:
Type The type of the values in the vector.


Member Function Documentation

template<class Type>
virtual string H3D::MField< Type >::getElementAsString size_t  element  )  [inline, virtual]
 

Get the value of the field as a string.

If the field contains multiple values the separator string is used between the values.

Reimplemented from H3D::ParsableMField.

template<class Type>
virtual size_t H3D::MField< Type >::getSize  )  [inline, virtual]
 

Set the value of the field given a string.

By default we try to parse the values according to the X3D/XML specification.

Implements H3D::ParsableMField.

template<class Type>
virtual string H3D::MField< Type >::getValueAsString const string &  separator = " "  )  [inline, virtual]
 

Get the value of the field as a string.

If the field contains multiple values the separator string is used between the values.

Reimplemented from H3D::ParsableField.

Reimplemented in H3D::MFBool, and H3D::MFString.

template<class Type>
virtual MField<Type>::const_reference H3D::MField< Type >::getValueByIndex typename BaseMField< Type >::size_type  i,
int  id = 0
[inline, virtual]
 

Get the value of an element of the MField.

Parameters:
i The index of the element.

template<class Type>
virtual void H3D::MField< Type >::setValue typename BaseMField< Type >::size_type  i,
const Type &  v,
int  id = 0
[inline, virtual]
 

Change the value of one element in the MField.

Parameters:
i The index of the value to set.
t The new value.

template<class Type>
void H3D::MField< Type >::setValue const vector< Type > &  v,
int  id = 0
[inline, virtual]
 

Set the value of the field.

Parameters:
The new value.

template<class Type>
virtual void H3D::MField< Type >::setValueFromString const string &  s  )  [inline, virtual]
 

Set the value of the field given a string.

By default we try to parse the values according to the X3D/XML specification.

Implements H3D::ParsableField.


Generated on Thu Aug 24 12:39:37 2006 for H3D API by  doxygen 1.4.5