MAttributeSpecArray Class Reference

#include <MAttributeSpecArray.h>

Class Description

An attribute specification array.

Array class for MAttributeSpec.

See MAttributeSpec for more information.

+ Examples:

Public Member Functions

 MAttributeSpecArray ()
 Default constructor. More...
 
 MAttributeSpecArray (const MAttributeSpecArray &other)
 Copy Constructor. More...
 
 MAttributeSpecArray (unsigned int initializeSize, const MAttributeSpec &initialValue)
 Create a new array of MAttributeSpecs of a specified size and initialize all the elements with the given initial value. More...
 
 ~MAttributeSpecArray ()
 Class Destructor.
 
MAttributeSpec operator[] (unsigned int index) const
 Index operator. More...
 
MAttributeSpecArrayoperator= (const MAttributeSpecArray &other)
 Assignment operator. More...
 
MStatus set (const MAttributeSpec &element, unsigned int index)
 Sets the value of the specified element to the given attribute spec. More...
 
MStatus setLength (unsigned int length)
 Set the length of the array. More...
 
unsigned int length () const
 Returns the number of elements in the array. More...
 
MStatus remove (unsigned int index)
 Removes the element in the array at the given index. More...
 
MStatus insert (const MAttributeSpec &element, unsigned int index)
 Inserts a new value into the array at the given index. More...
 
MStatus append (const MAttributeSpec &element)
 Adds a new element to the end of the array. More...
 
MStatus copy (const MAttributeSpecArray &source)
 Copy the contents of the source array to this array. More...
 
MStatus clear ()
 Clear the contents of the array. More...
 
void setSizeIncrement (unsigned int newIncrement)
 Set the size by which the array will be expanded whenever expansion is necessary. More...
 
unsigned int sizeIncrement () const
 Return the size by which the array will be expanded whenever expansion is necessary. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MAttributeSpecArray ( )

Default constructor.

The array is set to contain no elements.

Copy Constructor.

Parameters
[in]otherthe array with which to initialize this array
MAttributeSpecArray ( unsigned int  initialSize,
const MAttributeSpec initialValue 
)

Create a new array of MAttributeSpecs of a specified size and initialize all the elements with the given initial value.

Parameters
[in]initialSizethe initial size of the array
[in]initialValuethe initial value of each element

Member Function Documentation

MAttributeSpec operator[] ( unsigned int  index) const

Index operator.

Returns the value of the element at the given index. Valid indices are 0 to length()-1.

Parameters
[in]indexthe index of the element to return
Returns
A reference to the specified element
MAttributeSpecArray & operator= ( const MAttributeSpecArray other)

Assignment operator.

Parameters
[in]otherThe source object to assign from.
Returns
A reference to the copied MAttributeSpecArray object.
MStatus set ( const MAttributeSpec element,
unsigned int  index 
)

Sets the value of the specified element to the given attribute spec.

Parameters
[in]elementthe new value for the specified element
[in]indexthe index of the element to be set
Returns
  • MS::kSuccess the value was set successfully
  • MS::kFailure invalid index
MStatus setLength ( unsigned int  length)

Set the length of the array.

This will grow and shrink the array as desired. Elements that are grown have uninitialized values, while those which are shrunk will lose the data contained in the deleted elements (ie. it will release the memory).

Parameters
[in]lengththe new size of the array
Returns
  • MS::kSuccess the method is successful.
  • MS::kFailure the method failed.
unsigned int length ( ) const

Returns the number of elements in the array.

Returns
The number of elements in the array
+ Examples:
MStatus remove ( unsigned int  index)

Removes the element in the array at the given index.

Parameters
[in]indexthe index of the element to removed
Returns
  • MS::kSuccess the remove was successful.
  • MS::kInvalidParameter when the specified index is out of range.
  • MS::kFailure the remove failed
MStatus insert ( const MAttributeSpec element,
unsigned int  index 
)

Inserts a new value into the array at the given index.

The initial element at that index, and all following elements, are shifted towards the last.

Parameters
[in]elementthe new value to insert into the array
[in]indexthe index of the element to set
Returns
  • MS::kSuccess the insert was set successfully
  • MS::kFailure the insert failed
MStatus append ( const MAttributeSpec element)

Adds a new element to the end of the array.

Parameters
[in]elementthe value for the new last element
Returns
  • MS::kSuccess the append was set successfully
  • MS::kFailure the append failed
MStatus copy ( const MAttributeSpecArray source)

Copy the contents of the source array to this array.

Parameters
[in]sourcearray to copy from
Returns
MS::kSuccess if the copy was successful and MS::kFailure otherwise
MStatus clear ( )

Clear the contents of the array.

After this operation the length method will return 0. This does not change the amount of memory allocated to the array, only the number of valid elements in it.

Returns
  • MS::kSuccess the operation was set successfully
  • MS::kFailure the operation failed
void setSizeIncrement ( unsigned int  newIncrement)

Set the size by which the array will be expanded whenever expansion is necessary.

Parameters
[in]newIncrementthe new increment
unsigned int sizeIncrement ( ) const

Return the size by which the array will be expanded whenever expansion is necessary.

Returns
The size increment.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MAttributeSpecArray.h
  • MAttributeSpecArray.cpp