OpenWareLaboratory
IntArray Class Reference

Public Member Functions

void add (IntArray operand2, IntArray destination)
 Element-wise sum between arrays. More...
 
void add (IntArray operand2)
 Element-wise sum between arrays. More...
 
void clear ()
 Clear the array. More...
 
bool equals (const IntArray &other) const
 Compares two arrays. More...
 
int32_t * getData ()
 Get the data stored in the IntArray. More...
 
int getSize () const
 
int getSize ()
 
 IntArray ()
 
 IntArray (int32_t *data, int size)
 
 operator int32_t * ()
 Casting operator to int32_t*. More...
 
int32_t & operator[] (const int index)
 Allows to index the array using array-style brackets. More...
 
int32_t & operator[] (const int index) const
 Allows to index the array using array-style brackets. More...
 
void setAll (int32_t value)
 
void shift (int shiftValue)
 Bitshift the array values, saturating. More...
 

Static Public Member Functions

static IntArray create (int size)
 Creates a new IntArray. More...
 
static void destroy (IntArray array)
 Destroys a IntArray created with the create() method. More...
 

Detailed Description

Definition at line 1 of file IntArray.h.

Constructor & Destructor Documentation

IntArray::IntArray ( )
IntArray::IntArray ( int32_t *  data,
int  size 
)

Member Function Documentation

void IntArray::add ( IntArray  operand2,
IntArray  destination 
)
inline

Element-wise sum between arrays.

Sets each element in destination to the sum of the corresponding element of the array and operand2

Parameters
[in]operand2second operand for the sum
[out]destinationthe destination array
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 43 of file IntArray.h.

Referenced by add().

void IntArray::add ( IntArray  operand2)
inline

Element-wise sum between arrays.

Adds each element of operand2 to the corresponding element in the array.

Parameters
operand2second operand for the sum
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 60 of file IntArray.h.

References add().

void IntArray::clear ( )
inline

Clear the array.

Set all the values in the array to 0.

Definition at line 33 of file IntArray.h.

References setAll().

Referenced by create().

static IntArray IntArray::create ( int  size)
inlinestatic

Creates a new IntArray.

Allocates size*sizeof(int32_t) bytes of memory and returns a IntArray that points to it.

Parameters
sizethe size of the new IntArray.
Returns
a IntArray which data point to the newly allocated memory and size is initialized to the proper value.
Remarks
a IntArray created with this method has to be destroyed invoking the IntArray::destroy() method.

Definition at line 132 of file IntArray.h.

References clear().

static void IntArray::destroy ( IntArray  array)
inlinestatic

Destroys a IntArray created with the create() method.

Parameters
arraythe IntArray to be destroyed.
Remarks
the IntArray object passed as an argument should not be used again after invoking this method.
a IntArray object that has not been created by the IntArray::create() method might cause an exception if passed as an argument to this method.

Definition at line 144 of file IntArray.h.

bool IntArray::equals ( const IntArray other) const
inline

Compares two arrays.

Performs an element-wise comparison of the values contained in the arrays.

Parameters
otherthe array to compare against.
Returns
true if the arrays have the same size and the value of each of the elements of the one match the value of the corresponding element of the other, or false otherwise.

Definition at line 97 of file IntArray.h.

References getSize().

int32_t* IntArray::getData ( )
inline

Get the data stored in the IntArray.

Returns
a int32_t* pointer to the data stored in the IntArray

Definition at line 121 of file IntArray.h.

int IntArray::getSize ( ) const
inline

Definition at line 10 of file IntArray.h.

Referenced by equals().

int IntArray::getSize ( )
inline

Definition at line 14 of file IntArray.h.

IntArray::operator int32_t * ( )
inline

Casting operator to int32_t*.

Returns
a int32_t* pointer to the data stored in the IntArray

Definition at line 113 of file IntArray.h.

int32_t& IntArray::operator[] ( const int  index)
inline

Allows to index the array using array-style brackets.

Parameters
indexthe index of the element
Returns
the value of the index element of the array Example usage:
int size=1000;
int32_t content[size];
IntArray intArray(content, size);
for(int n=0; n<size; n++)
content[n]==intArray[n]; //now the IntArray can be indexed as if it was an array

Definition at line 78 of file IntArray.h.

int32_t& IntArray::operator[] ( const int  index) const
inline

Allows to index the array using array-style brackets.

const version of operator[]

Definition at line 86 of file IntArray.h.

void IntArray::setAll ( int32_t  value)
inline
Note
When built for ARM Cortex-M processor series, this method uses the optimized CMSIS library

Definition at line 18 of file IntArray.h.

Referenced by clear().

void IntArray::shift ( int  shiftValue)
inline

Bitshift the array values, saturating.

Parameters
shiftValuenumber of positions to shift. A positive value will shift left, a negative value will shift right.

Definition at line 153 of file IntArray.h.


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