This is the documentation for Enlighten.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

template<typename T>
class Geo::GeoAutoReleaseArray

    └>Geo::GeoArray< T * >

Adaptor to allow storing of IGeoReleasable pointers in a container (calls Release() on each pointer upon array destruction)

Functions

Name Description
~GeoArray()

Destructor calls destructor on all elements in the array and frees the memory.

Back()

Non constant access to final entry.

Back()

Constant access to final entry.

Begin()

Return iterator similar to vector::begin()

Begin()

Return iterator similar to vector::begin()

Clear()

Remove all elements from the array.

Clear()

Remove all elements from the array.

Contains(const T &)

Returns true if the array contains x.

Emplace(s32, U &&)

Insert an element at the specified index, elements already in the array at that index and above are shuffled up.

EmplaceBack(U &&)

Add the specified element to the end of the array.

EmplaceBackFast(U &&)

Fast version of push that doesn't do any checking in release.

EmplaceFast(s32, U &&)

Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.

End()

Return iterator similar to vector::end()

End()

Return iterator similar to vector::end()

Front()

Constant access to final entry.

Front()

Non constant access to final entry.

GeoArray(GeoArray &&)

Move constructor.

GeoArray(const GeoArray &)

Construct a copy of the specified array.

GeoArray(s32)

Construct an empty array with the default capacity.

GeoArray(s32, const T &)

Construct with the specified value replicated numCopies times.

GeoArray(const GeoArray< CompatT > &)

Construct a copy of the specified array - The compiler must be able to resolve T = CompatT.

GeoArray(const CompatT *, s32)

Construct a copy of the specified array - The compiler must be able to resolve T = CompatT.

GeoAutoReleaseArray(s32)

Construct an empty array with the default capacity.

GetArray()

Remove all elements from the array.

GetArray()

Give access to the internal array.

GetArrayConst()

Remove all elements from the array.

GetCapacity()

Returns the number of array entries available at the moment.

GetMemoryUsage()

Memory used for array storage.

GetSize()

Return the number of array entries currently in use.

Init(s32)

Common initialisation code called by all constructors.

Insert(s32, T &&)

Insert an element at the specified index, elements already in the array at that index and above are shuffled up.

Insert(s32, const T &)

Insert an element at the specified index, elements already in the array at that index and above are shuffled up.

InsertFast(s32, const T &)

Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.

InsertFast(s32, T &&)

Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.

IsEmpty()

Returns true if the array is empty.

IsFull()

Returns true if the array is full.

operator[](s32)

Non constant array access.

operator[](s32)

Constant array access.

operator=(GeoArray &&)

Move assignment operator.

operator=(const GeoArray< CompatT > &)

Assignment operator - The compiler must be able to resolve T = CompatT.

operator=(const GeoArray &)

Assignment operator.

Pop()

Remove the element with the highest index (if there is one)

PopFast()

Fast version of pop that doesn't do any checking in release.

Push(const T &)

Add the specified element to the end of the array.

Push(T &&)

Add the specified element to the end of the array.

PushFast(T &&)

Fast version of push that doesn't do any checking in release.

PushFast(const T &)

Fast version of push that doesn't do any checking in release.

Remove(s32)

Remove the element at the specified index, elements at higher indices are shuffled down.

RemoveFast(s32)

Moves the end of the array into the element to be removed, thus not preserving order or existing indices.

Resize(s32, const T &)

Resize the array.

SetCapacity(s32)

Change the array's capacity, reallocating memory if the new capacity is different to the current capacity.

Swap(GeoArray &)

Swap the contents of two arrays.

Typedefs

Name Description
const T * const_iterator

The simplest possible const_iterator type (a raw pointer).

T * iterator

The simplest possible iterator type (a raw pointer).

T ValueType

Alias for our storage type.

Variables

Name Description
ValueType * m_Data

Pointer to start of array memory.

ValueType * m_DataEnd

Pointer to 1 after end of array memory.

ValueType * m_End

Pointer to next free slot.


Geo::GeoArray< T >::~GeoArray


public: ~GeoArray()


Destructor calls destructor on all elements in the array and frees the memory.


ValueType& Geo::GeoArray< T >::Back


public: ValueType & Back()


Non constant access to final entry.


const ValueType& Geo::GeoArray< T >::Back


public: const ValueType & Back() const


Constant access to final entry.


ValueType* Geo::GeoArray< T >::Begin


public: ValueType * Begin()


Return iterator similar to vector::begin()


const ValueType* Geo::GeoArray< T >::Begin


public: const ValueType * Begin() const


Return iterator similar to vector::begin()


void Geo::GeoArray< T >::Clear


public: void Clear()


Remove all elements from the array.

The capacity of the array remains unchanged, which means that no memory is deallocated.


void Geo::GeoAutoReleaseArray< T >::Clear


public: void Clear()


Remove all elements from the array.


bool Geo::GeoArray< T >::Contains


public: bool Contains
(
    const T & x
) const


Returns true if the array contains x.


void Geo::GeoArray< T >::Emplace


public: void Emplace
(
    s32 index,
    U && elem
)


Insert an element at the specified index, elements already in the array at that index and above are shuffled up.


bool Geo::GeoArray< T >::EmplaceBack


public: bool EmplaceBack
(
    U && elem
)


Add the specified element to the end of the array.


void Geo::GeoArray< T >::EmplaceBackFast


protected: void EmplaceBackFast
(
    U && elem
)


Fast version of push that doesn't do any checking in release.


void Geo::GeoArray< T >::EmplaceFast


public: void EmplaceFast
(
    s32 index,
    U && elem
)


Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.


const ValueType* Geo::GeoArray< T >::End


public: const ValueType * End() const


Return iterator similar to vector::end()


ValueType* Geo::GeoArray< T >::End


public: ValueType * End()


Return iterator similar to vector::end()


const ValueType& Geo::GeoArray< T >::Front


public: const ValueType & Front() const


Constant access to final entry.


ValueType& Geo::GeoArray< T >::Front


public: ValueType & Front()


Non constant access to final entry.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    GeoArray && srcArray
)


Move constructor.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    const GeoArray & srcArray
)


Construct a copy of the specified array.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    s32 initCapacity
)


Construct an empty array with the default capacity.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    s32 numCopies,
    const T & value
)


Construct with the specified value replicated numCopies times.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    const GeoArray< CompatT > & srcArray
)


Construct a copy of the specified array - The compiler must be able to resolve T = CompatT.


Geo::GeoArray< T >::GeoArray


public: GeoArray
(
    const CompatT * srcArray,
    s32 length
)


Construct a copy of the specified array - The compiler must be able to resolve T = CompatT.


Geo::GeoAutoReleaseArray< T >::GeoAutoReleaseArray


public: GeoAutoReleaseArray
(
    s32 initCapacity
)


Construct an empty array with the default capacity.


const ValueType* Geo::GeoArray< T >::GetArray


public: const ValueType * GetArray() const


Remove all elements from the array.

The capacity of the array remains unchanged, which means that no memory is deallocated.


ValueType* Geo::GeoArray< T >::GetArray


public: ValueType * GetArray()


Give access to the internal array.


const ValueType* Geo::GeoArray< T >::GetArrayConst


public: const ValueType * GetArrayConst() const


Remove all elements from the array.

The capacity of the array remains unchanged, which means that no memory is deallocated.


s32 Geo::GeoArray< T >::GetCapacity


public: s32 GetCapacity() const


Returns the number of array entries available at the moment.


s32 Geo::GeoArray< T >::GetMemoryUsage


public: s32 GetMemoryUsage() const


Memory used for array storage.


s32 Geo::GeoArray< T >::GetSize


public: s32 GetSize() const


Return the number of array entries currently in use.


bool Geo::GeoArray< T >::Init


protected: bool Init
(
    s32 initCapacity
)


Common initialisation code called by all constructors.


void Geo::GeoArray< T >::Insert


public: void Insert
(
    s32 index,
    T && elem
)


Insert an element at the specified index, elements already in the array at that index and above are shuffled up.


void Geo::GeoArray< T >::Insert


public: void Insert
(
    s32 index,
    const T & elem
)


Insert an element at the specified index, elements already in the array at that index and above are shuffled up.


void Geo::GeoArray< T >::InsertFast


public: void InsertFast
(
    s32 index,
    const T & elem
)


Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.


void Geo::GeoArray< T >::InsertFast


public: void InsertFast
(
    s32 index,
    T && elem
)


Inserts elem at index, and moves whatever is currently at the index to the end of the array, thus not preserving order or existing indices.


bool Geo::GeoArray< T >::IsEmpty


public: bool IsEmpty() const


Returns true if the array is empty.


bool Geo::GeoArray< T >::IsFull


public: bool IsFull() const


Returns true if the array is full.


ValueType& Geo::GeoArray< T >::operator[]


public: ValueType & operator[]
(
    s32 i
)


Non constant array access.


const ValueType& Geo::GeoArray< T >::operator[]


public: const ValueType & operator[]
(
    s32 i
) const


Constant array access.


GeoArray& Geo::GeoArray< T >::operator=


public: GeoArray & operator=
(
    GeoArray && srcArray
)


Move assignment operator.


GeoArray& Geo::GeoArray< T >::operator=


public: GeoArray & operator=
(
    const GeoArray< CompatT > & srcArray
)


Assignment operator - The compiler must be able to resolve T = CompatT.


GeoArray& Geo::GeoArray< T >::operator=


public: GeoArray & operator=
(
    const GeoArray & srcArray
)


Assignment operator.


bool Geo::GeoArray< T >::Pop


public: bool Pop()


Remove the element with the highest index (if there is one)


void Geo::GeoArray< T >::PopFast


protected: void PopFast()


Fast version of pop that doesn't do any checking in release.


bool Geo::GeoArray< T >::Push


public: bool Push
(
    const T & elem
)


Add the specified element to the end of the array.


bool Geo::GeoArray< T >::Push


public: bool Push
(
    T && elem
)


Add the specified element to the end of the array.


void Geo::GeoArray< T >::PushFast


protected: void PushFast
(
    T && elem
)


Fast version of push that doesn't do any checking in release.


void Geo::GeoArray< T >::PushFast


protected: void PushFast
(
    const T & elem
)


Fast version of push that doesn't do any checking in release.


void Geo::GeoArray< T >::Remove


public: void Remove
(
    s32 index
)


Remove the element at the specified index, elements at higher indices are shuffled down.


void Geo::GeoArray< T >::RemoveFast


public: void RemoveFast
(
    s32 index
)


Moves the end of the array into the element to be removed, thus not preserving order or existing indices.


bool Geo::GeoArray< T >::Resize


public: bool Resize
(
    s32 newSize,
    const T & elem
)


Resize the array.

If the new size is larger than the current size than new elements of value 'elem' are added. If the new size is smaller than the current size then the elements closest to the end of the array are deleted until the current size is equal to the new size. The memory for the array gets reallocated if the new size is larger than the current capacity. In the reallocation it is tried to grow the capacity by 50 %, or if the new size is larger than that then the new capacity is set to the new size.

Parameters
[in] newSize

The new size of the array.

[in] elem

Value for elements that get added if newSize is larger than the current size.

Return Value
false

If newSize is smaller than zero, or if additional memory could not be allocated.


bool Geo::GeoArray< T >::SetCapacity


public: bool SetCapacity
(
    s32 newCapacity
)


Change the array's capacity, reallocating memory if the new capacity is different to the current capacity.

Parameters
[in] newCapacity

The new capacity of the array. May not be less than the current size.

Return Value
false

If newCapacity is smaller than the current size, or if newCapacity is larger than MAX_CAPACITY, or if additional memory could not be allocated.


void Geo::GeoArray< T >::Swap


public: void Swap
(
    GeoArray & other
)


Swap the contents of two arrays.

This function does not re-allocate any memory. If A = {0, 1, 2} and B = {3, 4} then A.Swap(B) results in A = {3, 4} and B = {0, 1, 2}.

Parameters
[in] other

Other array that the contents of this array will be swapped with.

  • No labels