![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <UObjectAnnotation.h>
Inheritance diagram for FUObjectAnnotationSparse< TAnnotation, bAutoRemove >:Public Member Functions | |
| virtual void | NotifyUObjectDeleted (const UObjectBase *Object, int32 Index) override |
| virtual void | OnUObjectArrayShutdown () override |
| FUObjectAnnotationSparse () | |
| virtual | ~FUObjectAnnotationSparse () |
| void | AddAnnotation (const UObjectBase *Object, TAnnotation &&Annotation) |
| void | AddAnnotation (const UObjectBase *Object, const TAnnotation &Annotation) |
| TAnnotation | GetAndRemoveAnnotation (const UObjectBase *Object) |
| void | RemoveAnnotation (const UObjectBase *Object) |
| void | RemoveAllAnnotations () |
| TAnnotation | GetAnnotation (const UObjectBase *Object) |
| const TMap< const UObjectBase *, TAnnotation > & | GetAnnotationMap () const |
| void | Reserve (int32 ExpectedNumElements) |
| virtual SIZE_T | GetAllocatedSize () const override |
Public Member Functions inherited from FUObjectArray::FUObjectDeleteListener | |
| virtual | ~FUObjectDeleteListener () |
| virtual void | NotifyUObjectDeleted (const class UObjectBase *Object, int32 Index)=0 |
Protected Attributes | |
| FTransactionallySafeRWLock | AnnotationMapCritical |
| FTransactionallySafeRWLock | AnnotationCacheCritical |
| TMap< const UObjectBase *, TAnnotation > | AnnotationMap |
| const UObjectBase * | AnnotationCacheKey = nullptr |
| TAnnotation | AnnotationCacheValue |
| bool | bRegistered = false |
FUObjectAnnotationSparse is a helper class that is used to store sparse, slow, temporary, editor only, external or other low priority information about UObjects.
There is a notion of a default annotation and UObjects default to this annotation and this takes no storage.
Annotations are automatically cleaned up when UObjects are destroyed. Annotation are not "garbage collection aware", so it isn't safe to store pointers to other UObjects in an annotation unless external guarantees are made such that destruction of the other object removes the annotation.
| TAnnotation | type of the annotation |
| bAutoRemove | if true, annotation will automatically be removed, otherwise in non-final builds it will verify that the annotation was removed by other means prior to destruction. |
Constructor, initializes to nothing
|
inlinevirtual |
Destructor, removes all annotations, which removes the annotation as a uobject destruction listener
|
inline |
|
inline |
Add an annotation to the annotation list. If the Annotation is the default, then the annotation is removed.
| Object | Object to annotate. |
| Annotation | Annotation to associate with Object. |
|
inlineoverridevirtual |
Returns the size of heap memory allocated internally by this listener
Reimplemented from FUObjectArray::FUObjectDeleteListener.
Reimplemented in FUObjectAnnotationSparseSearchable< TAnnotation, bAutoRemove >.
|
inline |
Removes an annotation from the annotation list and returns the annotation if it had one
| Object | Object to de-annotate. |
|
inline |
Return the annotation associated with a uobject
| Object | Object to return the annotation for |
|
inline |
Return the annotation map. Caution, this is for low level use
|
inlineoverridevirtual |
Interface for FUObjectAllocator::FUObjectDeleteListener
| Object | object that has been destroyed |
| Index | index of object that is being deleted |
Reimplemented in FUObjectAnnotationSparseSearchable< TAnnotation, bAutoRemove >.
|
inlineoverridevirtual |
Called when UObject Array is being shut down, this is where all listeners should be removed from it
Implements FUObjectArray::FUObjectDeleteListener.
Reimplemented in FUObjectAnnotationSparseSearchable< TAnnotation, bAutoRemove >.
|
inline |
Removes all annotation from the annotation list.
|
inline |
Removes an annotation from the annotation list.
| Object | Object to de-annotate. |
|
inline |
Reserves memory for the annotation map for the specified number of elements, used to avoid reallocations.
|
mutableprotected |
|
protected |
Key for a one-item cache of the last lookup into AnnotationMap. Guarded by AnnotationCacheCritical. Annotation are often called back-to-back so this is a performance optimization for that.
|
protected |
Value for a one-item cache of the last lookup into AnnotationMap. Guarded by AnnotationCacheCritical.
|
protected |
Map from live objects to an annotation. Guarded by AnnotationMapCritical.
|
mutableprotected |
Guards the annotation map, cache key and cache value.
|
protected |
Monitor registration to GUObjectArray/UObjectDeleteListener.