The CFloatArray is an uni-dimensional array of floats.
The array is zero-based, which means that the first item index is 0 and the larger index is one less than the number of elements contained in the array.
Items are added with CFloatArray::Add. You can also use CFloatArray::Attach to encapsulate an external array. When an array is attached, its items are accessible through the CFloatArray API.
#include <xsi_floatarray.h>
Public Member Functions | |
CFloatArray (LONG in_size=0) | |
CFloatArray (const CFloatArray &in_array) | |
~CFloatArray () | |
CFloatArray & | operator= (const CFloatArray &in_array) |
CFloatArray & | operator+= (const CFloatArray &in_array) |
CFloatArray & | operator-= (const CFloatArray &in_array) |
LONG | GetCount () const |
CStatus | Attach (float *in_pArray, LONG in_nSize) |
CStatus | Add (const float &in_item) |
CStatus | Clear () |
CStatus | Resize (LONG in_size) |
CStatus | Resize (LONG in_size, bool in_bReset) |
const float & | operator[] (LONG in_index) const |
float & | operator[] (LONG in_index) |
bool | operator== (const CFloatArray &in_array) const |
bool | operator!= (const CFloatArray &in_array) const |
CString | GetAsText () const |
const float * | GetArray () const |
CStatus | Append (const CFloatArray &in_array) |
CFloatArray | ( | LONG | in_size = 0 | ) |
Constructs a CFloatArray and optionally initializes the array to a known size.
in_size | Size of array, defaults to 0. |
CFloatArray | ( | const CFloatArray & | in_array | ) |
Constructs a CFloatArray object from another CFloatArray object.
in_array | constant CFloatArray object. |
~CFloatArray | ( | ) |
Default destructor.
CFloatArray& operator= | ( | const CFloatArray & | in_array | ) |
Assignment operator.
in_array | constant class object. |
CFloatArray& operator+= | ( | const CFloatArray & | in_array | ) |
Adds the value of each element of in_array
to the value of the corresponding element of this CFloatArray. The result is stored in this CFloatArray object.
in_array | A constant CFloatArray object. |
CFloatArray& operator-= | ( | const CFloatArray & | in_array | ) |
Subtracts the value of each element of in_array
from the value of the corresponding element of this CFloatArray. The result is stored in this CFloatArray object.
in_array | A constant CFloatArray object. |
LONG GetCount | ( | ) | const |
Returns the number of items in this CFloatArray
CStatus Attach | ( | float * | in_pArray, |
LONG | in_nSize | ||
) |
Encapsulates a pointer to float without taking ownership of it (i.e. the memory is not released when the CFloatArray is deleted). The content of the CFloatArray 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.
in_pArray | Array to encapsulate. |
in_nSize | Number of elements in the array. |
CStatus Add | ( | const float & | in_item | ) |
Adds a float at the end of this array.
in_item | New item to be added at the end of the array. |
CStatus Clear | ( | ) |
Erases all elements contained in the array.
CStatus Resize | ( | LONG | in_size | ) |
Reallocates memory for the array, preserves its contents if the new size is larger than existing size.
in_size | New size of the array. |
CStatus Resize | ( | LONG | in_size, |
bool | in_bReset | ||
) |
Reallocates memory for the array, preserves its contents if new size is larger than existing size.
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. |
const float& 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.
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 unpredicted. |
float& operator[] | ( | LONG | in_index | ) |
Accessor to elements at a given index.
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 unpredicted. |
bool operator== | ( | const CFloatArray & | in_array | ) | const |
Equality operator.
in_array | CFloatArray to compare with. |
bool operator!= | ( | const CFloatArray & | in_array | ) | const |
Inequality operator.
in_array |
CString GetAsText | ( | ) | const |
Returns a string that contains the values of this array separated with the comma character.
const float* GetArray | ( | ) | const |
Accessor to the internal array of floats. The array cannot be modified and the content is undefined when the CFloatArray object goes out of scope.
CStatus Append | ( | const CFloatArray & | in_array | ) |
Appends the content of a CFloatArray object to this one.
in_array | A constant CFloatArray object. |