#include <array.h>
Classes | |
class | IteratorTemplate |
Public Types | |
using | TYPE_FOR_SIZEOF = typename std::conditional< GENERIC, Char, TYPE >::type |
using | Iterator = IteratorTemplate< VArrayInterface > |
using | ConstIterator = IteratorTemplate< const VArrayInterface > |
Static Public Attributes | |
static const Bool | GENERIC |
Private Member Functions | |
MAXON_INTERFACE_SIMPLE_VIRTUAL (VArrayInterface, MAXON_REFERENCE_COPY_ON_WRITE) | |
Static Private Member Functions | |
static VArrayInterface * | Alloc (MAXON_SOURCE_LOCATION_DECLARATION) |
static VArrayInterface * | Alloc (MAXON_SOURCE_LOCATION_DECLARATION, const VArrayInterface &src) |
using TYPE_FOR_SIZEOF = typename std::conditional<GENERIC, Char, TYPE>::type |
using Iterator = IteratorTemplate<VArrayInterface> |
using ConstIterator = IteratorTemplate<const VArrayInterface> |
|
private |
MAXON_METHOD Int GetCount | ( | ) | const |
Gets the number of array elements.
MAXON_FUNCTION Bool IsEmpty | ( | ) | const |
@MAXON_ANNOTATION{default=true}
MAXON_FUNCTION Bool IsPopulated | ( | void | ) | const |
const MAXON_METHOD TYPE& operator[] | ( | Int | index | ) | const |
Array (subscript) operator for const objects.
[in] | index | Element index. |
MAXON_METHOD ResultRef<TYPE> GetWritable | ( | Int | index | ) |
Array (subscript) operator for non-const objects.
[in] | index | Element index. |
MAXON_FUNCTION ResultMem Set | ( | Int | index, |
T && | value | ||
) |
MAXON_METHOD Int GetBlock | ( | Int | index, |
SimdBlock< const TYPE > & | block | ||
) | const |
Determines a contiguous, possibly strided block of array elements which contains the element at index
. The returned blocks are guaranteed to form a partition of the array, i.e., no two blocks overlap, and they cover the whole array.
Using this method can greatly reduce the performance penalty of virtual method invocations of the Array interface as only one such invocation has to happen per block, and a block may consist of a relatively large number of elements which can then be accessed directly.
[in] | index | Element index. |
[out] | block | Block which contains the element at index . |
index
- start index. Int GetBlock | ( | Int | index, |
StridedBlock< const TYPE > & | block | ||
) | const |
MAXON_METHOD Result<Int> GetWritableBlock | ( | Int | index, |
SimdBlock< TYPE > & | block | ||
) |
Determines a contiguous, possibly strided writable block of array elements which contains the element at index
. The returned blocks are guaranteed to form a partition of the array, i.e., no two blocks overlap, and they cover the whole array.
Using this method can greatly reduce the performance penalty of virtual method invocations of the Array interface as only one such invocation has to happen per block, and a block may consist of a relatively large number of elements which can then be accessed directly.
[in] | index | Element index. |
[out] | block | Block which contains the element at index . |
index
- start index. MAXON_METHOD Result<VArrayInterface*> Clone | ( | Bool | cloneElements = true | ) | const |
Returns a clone of this array.
[in] | cloneElements | True if also the elements shall be cloned, false otherwise (then just a new object sharing the same ArrayInterface implementation is created). |
const MAXON_METHOD DataType& GetValueDataType | ( | ) | const |
MAXON_METHOD String ToString | ( | const FormatStatement * | formatStatement | ) | const |
[in] | formatStatement | Nullptr or additional formatting instruction. Currently no additional formatting instructions are supported. |
MAXON_METHOD Bool IsEqual | ( | const VArrayInterface< TYPE > * | other, |
EQUALITY | equality | ||
) | const |
MAXON_METHOD UInt GetHashCode | ( | ) | const |
MAXON_METHOD Result<void> PrivateInsert | ( | Int | index, |
const StridedBlock< const TYPE > & | values, | ||
Bool | move | ||
) |
For future compatibility, not implemented at the moment.
MAXON_METHOD ResultMem Resize | ( | Int | count, |
COLLECTION_RESIZE_FLAGS | resizeFlags = COLLECTION_RESIZE_FLAGS::DEFAULT |
||
) |
Resizes the array to contain count elements. If count is smaller than GetCount() all extra elements are being deleted. If it is greater the array is expanded and the default constructor is called for new elements.
[in] | count | New array size. |
[in] | resizeFlags | See COLLECTION_RESIZE_FLAGS. |
MAXON_METHOD ResultMem SetCapacityHint | ( | Int | requestedCapacity, |
COLLECTION_RESIZE_FLAGS | resizeFlags = COLLECTION_RESIZE_FLAGS::ON_GROW_RESERVE_CAPACITY |
||
) |
Prepare the internal array so that it can hold at least the given number of elements with as few further memory allocations as possible.
[in] | requestedCapacity | The desired internal capacity. |
[in] | resizeFlags | If ON_GROW_FIT_TO_SIZE is set, the collection will use only as much memory as needed to hold the data. |
MAXON_METHOD ResultRef<TYPE> Insert | ( | Int | index | ) |
Inserts a new element at index
. The element will be default-constructed.
[in] | index | Insertion index (the array size will increase and the existing elements are moved). |
MAXON_FUNCTION ResultRef<TYPE> Insert | ( | Int | index, |
const TYPE & | value | ||
) |
Inserts a new element at index position and initializes it with #value.
[in] | index | Insert index (the array size will increase and the existing elements are moved). |
[in] | value | Value to be inserted. |
MAXON_FUNCTION ResultRef<TYPE> Insert | ( | Int | index, |
TYPE && | value | ||
) |
Inserts a new element at index position and initializes it with #value.
[in] | index | Insert index (the array size will increase and the existing elements are moved). |
[in] | value | Value to be inserted. |
MAXON_METHOD ResultMem Insert | ( | Int | index, |
const Block< const TYPE > & | values | ||
) |
Inserts a number of new elements at index
. The elements will be copied.
[in] | index | Insertion index (the array size will increase and the existing elements are moved). |
[in] | values | Block with values to be copied. If the block points to nullptr, only its count is used, and you have to call the constructor of the new elements manually. |
MAXON_METHOD ResultMem Insert | ( | Int | index, |
const MoveBlock< TYPE > & | values | ||
) |
Inserts a number of new elements at index
. The elements will be moved.
[in] | index | Insertion index (the array size will increase and the existing elements are moved). |
[in] | values | Block with values to be moved. If the block points to nullptr, only its count is used, and you have to call the constructor of the new elements manually. |
MAXON_METHOD ResultRef<TYPE> Append | ( | ) |
Adds a new element at the end of the array. The element will be default-constructed.
MAXON_FUNCTION ResultRef<TYPE> Append | ( | const TYPE & | value | ) |
Adds a new element at the end of the array and initializes it with #value.
[in] | value | Value to be appended. |
MAXON_FUNCTION ResultRef<TYPE> Append | ( | TYPE && | value | ) |
Adds a new element at the end of the array and initializes it with #value.
[in] | value | Value to be appended. |
MAXON_FUNCTION ResultRef<TYPE> Append | ( | T && | value | ) |
Adds a new element at the end of the array and initializes it with #value.
[in] | value | Value to be appended. |
MAXON_FUNCTION Bool Pop | ( | ) |
Deletes the last element.
MAXON_FUNCTION Bool Pop | ( | TYPE * | dst | ) |
Deletes the last element.
[out] | dst | Nullptr or pointer to return value. |
MAXON_METHOD ResultMem Erase | ( | Int | index, |
Int | count = 1 |
||
) |
Erases (removes and deletes) elements.
[in] | index | Erase index. |
[in] | count | Number of elements to be erased (if eraseCnt is higher than what is available at position Erase() will succeed, but remove only the number of available elements). |
MAXON_METHOD ResultMem SwapErase | ( | Int | index, |
Int | count = 1 |
||
) |
Erases elements within the array and moves elements from the end to the erased gap. This is generally faster than Erase because at most count elements have to be moved, but it changes the order of elements.
[in] | index | Erase index. |
[in] | count | Number of elements to be erased (if eraseCnt is higher than what is available at position Erase() will succeed, but remove only the number of available elements). |
MAXON_METHOD void Reset | ( | ) |
Deletes all elements (calls destructors and frees memory).
MAXON_METHOD void Flush | ( | ) |
Deletes all elements, but doesn't free memory (calls destructors though).
MAXON_METHOD Result<void> CopyFrom | ( | const VArrayInterface< TYPE > & | other | ) |
Sets this array to a copy of the given other array.
[in] | other | Source array. |
BlockIterator<VArrayInterface, TYPE, true, false> GetBlocks | ( | ) | const |
BlockIterator<VArrayInterface, TYPE, true, true> GetStridedBlocks | ( | ) | const |
Int GetValueSize | ( | ) | const |
MAXON_FUNCTION ConstIterator Begin | ( | ) | const |
Returns an iterator pointing to the first array element.
Iterator Begin | ( | ) |
Returns an iterator pointing to the first array element.
MAXON_FUNCTION ConstIterator End | ( | ) | const |
Returns an iterator pointing one behind the last array element.
Iterator End | ( | ) |
Returns an iterator pointing one behind the last array element.
|
staticprivate |
|
staticprivate |
|
static |