UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Factory.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Core/Types.h"
5#include "Core/Group.h"
6#ifdef CADKERNEL_DEV
7#include "UI/DefineForDebug.h"
8#endif
9
10#include "Containers/List.h"
11
12
13namespace UE::CADKernel
14{
15
16template<class ElementType>
18{
19 static const int32 MaxSize = 256;
20
21protected:
24#ifdef DEBUG_FACTORY
28#endif
29
30private:
31 void FillFreeEntityStack()
32 {
35 EntityPool.SetNum(MaxSize);
36 for (ElementType& Entity : EntityPool)
37 {
39 }
40#ifdef DEBUG_FACTORY
42#endif
43 }
44
45public:
50
51 void DeleteEntity(ElementType* Entity)
52 {
53 Entity->Clean();
55#ifdef DEBUG_FACTORY
58#endif
59 }
60
61 ElementType& New()
62 {
63#ifdef DEBUG_FACTORY
65#endif
67 {
68 FillFreeEntityStack();
69 }
70#ifdef DEBUG_FACTORY
72#endif
74 }
75};
76} // namespace UE::CADKernel
77
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define ensureCADKernel(InExpression)
Definition Types.h:115
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_REWRITE bool IsEmpty() const
Definition Array.h:1133
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
ElementType Pop(EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:1196
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
Definition List.h:439
TDoubleLinkedListNode * GetHead() const
Definition List.h:727
bool AddHead(const ElementType &InElement)
Definition List.h:538
Definition Factory.h:18
TFactory()
Definition Factory.h:46
ElementType & New()
Definition Factory.h:61
void DeleteEntity(ElementType *Entity)
Definition Factory.h:51
TDoubleLinkedList< TArray< ElementType > > StackOfEntitySet
Definition Factory.h:22
TArray< ElementType * > FreeEntityStack
Definition Factory.h:23
Definition CADEntity.cpp:23