Public Member Functions
CDoubleArray Class Reference

Detailed Description

The CDoubleArray is an uni-dimensional array of doubles.

The array is zero-based, which means that the first item index is 0 and the larger index is one less that the number of elements contained in the array.

Items are added with CDoubleArray::Add. You can also use CDoubleArray::Attach to encapsulate an external array. When an array is attached, its items are accessible through the CDoubleArray API.

See also:
CClusterPropertyElementArray::GetArray, CClusterPropertyElementArray::GetItem, CClusterPropertyElementArray::PutItem, CClusterPropertyElementArray::GetItemsByIndex, CClusterPropertyElementArray::PutItemsByIndex, FCurve::SetKeys, CKnotArray::GetArray, CNurbsCurveData::m_aKnots, CNurbsSurfaceData::m_aUKnots, CNurbsSurfaceData::m_aVKnots

#include <xsi_doublearray.h>

List of all members.

Public Member Functions

  CDoubleArray (LONG in_size=0)
  CDoubleArray (const CDoubleArray &in_array)
  ~CDoubleArray ()
CDoubleArray operator= (const CDoubleArray &in_array)
CDoubleArray operator+= (const CDoubleArray &in_array)
CDoubleArray operator-= (const CDoubleArray &in_array)
LONG  GetCount () const
CStatus  Attach (double *in_pArray, LONG in_nSize)
CStatus  Add (const double &in_item)
CStatus  Clear ()
CStatus  Resize (LONG in_size)
CStatus  Resize (LONG in_size, bool in_bReset)
const double &  operator[] (LONG in_index) const
double &  operator[] (LONG in_index)
bool  operator== (const CDoubleArray &in_array) const
bool  operator!= (const CDoubleArray &in_array) const
CString  GetAsText () const
const double *  GetArray () const
CStatus  Append (const CDoubleArray &in_array)

Constructor & Destructor Documentation

CDoubleArray ( LONG  in_size = 0 )

Constructs a CDoubleArray and optionally initializes the array to a known size.

Parameters:
in_size Size of array, defaults to 0.
CDoubleArray ( const CDoubleArray in_array )

Constructs a CDoubleArray object from another CDoubleArray object.

Parameters:
in_array constant CDoubleArray object.

Default destructor.


Member Function Documentation

CDoubleArray& operator= ( const CDoubleArray in_array )

Assignment operator.

Parameters:
in_array constant class object.
Returns:
A reference to this array.
CDoubleArray& operator+= ( const CDoubleArray in_array )

Adds the value of each element of in_array to the value of the corresponding element of this CDoubleArray. The result is stored in this CDoubleArray object.

Parameters:
in_array A constant CDoubleArray object.
Returns:
A reference to this array.
Since:
5.1
CDoubleArray& operator-= ( const CDoubleArray in_array )

Subtracts the value of each element of in_array from the value of the corresponding element of this CDoubleArray. The result is stored in this CDoubleArray object.

Parameters:
in_array A constant CDoubleArray object.
Returns:
A reference to this array.
Since:
5.1
LONG GetCount ( ) const

Returns the number of items in this CDoubleArray

Returns:
The number of items in the array.
CStatus Attach ( double *  in_pArray,
LONG  in_nSize 
)

Encapsulates a pointer to float without taking ownership of it (i.e. the memory is not released when the CDoubleArray is deleted). The content of the CDoubleArray is erased before attaching the external array. Attach does not take a copy of the external array, however functions like Add and Resize will force a copy of the encapsulated array.

Parameters:
in_pArray Array to encapsulate.
in_nSize Number of elements in the array.
Returns:
CStatus::OK success
CStatus::Fail Operation failed.
CStatus::InvalidArgument Pointer is null or size is <= 0.
See also:
CDoubleArray::Add, CDoubleArray::Resize
Since:
5.1
CStatus Add ( const double &  in_item )

Adds a double at the end of this array.

Parameters:
in_item New item to be added at the end of the array.
Note:
There is a performance cost when calling Add if an external array has been attached with the Attach method: CDoubleArray takes a copy of the external array before appending the item.
Returns:
CStatus::OK success
See also:
CDoubleArray::Attach
CStatus Clear ( )

Erases all elements contained in the array.

Returns:
CStatus::OK success
CStatus Resize ( LONG  in_size )

Reallocates memory for the array, preserves its contents if the new size is larger than existing size.

Note:
There is a performance cost when calling Resize if an external array has been attached with the Attach method. The method takes a copy of the external array before resizing.
Parameters:
in_size New size of the array.
Returns:
CStatus::OK success
CStatus::InvalidArgument in_size < 0
See also:
CDoubleArray::Attach
CStatus Resize ( LONG  in_size,
bool  in_bReset 
)

Reallocates memory for the array, preserves its contents if the new size is larger than existing size.

Note:
There is a performance cost when calling Resize if an external array has been attached with the Attach method. The method takes a copy of the external array before resizing.
Parameters:
in_size New size of the array.
in_bReset Set the array with 0 if true. If false the array is not reset and the content is preserved.
Returns:
CStatus::OK success
CStatus::InvalidArgument in_size < 0
See also:
CDoubleArray::Attach
const double& operator[] ( LONG  in_index ) const

Accessor to elements at a given index. This function can only be called by constant objects, the returned value is read-only.

Parameters:
in_index Index in this zero-based array.The index must be smaller than the number of elements in the array, otherwise the results are unpredictable.
Returns:
A read-only reference to the indexed item.
double& operator[] ( LONG  in_index )

Accessor to elements at a given index.

Parameters:
in_index Index in this zero-based array.The index must be smaller than the number of elements in the array, otherwise the results are unpredictable.
Returns:
A reference to the indexed item.
bool operator== ( const CDoubleArray in_array ) const

Equality operator.

Parameters:
in_array CDoubleArray to compare with.
Returns:
True if in_array contains the same number of elements as this array and all members of in_array are equal to the corresponding one contained in this array.
bool operator!= ( const CDoubleArray in_array ) const

Inequality operator.

Parameters:
in_array CDoubleArray to compare with.
Returns:
True if one member of in_array is different from any of the corresponding members in this array or if the arrays are not the same size.
CString GetAsText ( ) const

Returns a string that contains the values of this array separated with the comma character.

Returns:
String of values.
Since:
5.1
const double* GetArray ( ) const

Accessor to the internal array of doubles. The array cannot be modified and the content is undefined when the CDoubleArray object goes out of scope.

Returns:
Pointer to an array of doubles.
Since:
5.1
CStatus Append ( const CDoubleArray in_array )

Appends the content of a CDoubleArray object to this one.

Parameters:
in_array A constant CDoubleArray object.
Returns:
CStatus::OK success
CStatus::InvalidArgument in_array::GetCount is 0
Since:
5.1

The documentation for this class was generated from the following file: