StaticArrayInterface< TYPE > Class Template Reference

#include <array.h>

Inheritance diagram for StaticArrayInterface< TYPE >:

Classes

class  IteratorTemplate
 

Public Types

using ValueType = TYPE
 
using NonConstValueType = typename std::remove_const< TYPE >::type
 
using TYPE_FOR_SIZEOF = typename std::conditional< GENERIC, Char, TYPE >::type
 
using Iterator = IteratorTemplate< StaticArrayInterface >
 
using ConstIterator = IteratorTemplate< const StaticArrayInterface >
 

Public Member Functions

MAXON_METHOD Int GetCount () const
 
MAXON_FUNCTION Bool IsEmpty () const
 
MAXON_FUNCTION Bool IsPopulated () const
 
const MAXON_METHOD TYPE & operator[] (Int index) const
 
MAXON_METHOD ResultRef< TYPE > GetWritable (Int index)
 
template<typename A >
MAXON_FUNCTION ResultMem Set (Int index, A &&value)
 
MAXON_METHOD Int GetBlock (Int index, SimdBlock< const TYPE > &block) const
 
Int GetBlock (Int index, StridedBlock< const TYPE > &block) const
 
Int GetBlock (Int index, Block< const TYPE, false > &block) const
 
MAXON_METHOD Result< IntGetBlock (Int index, SimdBlock< NonConstValueType > &block)
 
Int GetBlock (Int index, StridedBlock< NonConstValueType > &block)
 
const MAXON_METHOD DataTypeGetValueDataType () const
 
const MAXON_METHOD PersistentIdGenerator & GetPersistentIdGenerator () const
 
BlockIterator< StaticArrayInterface, TYPE, true, false > GetBlocks () const
 
BlockIterator< StaticArrayInterface, TYPE, true, true > GetStridedBlocks () const
 
Int GetValueSize () const
 
MAXON_FUNCTION StaticArrayInterface< TYPE >::ConstIterator Begin () const
 
Iterator Begin ()
 
MAXON_FUNCTION StaticArrayInterface< TYPE >::ConstIterator End () const
 
Iterator End ()
 

Public Attributes

 MAXON_METHOD_RESERVE
 

Static Public Attributes

static const Bool GENERIC
 

Private Member Functions

 MAXON_INTERFACE_SIMPLE_VIRTUAL_DERIVED (StaticArrayInterface, MAXON_REFERENCE_COPY_ON_WRITE)
 

Static Private Member Functions

static StaticArrayInterfaceAlloc (MAXON_SOURCE_LOCATION_DECLARATION)
 

Friends

class StrongCOWRefHandler
 

Member Typedef Documentation

◆ ValueType

using ValueType = TYPE

◆ NonConstValueType

using NonConstValueType = typename std::remove_const<TYPE>::type

◆ TYPE_FOR_SIZEOF

using TYPE_FOR_SIZEOF = typename std::conditional<GENERIC, Char, TYPE>::type

◆ Iterator

◆ ConstIterator

Member Function Documentation

◆ MAXON_INTERFACE_SIMPLE_VIRTUAL_DERIVED()

MAXON_INTERFACE_SIMPLE_VIRTUAL_DERIVED ( StaticArrayInterface< TYPE >  ,
MAXON_REFERENCE_COPY_ON_WRITE   
)
private

◆ GetCount()

MAXON_METHOD Int GetCount ( ) const

Gets the number of array elements.

Returns
Number of array elements.

◆ IsEmpty()

MAXON_FUNCTION Bool IsEmpty ( ) const

@MAXON_ANNOTATION{default=true}

◆ IsPopulated()

MAXON_FUNCTION Bool IsPopulated ( ) const

◆ operator[]()

const MAXON_METHOD TYPE& operator[] ( Int  index) const

Array (subscript) operator for const objects.

Parameters
[in]indexElement index.
Returns
Array element.

◆ GetWritable()

MAXON_METHOD ResultRef<TYPE> GetWritable ( Int  index)

Array (subscript) operator for non-const objects.

Parameters
[in]indexElement index.
Returns
Array element.

◆ Set()

MAXON_FUNCTION ResultMem Set ( Int  index,
A &&  value 
)

◆ GetBlock() [1/5]

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.

Parameters
[in]indexElement index.
[out]blockBlock which contains the element at index.
Returns
Start index of the block. I.e., the requested element can be found within the block at index - start index.

◆ GetBlock() [2/5]

Int GetBlock ( Int  index,
StridedBlock< const TYPE > &  block 
) const

◆ GetBlock() [3/5]

Int GetBlock ( Int  index,
Block< const TYPE, false > &  block 
) const

◆ GetBlock() [4/5]

MAXON_METHOD Result<Int> GetBlock ( Int  index,
SimdBlock< NonConstValueType > &  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.

Parameters
[in]indexElement index.
[out]blockBlock which contains the element at index.
Returns
Start index of the block. I.e., the requested element can be found within the block at index - start index. @MAXON_ANNOTATION{cowName=GetWritableBlock}

◆ GetBlock() [5/5]

Int GetBlock ( Int  index,
StridedBlock< NonConstValueType > &  block 
)

◆ GetValueDataType()

const MAXON_METHOD DataType& GetValueDataType ( ) const

Returns the data type of this array's elements. This may be nullptr if there is no DataType for the template parameter TYPE.

Returns
DataType of the elements or nullptr.

◆ GetPersistentIdGenerator()

const MAXON_METHOD PersistentIdGenerator& GetPersistentIdGenerator ( ) const

◆ GetBlocks()

BlockIterator<StaticArrayInterface, TYPE, true, false> GetBlocks ( ) const

◆ GetStridedBlocks()

BlockIterator<StaticArrayInterface, TYPE, true, true> GetStridedBlocks ( ) const

◆ GetValueSize()

Int GetValueSize ( ) const

◆ Begin() [1/2]

Returns an iterator pointing to the first array element.

Returns
Iterator for the first element (equal to End() if the array is empty).

◆ Begin() [2/2]

Iterator Begin ( )

Returns an iterator pointing to the first array element.

Returns
Iterator for the first element (equal to End() if the array is empty).

◆ End() [1/2]

Returns an iterator pointing one behind the last array element.

Returns
Iterator for the array end, this is one behind the last element.

◆ End() [2/2]

Iterator End ( )

Returns an iterator pointing one behind the last array element.

Returns
Iterator for the array end, this is one behind the last element.

◆ Alloc()

static StaticArrayInterface* Alloc ( MAXON_SOURCE_LOCATION_DECLARATION  )
staticprivate

Friends And Related Function Documentation

◆ StrongCOWRefHandler

friend class StrongCOWRefHandler
friend

Member Data Documentation

◆ MAXON_METHOD_RESERVE

MAXON_METHOD_RESERVE

◆ GENERIC

const Bool GENERIC
static