KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
UObjectGlobals.h File Reference

This file contains some commonly used game code macros. More...

#include "krpch.h"
Include dependency graph for UObjectGlobals.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Karma::FUObjectItem
 Single item in UObjectStore. More...
 
class  Karma::FUObjectArray
 A class for managing the collection of UObjects (all or some?) More...
 
class  Karma::FUObjectArray::TIterator
 Low level iterator. More...
 
class  Karma::KarmaClassObjectMap
 Class for caching list of UObject pointers categorized by UClass. More...
 
struct  Karma::FStaticConstructObjectParameters
 This struct is used for passing parameter values to the StaticConstructObject_Internal() method. Only the constructor parameters are required to be valid - all other members are optional. Basically various UObject variables to be initialized when calling the NewObject routine. More...
 
class  Karma::FObjectInitializer
 Internal class to finalize UObject creation (initialize properties) after the real C++ constructor is called. More...
 

Namespaces

namespace  Karma::ECastCheckedType
 

Macros

#define INVALID_OBJECT   (UObject*)-1
 maximum value, 0xffffffff
 

Typedefs

typedef signed int Karma::int32
 32-bit signed integer
 

Enumerations

enum  Karma::EClassFlags {
  Karma::CLASS_None = 0x00000000u , Karma::CLASS_Abstract = 0x00000001u , Karma::CLASS_DefaultConfig = 0x00000002u , Karma::CLASS_Config = 0x00000004u ,
  Karma::CLASS_Transient = 0x00000008u , Karma::CLASS_Optional = 0x00000010u , CLASS_MatchedSerializers = 0x00000020u , Karma::CLASS_ProjectUserConfig = 0x00000040u ,
  Karma::CLASS_Native = 0x00000080u , Karma::CLASS_NotPlaceable = 0x00000200u , Karma::CLASS_PerObjectConfig = 0x00000400u , Karma::CLASS_ReplicationDataIsSetUp = 0x00000800u ,
  Karma::CLASS_EditInlineNew = 0x00001000u , Karma::CLASS_CollapseCategories = 0x00002000u , Karma::CLASS_Interface = 0x00004000u , Karma::CLASS_Const = 0x00010000u ,
  Karma::CLASS_NeedsDeferredDependencyLoading = 0x00020000u , Karma::CLASS_CompiledFromBlueprint = 0x00040000u , Karma::CLASS_MinimalAPI = 0x00080000u , Karma::CLASS_RequiredAPI = 0x00100000u ,
  Karma::CLASS_DefaultToInstanced = 0x00200000u , Karma::CLASS_TokenStreamAssembled = 0x00400000u , Karma::CLASS_HasInstancedReference = 0x00800000u , Karma::CLASS_Hidden = 0x01000000u ,
  Karma::CLASS_Deprecated = 0x02000000u , Karma::CLASS_HideDropDown = 0x04000000u , Karma::CLASS_GlobalUserConfig = 0x08000000u , Karma::CLASS_Intrinsic = 0x10000000u ,
  Karma::CLASS_Constructed = 0x20000000u , Karma::CLASS_ConfigDoNotCheckDefaults = 0x40000000u , Karma::CLASS_NewerVersionExists = 0x80000000u
}
 Flags describing a class. More...
 
enum  Karma::EPackageFlags {
  Karma::PKG_None = 0x00000000 , Karma::PKG_NewlyCreated = 0x00000001 , Karma::PKG_ClientOptional = 0x00000002 , Karma::PKG_ServerSideOnly = 0x00000004 ,
  Karma::PKG_CompiledIn = 0x00000010 , Karma::PKG_ForDiffing = 0x00000020 , Karma::PKG_EditorOnly = 0x00000040 , Karma::PKG_Developer = 0x00000080 ,
  Karma::PKG_UncookedOnly = 0x00000100 , Karma::PKG_Cooked = 0x00000200 , Karma::PKG_ContainsNoAsset = 0x00000400 , Karma::PKG_NotExternallyReferenceable = 0x00000800 ,
  Karma::PKG_UnversionedProperties = 0x00002000 , Karma::PKG_ContainsMapData = 0x00004000 , Karma::PKG_IsSaving = 0x00008000 , Karma::PKG_Compiling = 0x00010000 ,
  Karma::PKG_ContainsMap = 0x00020000 , Karma::PKG_RequiresLocalizationGather = 0x00040000 , Karma::PKG_PlayInEditor = 0x00100000 , Karma::PKG_ContainsScript = 0x00200000 ,
  Karma::PKG_DisallowExport = 0x00400000 , Karma::PKG_CookGenerated = 0x08000000 , Karma::PKG_DynamicImports = 0x10000000 , Karma::PKG_RuntimeGenerated = 0x20000000 ,
  Karma::PKG_ReloadingForCooker = 0x40000000 , Karma::PKG_FilterEditorOnly = 0x80000000 , PKG_TransientFlags = PKG_NewlyCreated | PKG_IsSaving | PKG_ReloadingForCooker
}
 Package flags, passed into UPackage::SetPackageFlags and related functions. More...
 
enum  Karma::EObjectFlags {
  Karma::RF_NoFlags = 0x00000000 , Karma::RF_Public = 0x00000001 , Karma::RF_Standalone = 0x00000002 , Karma::RF_MarkAsNative = 0x00000004 ,
  Karma::RF_Transactional = 0x00000008 , Karma::RF_ClassDefaultObject = 0x00000010 , Karma::RF_ArchetypeObject = 0x00000020 , Karma::RF_Transient = 0x00000040 ,
  Karma::RF_MarkAsRootSet = 0x00000080 , Karma::RF_TagGarbageTemp = 0x00000100 , Karma::RF_NeedInitialization = 0x00000200 , Karma::RF_NeedLoad = 0x00000400 ,
  Karma::RF_KeepForCooker = 0x00000800 , Karma::RF_NeedPostLoad = 0x00001000 , Karma::RF_NeedPostLoadSubobjects = 0x00002000 , Karma::RF_NewerVersionExists = 0x00004000 ,
  Karma::RF_BeginDestroyed = 0x00008000 , Karma::RF_FinishDestroyed = 0x00010000 , Karma::RF_BeingRegenerated = 0x00020000 , Karma::RF_DefaultSubObject = 0x00040000 ,
  Karma::RF_WasLoaded = 0x00080000 , Karma::RF_TextExportTransient = 0x00100000 , Karma::RF_LoadCompleted = 0x00200000 , Karma::RF_InheritableComponentTemplate = 0x00400000 ,
  Karma::RF_DuplicateTransient = 0x00800000 , Karma::RF_StrongRefOnFrame = 0x01000000 , Karma::RF_NonPIEDuplicateTransient = 0x02000000 , Karma::RF_Dynamic = 0x04000000 ,
  Karma::RF_WillBeLoaded = 0x08000000 , Karma::RF_HasExternalPackage = 0x10000000 , Karma::RF_PendingKill = 0x20000000 , Karma::RF_Garbage = 0x40000000 ,
  Karma::RF_AllocatedInSharedPage = 0x80000000
}
 Flags describing an object instance. More...
 
enum class  Karma::EInternalObjectFlags : int32 {
  None = 0 , LoaderImport = 1 << 20 , Garbage = 1 << 21 , PersistentGarbage = 1 << 22 ,
  ReachableInCluster = 1 << 23 , ClusterRoot = 1 << 24 , Native = 1 << 25 , Async = 1 << 26 ,
  AsyncLoading = 1 << 27 , Unreachable = 1 << 28 , PendingKill = 1 << 29 , RootSet = 1 << 30 ,
  PendingConstruction = 1 << 31 , GarbageCollectionKeepFlags = Native | Async | AsyncLoading | LoaderImport , MirroredFlags = Garbage | PendingKill , AllFlags = LoaderImport | Garbage | PersistentGarbage | ReachableInCluster | ClusterRoot | Native | Async | AsyncLoading | Unreachable | PendingKill | RootSet | PendingConstruction
}
 Objects flags for internal use (GC, low level UObject code) More...
 
enum  Karma::ECastCheckedType::Type { Karma::ECastCheckedType::NullAllowed , Karma::ECastCheckedType::NullChecked }
 

Functions

template<typename Enum>
constexpr bool Karma::EnumHasAnyFlags (Enum Flags, Enum Contains)
 Sees if a specified flag(s) exists in the linear combination of flags.
 
template<class T, class U>
FORCEINLINE T * Karma::CastChecked (const U &Src, ECastCheckedType::Type CheckType=ECastCheckedType::NullChecked)
 
UObjectKarma::StaticConstructObject_Internal (const FStaticConstructObjectParameters &Params)
 
UObjectKarma::StaticAllocateObject (const UClass *inClass, UObject *inOuter, const std::string &inName, EObjectFlags inFlags, EInternalObjectFlags internalSetFlags)
 
template<class T>
FUNCTION_NON_NULL_RETURN_START T * Karma::NewObject (UObject *Outer, const UClass *Class, std::string name="No_Name", EObjectFlags Flags=RF_NoFlags, UObject *Template=nullptr, bool bCopyTransientsFromClassDefaults=false) FUNCTION_NON_NULL_RETURN_END
 
UObjectKarma::StaticFindObjectFastInternal (const UClass *ObjectClass, const UObject *ObjectPackage, const std::string &ObjectName, bool bExactClass, EObjectFlags ExcludeFlags, EInternalObjectFlags ExclusiveInternalFlags)
 
KARMA_API UObjectKarma::StaticFindObject (UClass *Class, UObject *InOuter, const std::string &Name, bool ExactClass=false)
 
template<class T>
KARMA_API T * Karma::FindObject (UObject *Outer, const std::string &Name, bool ExactClass=false)
 Find an optional object.
 
UPackageKarma::CreatePackage (const std::string &PackageName)
 
void Karma::GetObjectsOfClass (const UClass *ClassToLookFor, KarmaVector< UObject * > &Results, bool bIncludeDerivedClasses, EObjectFlags ExclusionFlags, EInternalObjectFlags ExclusionInternalFlags)
 
void Karma::ForEachObjectOfClass (const UClass *ClassToLookFor, std::function< void(UObject *)> Operation, bool bIncludeDerivedClasses, EObjectFlags ExclusionFlags, EInternalObjectFlags ExclusionInternalFlags)
 
void Karma::RegisterUObjectsStatisticsCallback (FUObjectAllocatorCallback dumpCallback)
 
void Karma::CacheObject (UObject *Object)
 
void Karma::StaticUObjectInit ()
 
UPackageKarma::GetTransientPackage ()
 

Detailed Description

This file contains some commonly used game code macros.

Author
Ravi Mohan (the_cowboy)
Version
1.0
Date
May 10, 2023

Typedef Documentation

◆ int32

typedef signed int Karma::int32

32-bit signed integer

Todo
find or write appropriate class for such type
Remarks
usage hasn't caught on in usual engine routines

Enumeration Type Documentation

◆ EClassFlags

Flags describing a class.

Note
This MUST be kept in sync with EClassFlags defined in Engine\Source\Programs\Shared\EpicGames.Core\UnrealEngineTypes.cs
Enumerator
CLASS_None 

No Flags

CLASS_Abstract 

Class is abstract and can't be instantiated directly.

CLASS_DefaultConfig 

Save object configuration only to Default INIs, never to local INIs. Must be combined with CLASS_Config

CLASS_Config 

Load object configuration at construction time.

CLASS_Transient 

This object type can't be saved; null it out at save time.

CLASS_Optional 

This object type may not be available in certain context. (i.e. game runtime or in certain configuration). Optional class data is saved separately to other object types. (i.e. might use sidecar files)

CLASS_ProjectUserConfig 

Indicates that the config settings for this class will be saved to Project/User*.ini (similar to CLASS_GlobalUserConfig)

CLASS_Native 

Class is a native class - native interfaces will have CLASS_Native set, but not RF_MarkAsNative

CLASS_NotPlaceable 

Don't export to C++ header. Do not allow users to create in the editor.

CLASS_PerObjectConfig 

Handle object configuration on a per-object basis, rather than per-class.

CLASS_ReplicationDataIsSetUp 

Whether SetUpRuntimeReplicationData still needs to be called for this class

CLASS_EditInlineNew 

Class can be constructed from editinline New button.

CLASS_CollapseCategories 

Display properties in the editor without using categories.

CLASS_Interface 

Class is an interface

CLASS_Const 

Do not export a constructor for this class, assuming it is in the cpptext all properties and functions in this class are const and should be exported as const

CLASS_NeedsDeferredDependencyLoading 

Class flag indicating objects of this class need deferred dependency loading

CLASS_CompiledFromBlueprint 

Indicates that the class was created from blueprint source material

CLASS_MinimalAPI 

Indicates that only the bare minimum bits of this class should be DLL exported/imported

CLASS_RequiredAPI 

Indicates this class must be DLL exported/imported (along with all of it's members)

CLASS_DefaultToInstanced 

Indicates that references to this class default to instanced. Used to be subclasses of UComponent, but now can be any UObject

CLASS_TokenStreamAssembled 

Indicates that the parent token stream has been merged with ours.

CLASS_HasInstancedReference 

Class has component properties.

CLASS_Hidden 

Don't show this class in the editor class browser or edit inline new menus.

CLASS_Deprecated 

Don't save objects of this class when serializing

CLASS_HideDropDown 

Class not shown in editor drop down for class selection

CLASS_GlobalUserConfig 

Class settings are saved to <AppData>/..../Blah.ini (as opposed to CLASS_DefaultConfig)

CLASS_Intrinsic 

Class was declared directly in C++ and has no boilerplate generated by UnrealHeaderTool

CLASS_Constructed 

Class has already been constructed (maybe in a previous DLL version before hot-reload).

CLASS_ConfigDoNotCheckDefaults 

Indicates that object configuration will not check against ini base/defaults when serialized

CLASS_NewerVersionExists 

Class has been consigned to oblivion as part of a blueprint recompile, and a newer version currently exists.

◆ EInternalObjectFlags

enum class Karma::EInternalObjectFlags : int32
strong

Objects flags for internal use (GC, low level UObject code)

Note
This MUST be kept in sync with EInternalObjectFlags defined in Engine\Source\Programs\Shared\EpicGames.Core\UnrealEngineTypes.cs
Enumerator
LoaderImport 

Object is ready to be imported by another package during loading.

Garbage 

Garbage from logical point of view and should not be referenced. This flag is mirrored in EObjectFlags as RF_Garbage for performance.

PersistentGarbage 

Same as above but referenced through a persistent reference so it can't be GC'd.

ReachableInCluster 

External reference to object in cluster exists.

ClusterRoot 

Root of a cluster.

Native 

Native (UClass only).

Async 

Object exists only on a different thread than the game thread.

AsyncLoading 

Object is being asynchronously loaded.

Unreachable 

Object is not reachable on the object graph.

PendingKill 

Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored in EObjectFlags as RF_PendingKill for performance.

RootSet 

Object will not be garbage collected, even if unreferenced.

PendingConstruction 

Object didn't have its class constructor called yet (only the UObjectBase one to initialize its most basic members)

AllFlags 

Flags mirrored in EObjectFlags.

◆ EObjectFlags

Flags describing an object instance.

Enumerator
RF_NoFlags 

No flags, used to avoid a cast.

RF_Public 

Object is visible outside its package.

RF_Standalone 

Keep object around for editing even if unreferenced.

RF_MarkAsNative 

Object (UField) will be marked as native on construction (DO NOT USE THIS FLAG in HasAnyFlags() etc)

RF_Transactional 

Object is transactional.

RF_ClassDefaultObject 

This object is its class's default object.

RF_ArchetypeObject 

This object is a template for another object - treat like a class default object.

RF_Transient 

Don't save object.

RF_MarkAsRootSet 

Object will be marked as root set on construction and not be garbage collected, even if unreferenced (DO NOT USE THIS FLAG in HasAnyFlags() etc)

RF_TagGarbageTemp 

This is a temp user flag for various utilities that need to use the garbage collector. The garbage collector itself does not interpret it.

RF_NeedInitialization 

This object has not completed its initialization process. Cleared when ~FObjectInitializer completes.

RF_NeedLoad 

During load, indicates object needs loading.

RF_KeepForCooker 

Keep this object during garbage collection because it's still being used by the cooker.

RF_NeedPostLoad 

Object needs to be postloaded.

RF_NeedPostLoadSubobjects 

During load, indicates that the object still needs to instance subobjects and fixup serialized component references.

RF_NewerVersionExists 

Object has been consigned to oblivion due to its owner package being reloaded, and a newer version currently exists.

RF_BeginDestroyed 

BeginDestroy has been called on the object.

RF_FinishDestroyed 

FinishDestroy has been called on the object.

RF_BeingRegenerated 

Flagged on UObjects that are used to create UClasses (e.g. Blueprints) while they are regenerating their UClass on load (See FLinkerLoad::CreateExport()), as well as UClass objects in the midst of being created.

RF_DefaultSubObject 

Flagged on subobjects that are defaults.

RF_WasLoaded 

Flagged on UObjects that were loaded.

RF_TextExportTransient 

Do not export object to text form (e.g. copy/paste). Generally used for sub-objects that can be regenerated from data in their parent object.

RF_LoadCompleted 

Object has been completely serialized by linkerload at least once. DO NOT USE THIS FLAG, It should be replaced with RF_WasLoaded.

RF_InheritableComponentTemplate 

Archetype of the object can be in its super class.

RF_DuplicateTransient 

Object should not be included in any type of duplication (copy/paste, binary duplication, etc.)

RF_StrongRefOnFrame 

References to this object from persistent function frame are handled as strong ones.

RF_NonPIEDuplicateTransient 

Object should not be included for duplication unless it's being duplicated for a PIE session.

RF_Dynamic 

Field Only. Dynamic field - doesn't get constructed during static initialization, can be constructed multiple times //.

Todo
: BP2CPP_remove
RF_WillBeLoaded 

This object was constructed during load and will be loaded shortly.

RF_HasExternalPackage 

This object has an external package assigned and should look it up when getting the outermost package.

RF_PendingKill 

Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored in EInternalObjectFlags as PendingKill for performance.

RF_Garbage 

Garbage from logical point of view and should not be referenced. This flag is mirrored in EInternalObjectFlags as Garbage for performance.

RF_AllocatedInSharedPage 

Allocated from a ref-counted page shared with other UObjects.

◆ EPackageFlags

Package flags, passed into UPackage::SetPackageFlags and related functions.

Note
This MUST be kept in sync with EPackageFlags defined in Engine\Source\Programs\Shared\EpicGames.Core\UnrealEngineTypes.cs
Enumerator
PKG_None 

No flags.

PKG_NewlyCreated 

Newly created package, not saved yet. In editor only.

PKG_ClientOptional 

Purely optional for clients.

PKG_ServerSideOnly 

Only needed on the server side.

PKG_CompiledIn 

This package is from "compiled in" classes.

PKG_ForDiffing 

This package was loaded just for the purposes of diffing.

PKG_EditorOnly 

This is editor-only package (for example: editor module script package)

PKG_Developer 

Developer module.

PKG_UncookedOnly 

Loaded only in uncooked builds (i.e. runtime in editor)

PKG_Cooked 

Package is cooked.

PKG_ContainsNoAsset 

Package doesn't contain any asset object (although asset tags can be present)

PKG_NotExternallyReferenceable 

Objects in this package cannot be referenced in a different plugin or mount point (i.e /Game -> /Engine)

PKG_UnversionedProperties 

Uses unversioned property serialization instead of versioned tagged property serialization.

PKG_ContainsMapData 

Contains map data (UObjects only referenced by a single ULevel) but is stored in a different package.

PKG_IsSaving 

Temporarily set on a package while it is being saved.

PKG_Compiling 

package is currently being compiled

PKG_ContainsMap 

Set if the package contains a ULevel/ UWorld object.

PKG_RequiresLocalizationGather 

Set if the package contains any data to be gathered by localization.

PKG_PlayInEditor 

Set if the package was created for the purpose of PIE.

PKG_ContainsScript 

Package is allowed to contain UClass objects.

PKG_DisallowExport 

Editor should not export asset in this package.

PKG_CookGenerated 

This package was generated by the cooker and does not exist in the WorkspaceDomain.

PKG_DynamicImports 

This package should resolve dynamic imports from its export at runtime.

PKG_RuntimeGenerated 

This package contains elements that are runtime generated, and may not follow standard loading order rules.

PKG_ReloadingForCooker 

This package is reloading in the cooker, try to avoid getting data we will never need. We won't save this package.

PKG_FilterEditorOnly 

Package has editor-only data filtered out.

Function Documentation

◆ CacheObject()

KARMA_API void Karma::CacheObject ( class UObject * Object)

Add an object to the cache, categorized by class

Parameters
ObjectObject to add to the cache
See also
m_ClassToObjectVectorMap

◆ CastChecked()

template<class T, class U>
FORCEINLINE T * Karma::CastChecked ( const U & Src,
ECastCheckedType::Type CheckType = ECastCheckedType::NullChecked )

Sees if class of type U can be cast into T class type, returns the casted class Needs to move to own Cast class

Parameters
SrcThe object pointer which needs to be checked
CheckTypeHow to perform cast checks
Todo
static_cast may require more addition depending on the usage

◆ CreatePackage()

KARMA_API UPackage * Karma::CreatePackage ( const std::string & PackageName)

Find an existing package by name or create it if it doesn't exist

Parameters
Thename of the package to be searched or create
Returns
The existing package or a newly created one

◆ EnumHasAnyFlags()

template<typename Enum>
bool Karma::EnumHasAnyFlags ( Enum Flags,
Enum Contains )
constexpr

Sees if a specified flag(s) exists in the linear combination of flags.

Note
Got from EnumClassFlags.h
Parameters
FlagsThe linear combination (&'d) of flags
ContainsThe flags to be seen
Todo
may need to write in seperate file

◆ FindObject()

template<class T>
KARMA_API T * Karma::FindObject ( UObject * Outer,
const std::string & Name,
bool ExactClass = false )
inline

Find an optional object.

Tries to find an object in memory

See also
StaticFindObject()

◆ ForEachObjectOfClass()

KARMA_API void Karma::ForEachObjectOfClass ( const UClass * ClassToLookFor,
std::function< void(UObject *)> Operation,
bool bIncludeDerivedClasses = true,
EObjectFlags ExcludeFlags = RF_ClassDefaultObject,
EInternalObjectFlags ExclusionInternalFlags = EInternalObjectFlags::None )

Performs an operation on all objects of the provided class Note that the operation must not modify UObject hash maps so it can not create, rename, or destroy UObjects.

Parameters
OuterUObject class to loop over instances of
OperationFunction to be called for each object
bIncludeDerivedClassesIf true, the results will include objects of child classes as well.
AdditionalExcludeFlagsObjects with any of these flags will be excluded from the results.

◆ GetObjectsOfClass()

KARMA_API void Karma::GetObjectsOfClass ( const UClass * ClassToLookFor,
KarmaVector< UObject * > & Results,
bool bIncludeDerivedClasses = true,
EObjectFlags ExcludeFlags = RF_ClassDefaultObject,
EInternalObjectFlags ExclusionInternalFlags = EInternalObjectFlags::None )

Returns a vector of objects of a specific class. Optionally, results can include objects of derived classes as well.

Todo
Results of derived class logic needs be written bIncludeDerivedClasses not functional yet
Parameters
ClassToLookForClass of the objects to return.
ResultsAn output list of objects of the specified class.
bIncludeDerivedClassesIf true, the results will include objects of child classes as well.
AdditionalExcludeFlagsObjects with any of these flags will be excluded from the results.
ExclusiveInternalFlagsSpecifies internal flags to use as a filter for which objects to return

◆ NewObject()

template<class T>
FUNCTION_NON_NULL_RETURN_START T * Karma::NewObject ( UObject * Outer,
const UClass * Class,
std::string name = "No_Name",
EObjectFlags Flags = RF_NoFlags,
UObject * Template = nullptr,
bool bCopyTransientsFromClassDefaults = false )

Convenience template for constructing a gameplay object

Parameters
Outerthe outer for the new object. If not specified, object will be created in the transient package. For AActors, Outer is the ULevel
Classthe class of object to construct
Namethe name for the new object. If not specified, the object will be given a transient name via MakeUniqueObjectName
Flagsthe object flags to apply to the new object
Templatethe object to use for initializing the new object. If not specified, the class's default object will be used. Not functional atm
bCopyTransientsFromClassDefaultsif true, copy transient from the class defaults instead of the pass in archetype ptr (often these are the same)
InInstanceGraphcontains the mappings of instanced objects and components to their templates
ExternalPackageAssign an external Package to the created object if non-null
Returns
a pointer of type T to a new object of the specified class

◆ RegisterUObjectsStatisticsCallback()

KARMA_API void Karma::RegisterUObjectsStatisticsCallback ( FUObjectAllocatorCallback dumpCallback)

Client's callback registering routine for receiving UObjects relevant data dump

Parameters
dumpCallbackThe callback function defined in client

◆ StaticAllocateObject()

KARMA_API UObject * Karma::StaticAllocateObject ( const UClass * Class,
UObject * InOuter,
const std::string & name,
EObjectFlags SetFlags = EObjectFlags::RF_NoFlags,
EInternalObjectFlags InternalSetFlags = EInternalObjectFlags::None )

Create a new instance of an object or replace an existing object. If both an Outer and Name are specified, and there is an object already in memory with the same Class, Outer, and Name, the existing object will be destructed, and the new object will be created in its place.

Parameters
Classthe class of the object to create
InOuterthe object to create this object within (the Outer property for the new object will be set to the value specified here).
Namethe name to give the new object. If no value (NAME_None) is specified, the object will be given a unique name in the form of ClassName_#.
SetFlagsthe ObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.
InternalSetFlagsthe InternalObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object.

Rest shall be made available when reflection code is enabled

Parameters
bCanReuseSubobjectsif set to true, SAO will not attempt to destroy a subobject if it already exists in memory.
bOutReusedSubobjectflag indicating if the object is a subobject that has already been created (in which case further initialization is not necessary).
ExternalPackageExternal Package assigned to the allocated object, if any
Returns
a pointer to a fully initialized object of the specified class.

◆ StaticConstructObject_Internal()

KARMA_API UObject * Karma::StaticConstructObject_Internal ( const FStaticConstructObjectParameters & Params)

Create a new instance of an object. The returned object will be fully initialized. If InFlags contains RF_NeedsLoad (indicating that the object still needs to load its object data from disk), components are not instanced (this will instead occur in PostLoad()). The different between StaticConstructObject and StaticAllocateObject is that StaticConstructObject will also call the class constructor on the object and instance any components.

Parameters
ParamsThe parameters to use when construction the object.
See also
FStaticConstructObjectParameters
Returns
A pointer to a fully initialized object of the specified class.

◆ StaticFindObject()

KARMA_API UObject * Karma::StaticFindObject ( UClass * Class,
UObject * InOuter,
const std::string & Name,
bool ExactClass = false )

Tries to find an object in memory. This will handle fully qualified paths of the form /path/packagename.object:subobject and resolve references for you.

Parameters
ClassThe to be found object's class
InOuterOuter object to look inside. If this is null then InName should start with a package name
InNameThe object path to search for an object, relative to InOuter
ExactClassWhether to require an exact match with the passed in class
Returns
Returns a pointer to the found object or nullptr if none could be found

◆ StaticFindObjectFastInternal()

KARMA_API UObject * Karma::StaticFindObjectFastInternal ( const UClass * ObjectClass,
const UObject * ObjectPackage,
const std::string & ObjectName,
bool bExactClass = false,
EObjectFlags ExcludeFlags = RF_NoFlags,
EInternalObjectFlags ExclusiveInternalFlags = EInternalObjectFlags::None )

A routine to find if the object is instantiated already. May need to modify in accordance with thread safety in future UE name StaticFindObjectFastInternal

Parameters
ObjectClassthe class of object to construct
ObjectPackagethe outer where the object is supposed to be found
ObjectNamethe name for the object to be found
bExactClassclass match check
bAnyPackageIf there is no package (no InObjectPackage specified, and InName's package is "") and the caller specified any_package, then accept it, regardless of its package.Or, if the object is a top-level package then accept it immediately
ExcludeFlagsDon't return objects that have any of these exclusive flags set
ExclusiveInternalFlagsInclude (or not) pending kill objects
ExternalPackageAssign an external Package to the created object if non-null
Returns
a pointer of type UObject if found, else nulptr

If a class was specified, check that the object is of the correct class (hierarchy)

Include (or not) pending kill objects