Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::UniqueArray2< T > Class Template Reference

2D data vector with value semantics (STL style). More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/collections/arccore/collections/Array2.h>

Inheritance diagram for Arcane::UniqueArray2< T >:
Collaboration diagram for Arcane::UniqueArray2< T >:

Public Types

typedef AbstractArray< T > BaseClassType
typedef BaseClassType::ConstReferenceType ConstReferenceType

Public Member Functions

 UniqueArray2 ()
 Creates an empty array.
 UniqueArray2 (Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements.
 UniqueArray2 (const Span2< const T > &view)
 Creates an array by copying the values from the view.
 UniqueArray2 (const ConstArray2View< T > &view)
 Creates an array by copying the values from the view.
 UniqueArray2 (const Array2< T > &rhs)
 Creates an array by copying the values of rhs.
 UniqueArray2 (const UniqueArray2< T > &rhs)
 Creates an array by copying the values of rhs.
 UniqueArray2 (const SharedArray2< T > &rhs)
 Creates an array by copying the values of rhs.
 UniqueArray2 (IMemoryAllocator *allocator)
 Creates an empty array with a specific allocator allocator.
 UniqueArray2 (IMemoryAllocator *allocator, Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements with a specific allocator allocator.
 UniqueArray2 (UniqueArray2< T > &&rhs) ARCCORE_NOEXCEPT
 Move constructor. rhs is invalidated after this call.
UniqueArray2operator= (const Array2< T > &rhs)
 Copies the values of rhs into this instance.
UniqueArray2operator= (const SharedArray2< T > &rhs)
 Copies the values of rhs into this instance.
UniqueArray2operator= (const UniqueArray2< T > &rhs)
 Copies the values of rhs into this instance.
UniqueArray2operator= (ConstArray2View< T > rhs)
 Copies the values of the view rhs into this instance.
UniqueArray2operator= (const Span2< const T > &rhs)
 Copies the values of the view rhs into this instance.
UniqueArray2operator= (UniqueArray2< T > &&rhs) ARCCORE_NOEXCEPT
 Move assignment operator. rhs is invalidated after this call.
 ~UniqueArray2 () override=default
 Destroys the array.
void swap (UniqueArray2< T > &rhs) ARCCORE_NOEXCEPT
 Swaps the values of v1 and v2.
UniqueArray2< T > clone ()
 Clones the array.
Public Member Functions inherited from Arcane::Array2< T >
ArrayView< T > operator[] (Int64 i)
ConstArrayView< T > operator[] (Int64 i) const
ArrayView< T > operator() (Int64 i)
ConstArrayView< T > operator() (Int64 i) const
T & operator() (Int64 i, Int64 j)
ConstReferenceType operator() (Int64 i, Int64 j) const
item (Int64 i, Int64 j)
void setItem (Int64 i, Int64 j, ConstReferenceType v)
ConstArrayView< T > at (Int64 i) const
 Element at index i. Always checks for bounds.
ArrayView< T > at (Int64 i)
 Element at index i. Always checks for bounds.
at (Int64 i, Int64 j)
void fill (ConstReferenceType v)
void clear ()
Array2< T > clone ()
void copy (Span2< const T > rhs)
 Resizes the instance based on the dimensions of rhs and copies the values of rhs into it.
Integer capacity () const
 Capacity (number of allocated elements) of the array.
Int64 largeCapacity () const
 Capacity (number of allocated elements) of the array.
void reserve (Int64 new_capacity)
 Reserves memory for new_capacity elements.
void shrink ()
void shrink (Int64 new_capacity)
 Reallocates memory to have a capacity close to new_capacity.
void shrink_to_fit ()
ArrayView< T > viewAsArray ()
 View of the array as a 1D array.
ConstArrayView< T > viewAsArray () const
 View of the array as a 1D array.
Span< T > to1DSpan ()
 View of the array as a 1D array.
Span< const T > to1DSpan () const
 View of the array as a 1D array.
 operator Array2View< T > ()
 operator ConstArray2View< T > () const
 operator Span2< const T > () const
 operator Span2< T > ()
Array2View< T > view ()
ConstArray2View< T > constView () const
Span2< T > span ()
Span2< const T > constSpan () const
Integer dim2Size () const
Integer dim1Size () const
Int64 largeDim2Size () const
Int64 largeDim1Size () const
void add (const T &value)
void resize (Int64 new_size)
 Resizes only the first dimension, leaving the second dimension unchanged.
void resizeNoInit (Int64 new_size)
 Resizes only the first dimension, leaving the second dimension unchanged.
void resize (Int64 new_size1, Int64 new_size2)
 Reallocates both dimensions.
void resizeNoInit (Int64 new_size1, Int64 new_size2)
 Reallocates both dimensions.
Integer totalNbElement () const
 Total number of elements (dim1Size()*dim2Size()).
Int64 largeTotalNbElement () const
 Total number of elements (largeDim1Size()*largeDim2Size()).
MemoryAllocationOptions allocationOptions () const
String debugName () const
 Debug name (null if no name specified).
void setDebugName (const String &name)
 Sets the array name for debug information.
ArrayView< T > operator[] (Int64 i)
ConstArrayView< T > operator[] (Int64 i) const
ArrayView< T > operator() (Int64 i)
ConstArrayView< T > operator() (Int64 i) const
T & operator() (Int64 i, Int64 j)
ConstReferenceType operator() (Int64 i, Int64 j) const
item (Int64 i, Int64 j)
void setItem (Int64 i, Int64 j, ConstReferenceType v)
ConstArrayView< T > at (Int64 i) const
 Element at index i. Always checks for bounds.
ArrayView< T > at (Int64 i)
 Element at index i. Always checks for bounds.
at (Int64 i, Int64 j)
void fill (ConstReferenceType v)
void clear ()
Array2< T > clone ()
void copy (Span2< const T > rhs)
 Resizes the instance based on the dimensions of rhs and copies the values of rhs into it.
Integer capacity () const
 Capacity (number of allocated elements) of the array.
Int64 largeCapacity () const
 Capacity (number of allocated elements) of the array.
void reserve (Int64 new_capacity)
 Reserves memory for new_capacity elements.
void shrink ()
void shrink (Int64 new_capacity)
 Reallocates memory to have a capacity close to new_capacity.
void shrink_to_fit ()
ArrayView< T > viewAsArray ()
 View of the array as a 1D array.
ConstArrayView< T > viewAsArray () const
 View of the array as a 1D array.
Span< T > to1DSpan ()
 View of the array as a 1D array.
Span< const T > to1DSpan () const
 View of the array as a 1D array.
 operator Array2View< T > ()
 operator ConstArray2View< T > () const
 operator Span2< const T > () const
 operator Span2< T > ()
Array2View< T > view ()
ConstArray2View< T > constView () const
Span2< T > span ()
Span2< const T > constSpan () const
Integer dim2Size () const
Integer dim1Size () const
Int64 largeDim2Size () const
Int64 largeDim1Size () const
void add (const T &value)
void resize (Int64 new_size)
 Resizes only the first dimension, leaving the second dimension unchanged.
void resize (Int64 new_size1, Int64 new_size2)
 Reallocates both dimensions.
void resizeNoInit (Int64 new_size)
 Resizes only the first dimension, leaving the second dimension unchanged.
void resizeNoInit (Int64 new_size1, Int64 new_size2)
 Reallocates both dimensions.
Integer totalNbElement () const
 Total number of elements (dim1Size()*dim2Size()).
Int64 largeTotalNbElement () const
 Total number of elements (largeDim1Size()*largeDim2Size()).
MemoryAllocationOptions allocationOptions () const
String debugName () const
 Debug name (null if no name specified).
void setDebugName (const String &name)
 Sets the array name for debug information.
 operator Array2View< T > ()
 operator ConstArray2View< T > () const
 operator Span2< const T > () const
 operator Span2< T > ()
 operator Array2View< T > ()
 operator ConstArray2View< T > () const
 operator Span2< const T > () const
 operator Span2< T > ()

Additional Inherited Members

Protected Types inherited from Arcane::Array2< T >
enum  CloneBehaviour
enum  InitBehaviour
Protected Member Functions inherited from Arcane::Array2< T >
 Array2 (Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements.
 Array2 (ConstArray2View< T > rhs)
 Array2 (const Span2< const T > &rhs)
 Array2 (IMemoryAllocator *allocator)
 Creates an empty array with a specific allocator allocator.
 Array2 (IMemoryAllocator *allocator, Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements with a specific allocator allocator.
 Array2 (Array2< T > &&rhs)
 Move constructor. Only valid for UniqueArray2.
void _resize (Int64 new_size, InitBehaviour rb)
 Resizes only the first dimension, leaving the second dimension unchanged.
void _resize (Int64 new_size1, Int64 new_size2, InitBehaviour rb)
 Reallocates both dimensions.
void _resizeFromEmpty (Int64 new_size1, Int64 new_size2, InitBehaviour rb)
void _resizeSameDim1ReduceDim2 (Int64 new_size2, InitBehaviour rb)
void _resizeSameDim1IncreaseDim2 (Int64 new_size2, InitBehaviour rb)
void _resize2 (Int64 d1, Int64 d2, InitBehaviour rb)
void _move (Array2< T > &rhs)
void _swap (Array2< T > &rhs)
void _assignFromArray2 (const Array2< T > &rhs)
void _resizeAndCopyView (Span2< const T > rhs)
void _copyMetaData (const Array2< T > &rhs)
void _destroy ()
void _initFromAllocator (MemoryAllocationOptions o, Int64 acapacity, void *pre_allocated_buffer=nullptr)
 Constructs an empty vector with a specific allocator a.
void _internalDeallocate (RunQueue *queue=nullptr)
void _setMP (TrueImpl *new_mp)
void _setMP2 (TrueImpl *new_mp, ArrayMetaData *new_md)
 Array2 (Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements.
 Array2 (ConstArray2View< T > rhs)
 Array2 (const Span2< const T > &rhs)
 Array2 (IMemoryAllocator *allocator)
 Creates an empty array with a specific allocator allocator.
 Array2 (IMemoryAllocator *allocator, Int64 size1, Int64 size2)
 Creates an array of size1 * size2 elements with a specific allocator allocator.
 Array2 (Array2< T > &&rhs)
 Move constructor. Only valid for UniqueArray2.
void _resize (Int64 new_size, InitBehaviour rb)
 Resizes only the first dimension, leaving the second dimension unchanged.
void _resize (Int64 new_size1, Int64 new_size2, InitBehaviour rb)
 Reallocates both dimensions.
void _resizeFromEmpty (Int64 new_size1, Int64 new_size2, InitBehaviour rb)
void _resizeSameDim1ReduceDim2 (Int64 new_size2, InitBehaviour rb)
void _resizeSameDim1IncreaseDim2 (Int64 new_size2, InitBehaviour rb)
void _resize2 (Int64 d1, Int64 d2, InitBehaviour rb)
void _move (Array2< T > &rhs)
void _swap (Array2< T > &rhs)
void _assignFromArray2 (const Array2< T > &rhs)
void _resizeAndCopyView (Span2< const T > rhs)
void _copyMetaData (const Array2< T > &rhs)
void _destroy ()
void _initFromAllocator (MemoryAllocationOptions o, Int64 acapacity, void *pre_allocated_buffer=nullptr)
 Constructs an empty vector with a specific allocator a.
void _internalDeallocate (RunQueue *queue=nullptr)
void _setMP (TrueImpl *new_mp)
void _setMP2 (TrueImpl *new_mp, ArrayMetaData *new_md)
Protected Attributes inherited from Arcane::Array2< T >
T * m_ptr
T * m_ptr

Detailed Description

template<typename T>
class Arcane::UniqueArray2< T >

2D data vector with value semantics (STL style).

This class is the counterpart of UniqueArray for 2D arrays.

Definition at line 727 of file arccore/src/collections/arccore/collections/Array2.h.

Member Typedef Documentation

◆ BaseClassType

template<typename T>
typedef AbstractArray<T> Arcane::UniqueArray2< T >::BaseClassType

◆ ConstReferenceType

template<typename T>
typedef BaseClassType::ConstReferenceType Arcane::UniqueArray2< T >::ConstReferenceType

Constructor & Destructor Documentation

◆ UniqueArray2() [1/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( )
inline

Creates an empty array.

Definition at line 739 of file arccore/src/collections/arccore/collections/Array2.h.

Referenced by Arcane::UniqueArray2< DataType >::clone().

Here is the caller graph for this function:

◆ UniqueArray2() [2/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( Int64 size1,
Int64 size2 )
inlineexplicit

Creates an array of size1 * size2 elements.

Definition at line 743 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [3/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( const Span2< const T > & view)
inline

Creates an array by copying the values from the view.

Definition at line 749 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [4/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( const ConstArray2View< T > & view)
inline

Creates an array by copying the values from the view.

Definition at line 753 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [5/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( const Array2< T > & rhs)
inline

Creates an array by copying the values of rhs.

Definition at line 757 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [6/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( const UniqueArray2< T > & rhs)
inline

Creates an array by copying the values of rhs.

Definition at line 764 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [7/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( const SharedArray2< T > & rhs)
inline

Creates an array by copying the values of rhs.

Definition at line 771 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [8/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( IMemoryAllocator * allocator)
inlineexplicit

Creates an empty array with a specific allocator allocator.

Definition at line 775 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [9/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( IMemoryAllocator * allocator,
Int64 size1,
Int64 size2 )
inline

Creates an array of size1 * size2 elements with a specific allocator allocator.

Definition at line 782 of file arccore/src/collections/arccore/collections/Array2.h.

◆ UniqueArray2() [10/10]

template<typename T>
Arcane::UniqueArray2< T >::UniqueArray2 ( UniqueArray2< T > && rhs)
inline

Move constructor. rhs is invalidated after this call.

Definition at line 786 of file arccore/src/collections/arccore/collections/Array2.h.

Member Function Documentation

◆ clone()

template<typename T>
UniqueArray2< T > Arcane::UniqueArray2< T >::clone ( )
inline

Clones the array.

Definition at line 838 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [1/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( const Array2< T > & rhs)
inline

Copies the values of rhs into this instance.

Definition at line 788 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [2/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( const SharedArray2< T > & rhs)
inline

Copies the values of rhs into this instance.

Definition at line 794 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [3/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( const Span2< const T > & rhs)
inline

Copies the values of the view rhs into this instance.

Definition at line 812 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [4/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( const UniqueArray2< T > & rhs)
inline

Copies the values of rhs into this instance.

Definition at line 800 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [5/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( ConstArray2View< T > rhs)
inline

Copies the values of the view rhs into this instance.

Definition at line 806 of file arccore/src/collections/arccore/collections/Array2.h.

◆ operator=() [6/6]

template<typename T>
UniqueArray2 & Arcane::UniqueArray2< T >::operator= ( UniqueArray2< T > && rhs)
inline

Move assignment operator. rhs is invalidated after this call.

Definition at line 818 of file arccore/src/collections/arccore/collections/Array2.h.

◆ swap()

template<typename T>
void Arcane::UniqueArray2< T >::swap ( UniqueArray2< T > & rhs)
inline

Swaps the values of v1 and v2.

The swap is done in constant time and without reallocation.

Definition at line 833 of file arccore/src/collections/arccore/collections/Array2.h.

Referenced by Arcane::swap().

Here is the caller graph for this function:

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