Murl::Array< DataType > Class Template Reference

A generic array template class for moveable objects eg. structs or fundamental data types like UInt32, Real, etc. More...

#include "murl_array.h"

Inherited by Murl::Vulkan::SyncArray< VkDescriptorSetLayout >, Murl::Vulkan::SyncArray< VertexInputAttributeDescription >, Murl::Vulkan::SyncArray< UInt32X2 >, and Murl::Vulkan::SyncArray< DataType >.

Public Types

using ValueType = DataType
 The template parameter value type.
 
using ConstIterator = const DataType *
 Definition of the const iterator.
 
using Iterator = DataType *
 Definition of the iterator.
 

Public Member Functions

 Array ()=default
 Construct an empty array.
 
 Array (const DataType &item)
 Construct an array containing a single item. More...
 
 Array (const DataType &item1, const DataType &item2)
 Construct an array containing two items. More...
 
 Array (const DataType &item1, const DataType &item2, const DataType &item3)
 Construct an array containing three items. More...
 
 Array (const Array &other) noexcept
 Construct an array from an already existing one, performing a deep copy. More...
 
 Array (Array &&other) noexcept
 Construct an array by moving an already existing one, performing no copy. More...
 
Arrayoperator= (const Array &other) noexcept
 Assign the content of another array to this one, performing a deep copy. More...
 
Arrayoperator= (Array &&other) noexcept
 Assign the content of another array to this one, moving its pointers. More...
 
 ~Array ()
 Destroy the array and all of its contents.
 
void Clear ()
 Clear the array and remove the underlying storage.
 
void Empty ()
 Empty the array, but keep the underlying storage.
 
void Shrink ()
 Shrink the array so that the underlying storage is only as large as necessary.
 
Bool Trim (SInt32 n)
 Reduce the array to a given number of items. More...
 
Bool Drop (const SInt32 n=1)
 Reduce the array by removing a given number of items from the end. More...
 
void Reserve (const SInt32 n)
 Reserve storage space. More...
 
Bool SetCount (SInt32 n)
 Set the actual number of items in the array. More...
 
Bool SetCount (SInt32 n, const DataType &item)
 Set the actual number of items in the array. More...
 
Bool SetCountAndReserve (const SInt32 n)
 Set the actual number of items in the array and reserve extra storage space. More...
 
Bool SetCountAndReserve (SInt32 n, const DataType &item)
 Set the actual number of items in the array and reserve extra storage space. More...
 
DataType & Set (const SInt32 index, const DataType &item)
 Initialize an item with a given item. More...
 
Bool Set (SInt32 index, const DataType &item, SInt32 count)
 Initialize a range of items with a given item. More...
 
void Fill (const DataType &item)
 Fill all items with a given item. More...
 
void Swap (const SInt32 index1, const SInt32 index2)
 Swap two array items. More...
 
DataType & Add ()
 Add a new item at the end of the array. More...
 
DataType & Add (const DataType &item)
 Add a given item at the end of the array. More...
 
void AddN (SInt32 count)
 Add a given number of new items at the end of the array. More...
 
Bool Add (const Array &other)
 Add a given array of items at the end of the array. More...
 
Bool Add (const Array &other, const int offset, const int count)
 Add a subset of given array of items at the end of the array. More...
 
DataType & Insert (const SInt32 index)
 Insert a new item at a given position. More...
 
DataType & Insert (const SInt32 index, const DataType &item)
 Insert a given item at a given position. More...
 
Bool Insert (SInt32 index, const DataType &item, SInt32 count)
 Insert a number of copies of a given item at a given position. More...
 
Bool InsertN (SInt32 index, SInt32 count=1)
 Insert a given number of new items at a given position. More...
 
Bool Insert (const SInt32 index, const Array &other)
 Insert a given array of items at a given position. More...
 
Bool Insert (SInt32 index, const Array &other, SInt32 offset, SInt32 count)
 Insert a subset of given array of items at a given position. More...
 
DataType RemoveGet (const SInt32 index)
 Remove (and destroy) an item at a given position and get a copy of the item. More...
 
Bool Remove (SInt32 index, SInt32 count=1)
 Remove (and destroy) a number of items at a given position. More...
 
void Remove (const SInt32 *sortedIndices, SInt32 count)
 Remove (and destroy) a number of items at given positions. More...
 
void Remove (const SInt32Array &sortedIndices)
 Remove (and destroy) a number of items at given positions. More...
 
SInt32 Find (const DataType &item) const
 Find the first occurrence of a given item in the array. More...
 
SInt32 Find (const DataType &item, const SInt32 firstIndex) const
 Find the first occurrence of a given item in the array. More...
 
SInt32 FindLast (const DataType &item) const
 Find the last occurrence of a given item in the array. More...
 
SInt32 FindLast (const DataType &item, const SInt32 lastIndex) const
 Find the last occurrence of a given item in the array. More...
 
DataType & Front ()
 Retrieve the first item from the array. More...
 
const DataType & Front () const
 Retrieve the first item from the array. More...
 
DataType & Back ()
 Retrieve the last item from the array. More...
 
const DataType & Back () const
 Retrieve the last item from the array. More...
 
DataType & Bottom ()
 Retrieve the first item from the array. More...
 
const DataType & Bottom () const
 Retrieve the first item from the array. More...
 
DataType & Top ()
 Retrieve the last item from the array. More...
 
const DataType & Top () const
 Retrieve the last item from the array. More...
 
DataType Pop ()
 Remove the last item from the array. More...
 
DataType & At (const SInt32 index)
 Retrieve the item at a given position from the array. More...
 
DataType & At (const SInt32 index, const DataType &item)
 Retrieve the item at a given position from the array. More...
 
SInt32 GetCount () const
 Get the number of items in the array. More...
 
UInt32 GetCountUInt32 () const
 Get the number of items in the array. More...
 
Bool IsEmpty () const
 Check if the array is empty. More...
 
SInt32 GetAlloc () const
 Get the number of actually allocated items. More...
 
Bool IsEqual (const Array &other) const
 Compare the array to another one. More...
 
bool operator== (const Array &rhs) const
 The "equal to" comparison operator, calls IsEqual(). More...
 
bool operator!= (const Array &rhs) const
 The "not equal to" comparison operator, calls IsEqual(). More...
 
Bool IsIndexValid (const SInt32 index) const
 Check if a given index is a valid index. More...
 
DataType & operator[] (const SInt32 index)
 Retrieve the item at a given position from the array. More...
 
DataType & operator[] (const UInt32 index)
 Retrieve the item at a given position from the array. More...
 
const DataType & operator[] (const SInt32 index) const
 Retrieve the item at a given position from the array. More...
 
const DataType & operator[] (const UInt32 index) const
 Retrieve the item at a given position from the array. More...
 
DataType & Get (const SInt32 index)
 Get the item at a given position from the array. More...
 
DataType & Get (const UInt32 index)
 Get the item at a given position from the array. More...
 
const DataType & Get (const SInt32 index) const
 Get the item at a given position from the array. More...
 
const DataType & Get (const UInt32 index) const
 Get the item at a given position from the array. More...
 
 operator DataType * ()
 Conversion operator to the underlying raw array. More...
 
 operator const DataType * () const
 Conversion operator to the underlying raw array. More...
 
UInt32 GetByteSize () const
 Get the number of bytes of the underlying raw array. More...
 
ConstIterator Begin () const
 Get the const iterator to the first item. More...
 
ConstIterator End () const
 Get the const iterator next to the last item. More...
 
ConstIterator GetIter (SInt32 index) const
 Get the const iterator of a specified index. More...
 
SInt32 GetIterIndex (ConstIterator iterator) const
 Get the item index by iterator. More...
 
void Swap (Array &other)
 Exchange the content of the array with a given second one. More...
 
Iterator Begin ()
 Get the iterator to the first item. More...
 
Iterator End ()
 Get the iterator next to the last item. More...
 
Iterator GetIter (SInt32 index)
 Get the iterator of a specified index. More...
 

Detailed Description

template<class DataType>
class Murl::Array< DataType >

A generic array template class for moveable objects eg. structs or fundamental data types like UInt32, Real, etc.

The array class works for moveable objects only, use ObjectArray class for storing non-moveable objects.
This class is based on the NTL Vector container, see http://www.ultimatepp.org

Template Parameters
DataTypeThe value's data type of the array.

Constructor & Destructor Documentation

◆ Array() [1/5]

template<class DataType >
Murl::Array< DataType >::Array ( const DataType &  item)
inline

Construct an array containing a single item.

Parameters
itemThe item.

References Murl::Array< DataType >::Add().

◆ Array() [2/5]

template<class DataType >
Murl::Array< DataType >::Array ( const DataType &  item1,
const DataType &  item2 
)
inline

Construct an array containing two items.

Parameters
item1The first item.
item2The second item.

References Murl::Array< DataType >::Add().

◆ Array() [3/5]

template<class DataType >
Murl::Array< DataType >::Array ( const DataType &  item1,
const DataType &  item2,
const DataType &  item3 
)
inline

Construct an array containing three items.

Parameters
item1The first item.
item2The second item.
item3The third item.

References Murl::Array< DataType >::Add().

◆ Array() [4/5]

template<class DataType >
Murl::Array< DataType >::Array ( const Array< DataType > &  other)
inlinenoexcept

Construct an array from an already existing one, performing a deep copy.

Parameters
otherThe array to copy.

◆ Array() [5/5]

template<class DataType >
Murl::Array< DataType >::Array ( Array< DataType > &&  other)
inlinenoexcept

Construct an array by moving an already existing one, performing no copy.

Parameters
otherThe array to move.

References Murl::Array< DataType >::Swap().

Member Function Documentation

◆ operator=() [1/2]

template<class DataType >
Array& Murl::Array< DataType >::operator= ( const Array< DataType > &  other)
inlinenoexcept

Assign the content of another array to this one, performing a deep copy.

Parameters
otherThe source array.
Returns
A reference to the destination (own) array instance.

◆ operator=() [2/2]

template<class DataType >
Array& Murl::Array< DataType >::operator= ( Array< DataType > &&  other)
inlinenoexcept

Assign the content of another array to this one, moving its pointers.

Parameters
otherThe source array.
Returns
A reference to the destination (own) array instance.

References Murl::Array< DataType >::Swap().

◆ Trim()

template<class DataType >
Bool Murl::Array< DataType >::Trim ( SInt32  n)
inline

Reduce the array to a given number of items.

Parameters
nThe new number of items in the array, must be smaller than the current item count.
Returns
true if successful.

Referenced by Murl::Array< DataType >::Drop(), and Murl::Array< DataType >::Empty().

◆ Drop()

template<class DataType >
Bool Murl::Array< DataType >::Drop ( const SInt32  n = 1)
inline

Reduce the array by removing a given number of items from the end.

Parameters
nThe number of items to remove from the end.
Returns
true if successful.

References Murl::Array< DataType >::Trim().

Referenced by Murl::Pool< DataType >::Acquire(), and Murl::Array< DataType >::Pop().

◆ Reserve()

template<class DataType >
void Murl::Array< DataType >::Reserve ( const SInt32  n)
inline

Reserve storage space.

If the given size is less than the actual size, nothing is done.

Parameters
nThe number of items the underlying storage should hold.

Referenced by Murl::Hash::Reserve(), and Murl::ObjectArray< DataType >::Reserve().

◆ SetCount() [1/2]

template<class DataType >
Bool Murl::Array< DataType >::SetCount ( SInt32  n)
inline

◆ SetCount() [2/2]

template<class DataType >
Bool Murl::Array< DataType >::SetCount ( SInt32  n,
const DataType &  item 
)
inline

Set the actual number of items in the array.

If the given number is smaller than the current size, the array is trimmed, and existing items beyond the new size are destroyed. If the given number is higher, new items are initialized via the given value's copy constructor. If the given number is also higher than the underlying storage's capacity, the storage is enlarged to hold exactly the requested number of items.

Parameters
nThe new number of items in the array.
itemThe value to initialize any newly added items with.
Returns
true if successful.

◆ SetCountAndReserve() [1/2]

template<class DataType >
Bool Murl::Array< DataType >::SetCountAndReserve ( const SInt32  n)
inline

Set the actual number of items in the array and reserve extra storage space.

If the given number is smaller than the current size, the array is trimmed, and existing items beyond the new size are destroyed. If the given number is higher, new items are initialized via the value type's default constructor. If the given number is also higher than the underlying storage's capacity, the storage is enlarged and some extra capacity is added.

Parameters
nThe new number of items in the array.
Returns
true if successful.

References Murl::Math::Max(), and Murl::Array< DataType >::SetCount().

Referenced by Murl::Array< DataType >::AddN(), and Murl::Array< DataType >::At().

◆ SetCountAndReserve() [2/2]

template<class DataType >
Bool Murl::Array< DataType >::SetCountAndReserve ( SInt32  n,
const DataType &  item 
)
inline

Set the actual number of items in the array and reserve extra storage space.

If the given number is smaller than the current size, the array is trimmed, and existing items beyond the new size are destroyed. If the given number is higher, new items are initialized via the given value's copy constructor. If the given number is also higher than the underlying storage's capacity, the storage is enlarged and some extra capacity is added.

Parameters
nThe new number of items in the array.
itemThe value to initialize any newly added items with.
Returns
true if successful.

◆ Set() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::Set ( const SInt32  index,
const DataType &  item 
)
inline

Initialize an item with a given item.

If the given index is greater than the actual array size, the array is enlarged as needed.

Parameters
indexThe index of the item to set.
itemThe source item to copy.
Returns
A reference to the set item.

Referenced by Murl::Array< DataType >::Fill().

◆ Set() [2/2]

template<class DataType >
Bool Murl::Array< DataType >::Set ( SInt32  index,
const DataType &  item,
SInt32  count 
)
inline

Initialize a range of items with a given item.

If the given index plus the count is greater than the actual array size, the array is enlarged as needed.

Parameters
indexThe index of the first item to set.
itemThe source item to copy.
countThe number of items to set.
Returns
true if successful.

◆ Fill()

template<class DataType >
void Murl::Array< DataType >::Fill ( const DataType &  item)
inline

Fill all items with a given item.

Parameters
itemThe source item to copy.

References Murl::Array< DataType >::Set().

◆ Swap() [1/2]

template<class DataType >
void Murl::Array< DataType >::Swap ( const SInt32  index1,
const SInt32  index2 
)
inline

Swap two array items.

Parameters
index1The index of the first item.
index2The index of the second item.

References Murl::Util::Swap().

Referenced by Murl::Array< DataType >::Array(), Murl::Array< DataType >::operator=(), Murl::Hash::Swap(), and Murl::ObjectArray< DataType >::Swap().

◆ Add() [1/4]

◆ Add() [2/4]

template<class DataType >
DataType& Murl::Array< DataType >::Add ( const DataType &  item)
inline

Add a given item at the end of the array.

The new item entry is initialized using the given item's copy constructor.

Parameters
itemThe given item to be inserted at the end of the array.
Returns
A reference to the newly created item.

References Murl::Util::DeepCopy::PlacementNew().

◆ AddN()

template<class DataType >
void Murl::Array< DataType >::AddN ( SInt32  count)
inline

Add a given number of new items at the end of the array.

The new item entries are initialized using the value type's default constructor.

Parameters
countThe number of new items to be inserted at the end of the array.

References Murl::Util::DeepCopy::PlacementNewArray(), and Murl::Array< DataType >::SetCountAndReserve().

◆ Add() [3/4]

template<class DataType >
Bool Murl::Array< DataType >::Add ( const Array< DataType > &  other)
inline

Add a given array of items at the end of the array.

The new item entries are initialized using the original items' copy constructors.

Parameters
otherThe given item array to be inserted.
Returns
true if successful.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::Insert().

◆ Add() [4/4]

template<class DataType >
Bool Murl::Array< DataType >::Add ( const Array< DataType > &  other,
const int  offset,
const int  count 
)
inline

Add a subset of given array of items at the end of the array.

The new item entries are initialized using the original items' copy constructors.

Parameters
otherThe given source item array.
offsetThe index into the source array specifying the first item to copy.
countThe number of source array items to copy.
Returns
true if successful.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::Insert().

◆ Insert() [1/5]

template<class DataType >
DataType& Murl::Array< DataType >::Insert ( const SInt32  index)
inline

Insert a new item at a given position.

The new item entry is initialized using the value type's default constructor.

Parameters
indexthe zero-based index where the new item should be inserted.
Returns
A reference to the newly created item.

References Murl::Array< DataType >::InsertN().

Referenced by Murl::Array< DataType >::Add(), Murl::Array< DataType >::Insert(), Murl::Hash::Insert(), and Murl::ObjectArray< DataType >::Move().

◆ Insert() [2/5]

template<class DataType >
DataType& Murl::Array< DataType >::Insert ( const SInt32  index,
const DataType &  item 
)
inline

Insert a given item at a given position.

The new item is initialized using the given item's copy constructor.

Parameters
indexthe zero-based index where the new item should be inserted.
itemThe given item to be inserted.
Returns
A reference to the newly created item.

References Murl::Array< DataType >::Insert().

◆ Insert() [3/5]

template<class DataType >
Bool Murl::Array< DataType >::Insert ( SInt32  index,
const DataType &  item,
SInt32  count 
)
inline

Insert a number of copies of a given item at a given position.

The new item entries are initialized using the given item's copy constructor.

Parameters
indexthe zero-based index where the new items should be inserted.
itemThe given item to be inserted.
countThe number of copies of the given item to insert.
Returns
true if successful.

◆ InsertN()

template<class DataType >
Bool Murl::Array< DataType >::InsertN ( SInt32  index,
SInt32  count = 1 
)
inline

Insert a given number of new items at a given position.

The new item entries are initialized using the value type's default constructor.

Parameters
indexthe zero-based index where the new items should be inserted.
countThe number of new items to be inserted.
Returns
true if successful.

Referenced by Murl::Array< DataType >::Insert(), Murl::ObjectArray< DataType >::Insert(), and Murl::ObjectArray< DataType >::InsertN().

◆ Insert() [4/5]

template<class DataType >
Bool Murl::Array< DataType >::Insert ( const SInt32  index,
const Array< DataType > &  other 
)
inline

Insert a given array of items at a given position.

The new item entries are initialized using the original items' copy constructors.

Parameters
indexthe zero-based index where the new items should be inserted.
otherThe given item array to be inserted.
Returns
true if successful.

References Murl::Array< DataType >::GetCount(), Murl::Array< DataType >::Insert(), and Murl::Array< DataType >::IsEmpty().

◆ Insert() [5/5]

template<class DataType >
Bool Murl::Array< DataType >::Insert ( SInt32  index,
const Array< DataType > &  other,
SInt32  offset,
SInt32  count 
)
inline

Insert a subset of given array of items at a given position.

The new item entries are initialized using the original items' copy constructors.

Parameters
indexthe zero-based index where the new items should be inserted.
otherThe given source item array.
offsetThe index into the source array specifying the first item to copy.
countThe number of source array items to copy.
Returns
true if successful.

◆ RemoveGet()

template<class DataType >
DataType Murl::Array< DataType >::RemoveGet ( const SInt32  index)
inline

Remove (and destroy) an item at a given position and get a copy of the item.

Parameters
indexThe zero-based index from where to remove the item.
Returns
A copy of the removed item.

References Murl::Array< DataType >::Remove().

◆ Remove() [1/3]

template<class DataType >
Bool Murl::Array< DataType >::Remove ( SInt32  index,
SInt32  count = 1 
)
inline

Remove (and destroy) a number of items at a given position.

Parameters
indexThe zero-based index from where to remove the items.
countThe number of items to remove.
Returns
true if successful.

Referenced by Murl::ObjectArray< DataType >::Detach(), Murl::ObjectArray< DataType >::Move(), Murl::Array< DataType >::Remove(), Murl::Hash::Remove(), and Murl::Array< DataType >::RemoveGet().

◆ Remove() [2/3]

template<class DataType >
void Murl::Array< DataType >::Remove ( const SInt32 sortedIndices,
SInt32  count 
)
inline

Remove (and destroy) a number of items at given positions.

Parameters
sortedIndicesA pointer to sorted indices where to remove the items.
countThe number of items to remove, i.e. the number of indices.

◆ Remove() [3/3]

template<class DataType >
void Murl::Array< DataType >::Remove ( const SInt32Array< DataType > &  sortedIndices)
inline

Remove (and destroy) a number of items at given positions.

Parameters
sortedIndicesA sorted array of indices where to remove the items.

References Murl::Array< DataType >::GetCount(), and Murl::Array< DataType >::Remove().

◆ Find() [1/2]

template<class DataType >
SInt32 Murl::Array< DataType >::Find ( const DataType &  item) const
inline

Find the first occurrence of a given item in the array.

Parameters
itemThe item to find.
Returns
The index of the item, or -1 if the item was not found.

◆ Find() [2/2]

template<class DataType >
SInt32 Murl::Array< DataType >::Find ( const DataType &  item,
const SInt32  firstIndex 
) const
inline

Find the first occurrence of a given item in the array.

Parameters
itemThe item to find.
firstIndexThe index where to start searching.
Returns
The index of the item, or -1 if the item was not found.

◆ FindLast() [1/2]

template<class DataType >
SInt32 Murl::Array< DataType >::FindLast ( const DataType &  item) const
inline

Find the last occurrence of a given item in the array.

Parameters
itemThe item to find.
Returns
The index of the item, or -1 if the item was not found.

◆ FindLast() [2/2]

template<class DataType >
SInt32 Murl::Array< DataType >::FindLast ( const DataType &  item,
const SInt32  lastIndex 
) const
inline

Find the last occurrence of a given item in the array.

Parameters
itemThe item to find.
lastIndexThe index where to start searching.
Returns
The index of the item, or -1 if the item was not found.

◆ Front() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::Front ( )
inline

Retrieve the first item from the array.

Synonymous to Bottom().

Returns
A reference to the first item.

References Murl::Array< DataType >::Bottom().

◆ Front() [2/2]

template<class DataType >
const DataType& Murl::Array< DataType >::Front ( ) const
inline

Retrieve the first item from the array.

Synonymous to Bottom().

Returns
A const reference to the first item.

References Murl::Array< DataType >::Bottom().

◆ Back() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::Back ( )
inline

Retrieve the last item from the array.

Synonymous to Top().

Returns
A reference to the last item.

References Murl::Array< DataType >::Top().

◆ Back() [2/2]

template<class DataType >
const DataType& Murl::Array< DataType >::Back ( ) const
inline

Retrieve the last item from the array.

Synonymous to Top().

Returns
A const reference to the last item.

References Murl::Array< DataType >::Top().

◆ Bottom() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::Bottom ( )
inline

Retrieve the first item from the array.

Returns
A reference to the first item.

Referenced by Murl::Array< DataType >::Front().

◆ Bottom() [2/2]

template<class DataType >
const DataType& Murl::Array< DataType >::Bottom ( ) const
inline

Retrieve the first item from the array.

Returns
A const reference to the first item.

◆ Top() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::Top ( )
inline

Retrieve the last item from the array.

Returns
A reference to the last item.

Referenced by Murl::Pool< DataType >::Acquire(), Murl::Array< DataType >::Back(), and Murl::Array< DataType >::Pop().

◆ Top() [2/2]

template<class DataType >
const DataType& Murl::Array< DataType >::Top ( ) const
inline

Retrieve the last item from the array.

Returns
A const reference to the last item.

◆ Pop()

template<class DataType >
DataType Murl::Array< DataType >::Pop ( )
inline

Remove the last item from the array.

Returns
A copy of the removed item.

References Murl::Array< DataType >::Drop(), and Murl::Array< DataType >::Top().

Referenced by Murl::ObjectArray< DataType >::PopDetach().

◆ At() [1/2]

template<class DataType >
DataType& Murl::Array< DataType >::At ( const SInt32  index)
inline

Retrieve the item at a given position from the array.

If the given index is greater than the actual array size, the array is enlarged as needed, using the value type's default constructor for initializing.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A reference to the specified item.

References Murl::Array< DataType >::SetCountAndReserve().

◆ At() [2/2]

template<class DataType >
DataType& Murl::Array< DataType >::At ( const SInt32  index,
const DataType &  item 
)
inline

Retrieve the item at a given position from the array.

If the given index is greater than the actual array size, the array is enlarged as needed, using the given reference item's copy constructor for initializing.

Parameters
indexThe zero-based index of the item to retrieve.
itemThe reference item used for initialization.
Returns
A reference to the specified item.

References Murl::Array< DataType >::SetCountAndReserve().

◆ GetCount()

template<class DataType >
SInt32 Murl::Array< DataType >::GetCount ( ) const
inline

Get the number of items in the array.

Returns
The number of items.

Referenced by Murl::Pool< DataType >::Acquire(), Murl::Array< DataType >::Add(), Murl::String::Cat(), Murl::Bitfield::Clear(), Murl::Data::Data(), Murl::Graph::NodeArrayTarget< ObjectType, MIN_NUMBER_OF_NODES, MAX_NUMBER_OF_NODES, RESERVED_NUMBER_OF_NODES >::DeserializeNodeId(), Murl::Graph::NodeArrayTarget< ObjectType, MIN_NUMBER_OF_NODES, MAX_NUMBER_OF_NODES, RESERVED_NUMBER_OF_NODES >::DeserializeNodeIds(), Murl::Graph::ResourceArrayTarget< ObjectType, MIN_NUMBER_OF_RESOURCES, MAX_NUMBER_OF_RESOURCES, RESERVED_NUMBER_OF_RESOURCES >::DeserializeResourceId(), Murl::Graph::ResourceArrayTarget< ObjectType, MIN_NUMBER_OF_RESOURCES, MAX_NUMBER_OF_RESOURCES, RESERVED_NUMBER_OF_RESOURCES >::DeserializeResourceIds(), Murl::Hash::Drop(), Murl::Hash::Find(), Murl::Hash::FindLast(), Murl::Bitfield::GetBitsCount(), Murl::Bitfield::GetByteSize(), Murl::Hash::GetCount(), Murl::ObjectArray< DataType >::GetCount(), Murl::IAttributes::GetEnumBitsToSetByIndex(), Murl::IAttributes::GetEnumValuesByIndex(), Murl::Array< DataType >::Insert(), Murl::Bitfield::IsCleared(), Murl::Bitfield::IsSet(), Murl::Hash::Reindex(), Murl::Array< DataType >::Remove(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::Remove(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::Remove(), Murl::ObjectArray< DataType >::Remove(), Murl::MapBase< KeyType, DataType, ArrayType, HashFunc >::RemoveKey(), Murl::IndexBase< KeyType, ArrayType, HashFunc >::RemoveKey(), Murl::Bitfield::Set(), Murl::Bitfield::SetBitsCount(), Murl::Hash::Shrink(), Murl::Util::SortArray(), and Murl::Pool< DataType >::~Pool().

◆ GetCountUInt32()

template<class DataType >
UInt32 Murl::Array< DataType >::GetCountUInt32 ( ) const
inline

Get the number of items in the array.

Returns
The number of items.

Referenced by Murl::ObjectArray< DataType >::GetCountUInt32(), and Murl::Graph::LazyNode::StartTask().

◆ IsEmpty()

template<class DataType >
Bool Murl::Array< DataType >::IsEmpty ( ) const
inline

Check if the array is empty.

Returns
true if the array is empty, false otherwise.

Referenced by Murl::Array< DataType >::Insert(), and Murl::ObjectArray< DataType >::IsEmpty().

◆ GetAlloc()

template<class DataType >
SInt32 Murl::Array< DataType >::GetAlloc ( ) const
inline

Get the number of actually allocated items.

Returns
The number of allocated items.

Referenced by Murl::ObjectArray< DataType >::GetAlloc().

◆ IsEqual()

template<class DataType >
Bool Murl::Array< DataType >::IsEqual ( const Array< DataType > &  other) const
inline

Compare the array to another one.

Parameters
otherThe array to compare.
Returns
true if both arrays have identical contents.

Referenced by Murl::Array< DataType >::operator!=(), and Murl::Array< DataType >::operator==().

◆ operator==()

template<class DataType >
bool Murl::Array< DataType >::operator== ( const Array< DataType > &  rhs) const
inline

The "equal to" comparison operator, calls IsEqual().

Parameters
rhsThe right hand side array to compare.
Returns
true if both arrays have identical contents.

References Murl::Array< DataType >::IsEqual().

◆ operator!=()

template<class DataType >
bool Murl::Array< DataType >::operator!= ( const Array< DataType > &  rhs) const
inline

The "not equal to" comparison operator, calls IsEqual().

Parameters
rhsThe right hand side array to compare.
Returns
true if both arrays do not have identical contents.

References Murl::Array< DataType >::IsEqual().

◆ IsIndexValid()

template<class DataType >
Bool Murl::Array< DataType >::IsIndexValid ( const SInt32  index) const
inline

Check if a given index is a valid index.

Parameters
indexThe index to check.
Returns
true if index >= 0 and index < GetCount().

Referenced by Murl::Math::SplineBezier< DataType >::CalculateControlPoint(), Murl::Math::SplineHermite< DataType >::CalculateControlPoint(), and Murl::ObjectArray< DataType >::IsIndexValid().

◆ operator[]() [1/4]

template<class DataType >
DataType& Murl::Array< DataType >::operator[] ( const SInt32  index)
inline

Retrieve the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A reference to the specified item.

◆ operator[]() [2/4]

template<class DataType >
DataType& Murl::Array< DataType >::operator[] ( const UInt32  index)
inline

Retrieve the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A reference to the specified item.

◆ operator[]() [3/4]

template<class DataType >
const DataType& Murl::Array< DataType >::operator[] ( const SInt32  index) const
inline

Retrieve the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A const reference to the specified item.

◆ operator[]() [4/4]

template<class DataType >
const DataType& Murl::Array< DataType >::operator[] ( const UInt32  index) const
inline

Retrieve the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A const reference to the specified item.

◆ Get() [1/4]

template<class DataType >
DataType& Murl::Array< DataType >::Get ( const SInt32  index)
inline

Get the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A reference to the specified item.

◆ Get() [2/4]

template<class DataType >
DataType& Murl::Array< DataType >::Get ( const UInt32  index)
inline

Get the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A reference to the specified item.

◆ Get() [3/4]

template<class DataType >
const DataType& Murl::Array< DataType >::Get ( const SInt32  index) const
inline

Get the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A const reference to the specified item.

◆ Get() [4/4]

template<class DataType >
const DataType& Murl::Array< DataType >::Get ( const UInt32  index) const
inline

Get the item at a given position from the array.

Parameters
indexThe zero-based index of the item to retrieve.
Returns
A const reference to the specified item.

◆ operator DataType *()

template<class DataType >
Murl::Array< DataType >::operator DataType * ( )
inline

Conversion operator to the underlying raw array.

Returns
A pointer to the raw array.

◆ operator const DataType *()

template<class DataType >
Murl::Array< DataType >::operator const DataType * ( ) const
inline

Conversion operator to the underlying raw array.

Returns
A pointer to the constant raw array.

◆ GetByteSize()

template<class DataType >
UInt32 Murl::Array< DataType >::GetByteSize ( ) const
inline

Get the number of bytes of the underlying raw array.

Returns
The number of bytes of the underlying raw array.

Referenced by Murl::Data::Data(), Murl::Data::operator+=(), and Murl::Data::operator=().

◆ Begin() [1/2]

template<class DataType >
ConstIterator Murl::Array< DataType >::Begin ( ) const
inline

◆ End() [1/2]

template<class DataType >
ConstIterator Murl::Array< DataType >::End ( ) const
inline

Get the const iterator next to the last item.

Returns
The const iterator next to the last item.

Referenced by Murl::Bitfield::End(), Murl::ObjectArray< DataType >::End(), and Murl::Array< DataType >::GetIterIndex().

◆ GetIter() [1/2]

template<class DataType >
ConstIterator Murl::Array< DataType >::GetIter ( SInt32  index) const
inline

Get the const iterator of a specified index.

Parameters
indexThe index for the iterator.
Returns
The const iterator or null if the index is out of range.

Referenced by Murl::ObjectArray< DataType >::GetIter().

◆ GetIterIndex()

template<class DataType >
SInt32 Murl::Array< DataType >::GetIterIndex ( ConstIterator  iterator) const
inline

Get the item index by iterator.

(!) Adding or removing items will invalidate iterators.

Parameters
iteratorThe iterator of the item.
Returns
The index of the item, or -1 if the iterator is invalid.

References Murl::Array< DataType >::Begin(), and Murl::Array< DataType >::End().

Referenced by Murl::ObjectArray< DataType >::GetIterIndex().

◆ Swap() [2/2]

template<class DataType >
void Murl::Array< DataType >::Swap ( Array< DataType > &  other)
inline

Exchange the content of the array with a given second one.

Parameters
otherThe second array.

References Murl::Util::Swap().

◆ Begin() [2/2]

template<class DataType >
Iterator Murl::Array< DataType >::Begin ( )
inline

Get the iterator to the first item.

Returns
The iterator to the first item.

◆ End() [2/2]

template<class DataType >
Iterator Murl::Array< DataType >::End ( )
inline

Get the iterator next to the last item.

Returns
The iterator next to the last item.

◆ GetIter() [2/2]

template<class DataType >
Iterator Murl::Array< DataType >::GetIter ( SInt32  index)
inline

Get the iterator of a specified index.

Parameters
indexThe index for the iterator.
Returns
The iterator or null if the index is out of range.

The documentation for this class was generated from the following file:
  • murl_array.h


Copyright © 2011-2024 Spraylight GmbH.