#include <vctDynamicNArray.h>
Inheritance diagram for vctDynamicNArray< _elementType, _dimension >:


This class defines a nArray object of dynamic size with memory allocation.
The algebraic operations are mostly inherited from the base classes vctDynamicNArrayBase and vctDynamicConstNArrayBase. Here, we will briefly describe the specific properties of vctDynamicNArray, with a few usage examples.
nsize_type, nindex_type and nstride_type are defined within the scope of the nArray classes and used in their interfaces to set the sizes, access elements or manipulate the layout. // define a typical element type and a couple of useful other types typedef double ElementType; enum {DIMENSION = 3}; typedef vctDynamicNArray<ElementType, DIMENSION> ArrayType; typedef typename ArrayType::nsize_type SizeType; // constructor allocation, empty array ArrayType a1; // Create an empty nArray and later allocate memory. ArrayType a2; a2.SetSize(SizeType(5, 7, 8)); vctRandom(a2, ElementType(0), ElementType(10)); // Create an nArray of some size and change it later. // This operation does not preserve any elements in the resized // nArray ArrayType a3(SizeType(7, 8, 9)); a3.SetSize(a2.sizes()); vctRandom(a3, ElementType(-10), ElementType(0)); // Store an algebraic result to a new nArray. In this case, // memory is allocated by the algebraic operation, and then // attached to the nArray object. ArrayType a4 = a3 - a2;
// Initialize all elements to the same value ArrayType a5(a3.sizes(), 2.0); // Assign one matrix to another. vctDynamicNArray<int, DIMENSION> nArrayInt; nArrayInt.Assign(a5); // preferred syntax nArrayInt = a5; // same operation
A few more notes.
| _elementType | the type of an element in the nArray. | |
| _dimension | the dimension the multi-dimensional array. |
Definition at line 123 of file vctDynamicNArray.h.
| typedef vctDynamicNArrayBase<vctDynamicNArrayOwner<_elementType, _dimension>, _elementType, _dimension> vctDynamicNArray< _elementType, _dimension >::BaseType |
Type of the base class
Reimplemented from vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >.
Reimplemented in vctReturnDynamicNArray< _elementType, _dimension >.
Definition at line 134 of file vctDynamicNArray.h.
| typedef vctDynamicNArray<_elementType, _dimension> vctDynamicNArray< _elementType, _dimension >::ThisType |
Type of the nArray itself
Reimplemented from vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >.
Definition at line 135 of file vctDynamicNArray.h.
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | ) | [inline] |
Default constructor. Initialize an empty nArray.
Definition at line 138 of file vctDynamicNArray.h.
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const nsize_type & | sizes | ) | [inline] |
Constructor: Create an nArray of the specified sizes. Elements initialized with default constructor.
Definition at line 144 of file vctDynamicNArray.h.
References vctDynamicConstNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::NArray, and vctDynamicNArrayOwner< _elementType, _dimension >::SetSize().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const nsize_type & | sizes, | |
| value_type | value | |||
| ) | [inline] |
Constructor: Create an nArray of the specified size and assign all elements a specific value.
Definition at line 151 of file vctDynamicNArray.h.
References vctDynamicConstNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::NArray, vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::SetAll(), and vctDynamicNArrayOwner< _elementType, _dimension >::SetSize().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const vctReturnDynamicNArray< value_type, _dimension > & | otherNArray | ) |
Special copy constructor: Take ownership of the data of a temporary nArray object of type vctReturnDynamicNArray. Disown the other nArray.
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const ThisType & | otherNArray | ) | [inline] |
Copy constructor: Allocate memory to store a copy of the other nArray, and copy the elements of the other nArray to this nArray.
Definition at line 167 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const vctDynamicConstNArrayBase< _otherNArrayOwnerType, value_type, _dimension > & | otherNArray | ) | [inline] |
Copy constructor: Allocate memory to store a copy of the other nArray, and copy the elements of the other nArray to this nArray.
Definition at line 174 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const vctDynamicConstNArrayBase< _otherNArrayOwnerType, _otherNArrayElementType, _dimension > & | otherNArray | ) | [inline, explicit] |
Copy constructor: Allocate memory and copy all the elements from the other nArray. This constructor can also be used for type conversions.
Definition at line 186 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const ThisType & | otherNArray | ) | [inline] |
Copy constructor: Allocate memory to store a copy of the other nArray, and copy the elements of the other nArray to this nArray.
Definition at line 167 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray | ( | const vctDynamicConstNArrayBase< _otherNArrayOwnerType, value_type, _dimension > & | otherNArray | ) | [inline] |
Copy constructor: Allocate memory to store a copy of the other nArray, and copy the elements of the other nArray to this nArray.
Definition at line 174 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| ThisType& vctDynamicNArray< _elementType, _dimension >::operator= | ( | const vctDynamicConstNArrayBase< __nArrayOwnerType, __elementType, _dimension > & | otherNArray | ) | [inline] |
Assignment from an nArray to this nArray. The operation discards the old memory allocated for this nArray and allocates new memory the size of the input nArray. Then the elements of the input nArray are copied into this nArray.
Definition at line 199 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| ThisType& vctDynamicNArray< _elementType, _dimension >::operator= | ( | const ThisType & | otherNArray | ) | [inline] |
Equals operator: Assignment from a vctDynamicNArray to this nArray (also a vctDynamicNArray). The operation discards the old memory allocated for this nArray and allocates new memory the size of the input vctDynamicNArray. Then the elements of the input vctDynamicNArray are copied into this nArray.
Definition at line 212 of file vctDynamicNArray.h.
References vctDynamicNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::Assign(), vctDynamicNArray< _elementType, _dimension >::SetSize(), and vctDynamicConstNArrayBase< _nArrayOwnerType, _elementType, _dimension >::sizes().
| ThisType& vctDynamicNArray< _elementType, _dimension >::operator= | ( | const vctReturnDynamicNArray< value_type, _dimension > & | otherNArray | ) |
Assignment from a transitional vctReturnDynamicNArray to a vctDynamicNArray variable. This specialized operation does not perform any element copy. Instead it transfers ownership of the data from the other nArray to this nArray, and disowns the other nArray. The right hand side operand must be a temporary object returned, e.g., from a function or overloaded operator.
| ThisType& vctDynamicNArray< _elementType, _dimension >::operator= | ( | const value_type & | value | ) | [inline] |
Assignment of a scalar to all elements. See also SetAll.
Definition at line 232 of file vctDynamicNArray.h.
| void vctDynamicNArray< _elementType, _dimension >::SetSize | ( | const nsize_type & | sizes | ) | [inline] |
Destructive size change. Change the size to the specified size. Discard all of the old values.
Definition at line 248 of file vctDynamicNArray.h.
References vctDynamicConstNArrayBase< vctDynamicNArrayOwner< _elementType, _dimension >, _elementType, _dimension >::NArray, and vctDynamicNArrayOwner< _elementType, _dimension >::SetSize().
Referenced by vctDynamicNArray< _elementType, _dimension >::ForceAssign(), vctDynamicNArray< _elementType, _dimension >::operator=(), and vctDynamicNArray< _elementType, _dimension >::vctDynamicNArray().