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

Low level implementation of UObject, should not be used directly in game code. More...

#include <UObjectBase.h>

Inheritance diagram for Karma::UObjectBase:

Public Member Functions

 UObjectBase (UClass *inClass, EObjectFlags inFlags, EInternalObjectFlags inInternalFlags, UObject *inOuter, const std::string &inName)
 
UPackageGetPackage () const
 
UPackageGetExternalPackage () const
 
bool IsUnreachable () const
 
FORCEINLINE void SetInternalIndex (uint32_t StoreIndex)
 
FORCEINLINE uint32_t GetInternalIndex () const
 
void MarkAsGarbage ()
 
void ClearGarbage ()
 
FORCEINLINE const std::string & GetName () const
 
FORCEINLINE void SetObjectName (const std::string &aName)
 
FORCEINLINE UObjectGetOuter () const
 
UObjectGetTypedOuter (UClass *Target) const
 
template<typename T>
T * GetTypedOuter () const
 
bool IsValidLowLevel () const
 
template<typename OtherClassType>
FORCEINLINE bool IsA (OtherClassType SomeBase) const
 
FORCEINLINE UClassGetClass () const
 
FORCEINLINE EObjectFlags GetFlags () const
 
FORCEINLINE void SetFlags (EObjectFlags NewFlags)
 
FORCEINLINE void ClearFlags (EObjectFlags FlagsToClear)
 
FORCEINLINE bool HasAnyFlags (EObjectFlags FlagsToCheck) const
 
FORCEINLINE bool HasAnyInternalFlags (EInternalObjectFlags FlagsToCheck) const
 
FORCEINLINE void SetInternalFlags (EInternalObjectFlags FlagsToSet) const
 
FORCEINLINE void AddToRoot ()
 

Static Public Member Functions

static FORCEINLINE EInternalObjectFlags FixGarbageOrPendingKillInternalObjectFlags (const EInternalObjectFlags InFlags)
 

Protected Member Functions

 UObjectBase ()
 Providing a default constructor.
 
FORCEINLINE void SetFlagsTo (EObjectFlags NewFlags)
 

Detailed Description

Low level implementation of UObject, should not be used directly in game code.

Taken from UE's UObjectBaseUtility.h and combined UObjectBase and UObjectBaseUtility classes for simplicity

Constructor & Destructor Documentation

◆ UObjectBase() [1/2]

Karma::UObjectBase::UObjectBase ( )
protected

Providing a default constructor.

Basically required constructor for DECLARE_KARMA_CLASS(TClass, TSuperClass) in the derived classes

See also
UObject::UObject()
Since
Karma 1.0.0

◆ UObjectBase() [2/2]

Karma::UObjectBase::UObjectBase ( UClass * inClass,
EObjectFlags inFlags,
EInternalObjectFlags inInternalFlags,
UObject * inOuter,
const std::string & inName )

Constructor used by StaticAllocateObject

Parameters
InClassnon NULL, this gives the class of the new object, if known at this time
InFlagsRF_Flags to assign
InOuterouter for this object (UObject this object resides in, for instance LevelToSpawnIn is outer for AActor)
InNamename of the new object
InObjectArchetypearchetype to assign (not functional for now)
See also
StaticAllocateObject() in UObjectGlobals.h
Since
Karma 1.0.0

Member Function Documentation

◆ AddToRoot()

FORCEINLINE void Karma::UObjectBase::AddToRoot ( )
inline

Add an object to the root set. This prevents the object and all its descendants from being deleted during garbage collection.

Todo
To be implemented when garbage collection system is finished

◆ ClearFlags()

FORCEINLINE void Karma::UObjectBase::ClearFlags ( EObjectFlags FlagsToClear)
inline

Clears subset of flags for a specific object

Parameters
FlagsToClearEObjectFlags to be cleared
Since
Karma 1.0.0

◆ ClearGarbage()

void Karma::UObjectBase::ClearGarbage ( )

Unmarks this object as Garbage

Todo
Not functional
Since
Karma 1.0.0

◆ FixGarbageOrPendingKillInternalObjectFlags()

static FORCEINLINE EInternalObjectFlags Karma::UObjectBase::FixGarbageOrPendingKillInternalObjectFlags ( const EInternalObjectFlags InFlags)
inlinestatic

Helper function that sets the appropriate flag based on PK being enabled or not

Todo
Need to write decent garbage collection system. Then this may become useful.
Since
Karma 1.0.0

◆ GetClass()

FORCEINLINE UClass * Karma::UObjectBase::GetClass ( ) const
inline

Returns the UClass that defines the fields of this object

Since
Karma 1.0.0

◆ GetExternalPackage()

UPackage * Karma::UObjectBase::GetExternalPackage ( ) const

Returns the external UPackage associated with this object, if any

Since
Karma 1.0.0

◆ GetFlags()

FORCEINLINE EObjectFlags Karma::UObjectBase::GetFlags ( ) const
inline

Retrieve the object flags directly

Returns
Flags for this object
Since
Karma 1.0.0

◆ GetInternalIndex()

FORCEINLINE uint32_t Karma::UObjectBase::GetInternalIndex ( ) const
inline

Getter for m_InternalIndex of UObjects

See also
TentativeFlagChecks()

◆ GetName()

FORCEINLINE const std::string & Karma::UObjectBase::GetName ( ) const
inline

Returns the logical name of this object

Since
Karma 1.0.0

◆ GetOuter()

FORCEINLINE UObject * Karma::UObjectBase::GetOuter ( ) const
inline

Returns the UObject this object resides in

Remarks
Could be LevelToSpawnIn for AActor or UPackage for UWorld
See also
UWorld::CreateWorld for how UPackage is outer for UWorld
Since
Karma 1.0.0

◆ GetPackage()

UPackage * Karma::UObjectBase::GetPackage ( ) const

Walks up the list of outers until it finds a package directly associated with the object.

Returns
the package the object is in
Since
Karma 1.0.0

◆ GetTypedOuter() [1/2]

template<typename T>
T * Karma::UObjectBase::GetTypedOuter ( ) const
inline

Traverses the outer chain searching for the next object of a certain type.

Returns
a pointer to the first object in this object's Outer chain which is of the correct type.
Remarks
T must be derived from UObject
Since
Karma 1.0.0

◆ GetTypedOuter() [2/2]

UObject * Karma::UObjectBase::GetTypedOuter ( UClass * Target) const

Traverses the outer chain searching for the next object of a certain type. (T must be derived from UObject)

Parameters
Targetclass to search for
Returns
a pointer to the first object in this object's Outer chain which is of the correct type.
Since
Karma 1.0.0

◆ HasAnyFlags()

FORCEINLINE bool Karma::UObjectBase::HasAnyFlags ( EObjectFlags FlagsToCheck) const
inline

Used to safely check whether any of the passed in flags are set.

Parameters
FlagsToCheckObject flags to check for
Returns
true if any of the passed in flags are set, false otherwise (including no flags passed in)
Since
Karma 1.0.0

◆ HasAnyInternalFlags()

FORCEINLINE bool Karma::UObjectBase::HasAnyInternalFlags ( EInternalObjectFlags FlagsToCheck) const
inline

Used to safely check whether any of the passed in internal flags are set.

Parameters
FlagsToCheckObject flags to check for
Returns
true if any of the passed in flags are set, false otherwise (including no flags passed in)
Since
Karma 1.0.0

◆ IsA()

template<typename OtherClassType>
FORCEINLINE bool Karma::UObjectBase::IsA ( OtherClassType SomeBase) const
inline

Returns true if this object is of the specified type.

Parameters
SomeBaseThe UClass that this UObject is subjected to the comparison
See also
UObjectBase::GetTypedOuter
Since
Karma 1.0.0

◆ IsUnreachable()

bool Karma::UObjectBase::IsUnreachable ( ) const

Checks if the object is unreachable.

Warning
use with vigilance
Since
Karma 1.0.0

◆ IsValidLowLevel()

bool Karma::UObjectBase::IsValidLowLevel ( ) const

Checks to see if the object appears to be valid

Returns
true if this appears to be a valid object
Todo
Not functional
Since
Karma 1.0.0

◆ MarkAsGarbage()

void Karma::UObjectBase::MarkAsGarbage ( )

Marks the object for garbage collection

Todo
Not functional
Since
Karma 1.0.0

◆ SetFlags()

FORCEINLINE void Karma::UObjectBase::SetFlags ( EObjectFlags NewFlags)
inline

Modifies object flags for a specific object

Parameters
NewFlagsThe EObjectFlags to be set for this object
See also
UObjectBase::SetFlagsTo
Since
Karma 1.0.0

◆ SetFlagsTo()

FORCEINLINE void Karma::UObjectBase::SetFlagsTo ( EObjectFlags NewFlags)
inlineprotected

Set the object flags directly

See also
UObjectBase::SetFlags()
UObjectBase::ClearFlags()
Since
Karma 1.0.0

◆ SetInternalFlags()

FORCEINLINE void Karma::UObjectBase::SetInternalFlags ( EInternalObjectFlags FlagsToSet) const
inline

Sets internal flags of the FUObjectItem

Parameters
FlagsToSet
Since
Karma 1.0.0

◆ SetInternalIndex()

FORCEINLINE void Karma::UObjectBase::SetInternalIndex ( uint32_t StoreIndex)
inline

Set indexing for GUObjectStore for lookup of UObjects.

See also
FUObjectArray::AddUObject

◆ SetObjectName()

FORCEINLINE void Karma::UObjectBase::SetObjectName ( const std::string & aName)
inline

Sets the name of UObjects

Since
Karma 1.0.0

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