H3D::MFieldBase< Type, VectorClass, BaseField > Class Template Reference

The common base class for MField types and MFNode. More...

#include <MField.h>

Inheritance diagram for H3D::MFieldBase< Type, VectorClass, BaseField >:

Inheritance graph
List of all members.

Public Types

typedef VectorClass vector_type
 The type of the value member.
typedef VectorClass::value_type value_type
 The type of the values stored in the vector.
typedef VectorClass::pointer pointer
 Pointer to Type.
typedef VectorClass::const_reference const_reference
 Const reference to Type.
typedef VectorClass::size_type size_type
 An unsigned integral type.
typedef VectorClass::difference_type difference_type
 A signed integral type.
typedef VectorClass::const_iterator const_iterator
 Const iterator used to iterate through a vector.
typedef VectorClass::const_reverse_iterator const_reverse_iterator
 Const iterator used to iterate backwards through a vector.

Public Member Functions

const_iterator begin (int id=0)
 Returns a const_iterator pointing to the beginning of the vector.
const_iterator end (int id=0)
 Returns a const_iterator pointing to the end of the vector.
const_reverse_iterator rbegin (int id=0)
 Returns a const_reverse_iterator pointing to the beginning of the reversed vector.
const_reverse_iterator rend (int id=0)
 Returns a const_reverse_iterator pointing to the end of the reversed vector.
unsigned int size ()
 Returns the size of the vector.
size_type max_size ()
 Returns the largest possible size of the vector.
size_type capacity ()
 Number of elements for which memory has been allocated.
void reserve (size_t s)
 A request for allocation of additional memory.
void resize (size_t n, Type t=Type(), int id=0)
 Inserts or erases elements at the end such that the size becomes n.
bool empty ()
 true if the vector's size is 0.
const_reference operator[] (size_type n)
 Returns the n'th element.
const_reference front (int id=0)
 Returns the first element.
const_reference back (int id=0)
 Returns the last element.
void swap (VectorClass &x, int id=0)
 Swaps the contents of two vectors.
void push_back (const Type &x, int id=0)
 Inserts a new element at the end.
void pop_back (int id=0)
 Removed the last element.
void clear (int id=0)
 Erases all of the elements.
virtual int setValueFromVoidPtr (void *data, unsigned int nr_elements, unsigned int len, int id=0)
 Set the value of the field given a pointer to where the value of the field is.
virtual int getValueAsVoidPtr (void *data, unsigned int &nr_elements, unsigned int len, int id=0)
 Get the value of the data copied into a memory buffer.
virtual unsigned int valueTypeSize ()
 Returns the size in bytes of the value type the mfield encapsulates.
 MFieldBase ()
 Default constructor. Creates an empty MField.
 MFieldBase (size_type sz)
 Creates a MField with space reserved for n elements.
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()
template<>
string classTypeName ()

Static Public Member Functions

static string classTypeName ()
 Returns a string name for this field type e.g. MFInt32.

Protected Attributes

VectorClass value
 The encapsulated vector.

Detailed Description

template<class Type, class VectorClass = vector< Type >, class BaseField = ParsableMField>
class H3D::MFieldBase< Type, VectorClass, BaseField >

The common base class for MField types and MFNode.

It defines the common interface between MFNode and MField <>. It encapsulates a vector of values of a certain type with the Field mechanisms.

Parameters:
Type The type the values in the vector.
VectorClass The actual vector type.
BaseField The Field base class to inherit from.


Member Function Documentation

template<class Type, class VectorClass = vector< Type >, class BaseField = ParsableMField>
size_type H3D::MFieldBase< Type, VectorClass, BaseField >::capacity  )  [inline]
 

Number of elements for which memory has been allocated.

capacity() is always greater than or equal to size().

template<class Type, class VectorClass = vector< Type >, class BaseField = ParsableMField>
virtual int H3D::MFieldBase< Type, VectorClass, BaseField >::getValueAsVoidPtr void *  data,
unsigned int &  nr_elements,
unsigned int  len,
int  id = 0
[inline, virtual]
 

Get the value of the data copied into a memory buffer.

Parameters:
data Buffer to copy the data into.
nr_elements This parameter will be set to the nr of values in the mfield.
size The size of the buffer.
Returns:
If successful: The number of bytes that was copied into the Otherwise -1.

template<class Type, class VectorClass = vector< Type >, class BaseField = ParsableMField>
void H3D::MFieldBase< Type, VectorClass, BaseField >::reserve size_t  s  )  [inline]
 

A request for allocation of additional memory.

If n is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to n; otherwise, capacity() is unchanged. In either case, size() is unchanged.

template<class Type, class VectorClass = vector< Type >, class BaseField = ParsableMField>
virtual int H3D::MFieldBase< Type, VectorClass, BaseField >::setValueFromVoidPtr void *  data,
unsigned int  nr_elements,
unsigned int  len,
int  id = 0
[inline, virtual]
 

Set the value of the field given a pointer to where the value of the field is.

Parameters:
data A pointer to the data.
nr_elements The number of values in the mfield.
size The size in bytes of the each value stored in the data.
Returns:
0 if successful, -1 otherwise.


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