Karma Engine
Loading...
Searching...
No Matches
KarmaVector< BuildingBlock > Class Template Reference

Karma's std::vector wrapper. More...

#include <KarmaTypes.h>

Public Member Functions

uint32_t Remove (BuildingBlock aBlock)
 
void Add (BuildingBlock aBlock)
 
FORCEINLINE int32_t AddUnique (const BuildingBlock &Item)
 
int32_t Find (const BuildingBlock &Item) const
 
bool Contains (BuildingBlock aBlock) const
 
uint32_t Num () const
 
void Reset ()
 
void SmartReset ()
 
void SetVectorElementByIndex (int32_t Index, BuildingBlock Value)
 
const std::vector< BuildingBlock > & GetElements () const
 
std::vector< BuildingBlock > & ModifyElements ()
 
std::vector< BuildingBlock >::iterator begin ()
 
std::vector< BuildingBlock >::iterator end ()
 
FORCEINLINE BuildingBlock & IndexToObject (int32_t Index)
 
FORCEINLINE bool IsValidIndex (int32_t Index) const
 

Protected Attributes

std::vector< BuildingBlock > m_Elements
 

Detailed Description

template<typename BuildingBlock>
class KarmaVector< BuildingBlock >

Karma's std::vector wrapper.

Member Function Documentation

◆ AddUnique()

template<typename BuildingBlock >
FORCEINLINE int32_t KarmaVector< BuildingBlock >::AddUnique ( const BuildingBlock & Item)
inline

Adds unique element to array if it doesn't exist.

Move semantics version.

Parameters
ItemItem to add.
Returns
Index of the element in the array.
See also
Add, AddDefaulted, AddZeroed, Append, Insert

◆ Find()

template<typename BuildingBlock >
int32_t KarmaVector< BuildingBlock >::Find ( const BuildingBlock & Item) const
inline

Finds element within the array.

Parameters
ItemItem to look for.
Returns
Index of the found element. INDEX_NONE otherwise.
See also
FindLast, FindLastByPredicate
https://www.techiedelight.com/find-index-element-vector-cpp/

◆ IndexToObject()

template<typename BuildingBlock >
FORCEINLINE BuildingBlock & KarmaVector< BuildingBlock >::IndexToObject ( int32_t Index)
inline

Returns the UObject corresponding to index. Be advised this is only for very low level use.

Parameters
Indexindex of object to return
Returns
Object at this index

◆ IsValidIndex()

template<typename BuildingBlock >
FORCEINLINE bool KarmaVector< BuildingBlock >::IsValidIndex ( int32_t Index) const
inline

Tests if index is valid, i.e. greater than or equal to zero, and less than the number of elements in the array.

Parameters
IndexIndex to test.
Returns
True if index is valid. False otherwise.

◆ Reset()

template<typename BuildingBlock >
void KarmaVector< BuildingBlock >::Reset ( )
inline

We just reset the vector. UE has the following implementation

Same as empty, but doesn't change memory allocations, unless the new size is larger than the current array. It calls the destructors on held items if needed and then zeros the ArrayNum.

Parameters
NewSizeThe expected usage size after calling this function.

◆ SmartReset()

template<typename BuildingBlock >
void KarmaVector< BuildingBlock >::SmartReset ( )
inline

Assuming the use of smart pointers


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