KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
Karma::FUObjectArray Class Reference

A class for managing the collection of UObjects (all or some?) More...

#include <UObjectGlobals.h>

Inheritance diagram for Karma::FUObjectArray:
Collaboration diagram for Karma::FUObjectArray:

Classes

class  TIterator
 Low level iterator. More...
 

Public Member Functions

void AddUObject (UObject *Object)
 
const std::vector< FUObjectItem * > & GetObjectsList () const
 
bool IsValid (const UObjectBase *Object) const
 Checks if a UObject pointer is valid.
 
- Public Member Functions inherited from KarmaVector< FUObjectItem * >
 KarmaVector ()
 Constructor.
 
 ~KarmaVector ()
 Destructor.
 
uint32_t Remove (FUObjectItem *aBlock)
 Removes an element from the vector.
 
void Add (FUObjectItem *aBlock)
 Add an element to the vector.
 
FORCEINLINE int32_t AddUnique (const FUObjectItem *&Item)
 
int32_t Find (const FUObjectItem *&Item) const
 
bool Contains (FUObjectItem *aBlock) const
 Sees if the vector contains the specified element.
 
uint32_t Num () const
 Returns the total number of elements in a vector.
 
void Reset ()
 We just reset the vector. UE has the following implementation.
 
void SmartReset ()
 Just clear the elements.
 
void SetVectorElementByIndex (int32_t Index, FUObjectItem *Value)
 Set the element of a vector using the vector index.
 
const std::vector< FUObjectItem * > & GetElements () const
 Getter for the elements of vector.
 
std::vector< FUObjectItem * > & ModifyElements ()
 Getter for elements of vector for modification in appropriate way.
 
std::vector< FUObjectItem * >::iterator begin ()
 Getter for first vector element.
 
std::vector< FUObjectItem * >::iterator end ()
 Getter for the last vector element.
 
FORCEINLINE FUObjectItem *& IndexToObject (int32_t Index)
 
FORCEINLINE bool IsValidIndex (int32_t Index) const
 

Additional Inherited Members

- Protected Attributes inherited from KarmaVector< FUObjectItem * >
std::vector< FUObjectItem * > m_Elements
 

Detailed Description

A class for managing the collection of UObjects (all or some?)

Note from UE devlopers (for the class FUObjectArray): Note the layout of this data structure is mostly to emulate the old behavior and minimize code rework during code restructure. Better data structures could be used in the future, for example maybe all that is needed is a TSet<UObject *> One has to be a little careful with this, especially with the GC optimization. I have seen spots that assume that non-GC objects come before GC ones during iteration.

Member Function Documentation

◆ AddUObject()

void Karma::FUObjectArray::AddUObject ( UObject * Object)

Add an element to the list

Parameters
ObjectThe pointer to UObject object to be added to "array"
Remarks
Maybe use pool allocations instead of new delete operators for optimization
Todo
Benchmark if this is bottle neck for SpawnActor
Since
Karma 1.0.0

Taken from Game Coding Complete 4th edition, page 169. There is variety of ways for indexing the UObjects, for simplicity we will start with number and based upon the complexity (if any?) we may transition to more appropriate indexing scheme as per the need.

◆ GetObjectsList()

const std::vector< FUObjectItem * > & Karma::FUObjectArray::GetObjectsList ( ) const
inline

Retrieve the list of the UObjects

Since
Karma 1.0.0

◆ IsValid()

bool Karma::FUObjectArray::IsValid ( const UObjectBase * Object) const

Checks if a UObject pointer is valid.

Parameters
Objectobject to test for validity
Returns
true if this index is valid
Since
Karma 1.0.0

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