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

MFColor Class Reference

Encapsulates a MFColor. More...

Inheritance diagram for MFColor:

FieldValue List of all members.

Public Methods

 MFColor (size_t length=0, SFColor::ConstArrayPointer values=0) throw (std::bad_alloc)
 Construct from a float array.

 MFColor (const MFColor &mfcolor) throw (std::bad_alloc)
 Copy constructor.

virtual ~MFColor () throw ()
 Destructor.

MFColor & operator= (const MFColor &mfcolor) throw (std::bad_alloc)
 Assignment operator.

SFColor::ConstArrayReference getElement (size_t index) const throw ()
 Get element.

void setElement (size_t index, SFColor::ConstArrayReference value) throw ()
 Set element.

size_t getLength () const throw ()
 Get the length.

void setLength (size_t length) throw (std::bad_alloc)
 Set the length.

void addElement (SFColor::ConstArrayReference value) throw (std::bad_alloc)
 Add an element to the end of the sequence.

void insertElement (size_t index, SFColor::ConstArrayReference value) throw (std::bad_alloc)
 Insert an element into the sequence.

void removeElement (size_t index) throw ()
 Remove an element from the sequence.

virtual std::auto_ptr< FieldValueclone () const throw (std::bad_alloc)
 Virtual copy constructor.

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

virtual Type type () const throw ()
 Get the FieldValue::Type associated with this class.


Private Methods

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


Private Attributes

void * values
 Internal representation.


Detailed Description

Encapsulates a MFColor.


Constructor & Destructor Documentation

MFColor size_t    length = 0,
SFColor::ConstArrayPointer    values = 0
throw (std::bad_alloc) [explicit]
 

Construct from a float array.

Parameters:
length the number of RGB triplets in the array
values a pointer to an array of 3-element arrays comprising color values to initialize the MFColor.
Exceptions:
std::bad_alloc if memory allocation fails.

MFColor const MFColor &    mfcolor throw (std::bad_alloc)
 

Copy constructor.

Parameters:
mfcolor the object to copy.
Exceptions:
std::bad_alloc if memory allocation fails.

~MFColor   throw () [virtual]
 

Destructor.


Member Function Documentation

void addElement SFColor::ConstArrayReference    value throw (std::bad_alloc)
 

Add an element to the end of the sequence.

Parameters:
value the value to add.
Exceptions:
std::bad_alloc if memory allocation fails.

FieldValue & assign const FieldValue   value throw (std::bad_cast, std::bad_alloc) [virtual]
 

Virtual assignment.

Returns:
a reference to the object.
Exceptions:
std::bad_cast if value is not an MFColor object.
std::bad_alloc if memory allocation fails.

Implements FieldValue.

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

Virtual copy constructor.

Returns:
a pointer to a copy of the object.
Exceptions:
std::bad_alloc if memory allocation fails.

Implements FieldValue.

SFColor::ConstArrayReference getElement size_t    index const throw ()
 

Get element.

Returns:
a 3-element array comprising an RGB triplet

size_t getLength   const throw ()
 

Get the length.

Returns:
the number of color values (RGB triplets)

void insertElement size_t    index,
SFColor::ConstArrayReference    value
throw (std::bad_alloc)
 

Insert an element into the sequence.

Parameters:
index the index where the new value should be inserted.
value an RGB triplet.
Exceptions:
std::bad_alloc if memory allocation fails.
Precondition:
index is a valid index.

MFColor & operator= const MFColor &    mfcolor throw (std::bad_alloc)
 

Assignment operator.

Parameters:
mfcolor value to assign to this object
Returns:
a reference to this object
Exceptions:
std::bad_alloc if memory allocation fails.

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

Print to an output stream.

Parameters:
out an output stream.

Implements FieldValue.

void removeElement size_t    index throw ()
 

Remove an element from the sequence.

Parameters:
index the index of the value to remove.
Precondition:
index is a valid index.

void setElement size_t    index,
SFColor::ConstArrayReference    value
throw ()
 

Set element.

Parameters:
index the index of the element to set
value a 3-element float array comprising the new color value

void setLength size_t    length throw (std::bad_alloc)
 

Set the length.

If the new length is greater than the current length, the additional values are initialized to the default color, (0, 0, 0). If the new length is less than the current length, the array is truncated.

Parameters:
length new length
Exceptions:
std::bad_alloc if memory allocation fails.

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

Get the FieldValue::Type associated with this class.

Returns:
FieldValue::mfcolor.

Implements FieldValue.


Member Data Documentation

void * values [private]
 

Internal representation.