UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GeometryTypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Map.h"
7
8namespace UE
9{
10namespace Geometry
11{
12
50
51
52
59{
60 Ok = 0,
62
64};
65
66
72{
74 ReturnOnly = 0,
76 Check = 1,
78 Ensure = 2
79};
80
81
82
83
84
94template<typename IntType>
96{
97protected:
102
103public:
104
106 {
107 bWantForward = bWantReverse = true;
108 }
109
110 void Reset()
111 {
112 ForwardMap.Reset();
113 ReverseMap.Reset();
114 }
115
117 constexpr IntType UnmappedID() const { return (IntType)-1; }
118
121
124
126 inline void Add(IntType FromID, IntType ToID)
127 {
128 checkSlow(FromID >= 0 && ToID >= 0);
129 ForwardMap.Add(FromID, ToID);
130 ReverseMap.Add(ToID, FromID);
131 }
132
134 inline bool ContainsFrom(IntType FromID) const
135 {
136 checkSlow(FromID >= 0);
138 return ForwardMap.Contains(FromID);
139 }
140
142 inline bool ContainsTo(IntType ToID) const
143 {
144 checkSlow(ToID >= 0);
146 return ReverseMap.Contains(ToID);
147 }
148
149
151 inline IntType GetTo(IntType FromID) const
152 {
153 checkSlow(FromID >= 0);
155 const IntType* FoundVal = ForwardMap.Find(FromID);
156 return (FoundVal == nullptr) ? UnmappedID() : *FoundVal;
157 }
158
160 inline IntType GetFrom(IntType ToID) const
161 {
162 checkSlow(ToID >= 0);
164 const IntType* FoundVal = ReverseMap.Find(ToID);
165 return (FoundVal == nullptr) ? UnmappedID() : *FoundVal;
166 }
167
169 inline const IntType* FindTo(IntType FromID) const
170 {
171 checkSlow(FromID >= 0);
173 return ForwardMap.Find(FromID);
174 }
175
177 inline const IntType* FindFrom(IntType ToID) const
178 {
179 checkSlow(ToID >= 0);
181 return ReverseMap.Find(ToID);
182 }
183
184
185 void Reserve(int NumElements)
186 {
187 checkSlow(NumElements >= 0);
188 if (bWantForward)
189 {
190 ForwardMap.Reserve(NumElements);
191 }
192 if (bWantReverse)
193 {
194 ReverseMap.Reserve(NumElements);
195 }
196 }
197
199 {
200 return ForwardMap.GetAllocatedSize() + ReverseMap.GetAllocatedSize();
201 }
202};
203
205
206
207} // end namespace UE::Geometry
208} // end namespace UE
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition UnrealString.h.inl:34
EOperationValidationResult
Definition GeometryTypes.h:59
EMeshResult
Definition GeometryTypes.h:18
EValidityCheckFailMode
Definition GeometryTypes.h:72
TIndexMap< int > FIndexMapi
Definition GeometryTypes.h:204
Definition AdvancedWidgetsModule.cpp:13
Definition GeometryTypes.h:96
IntType GetFrom(IntType ToID) const
Definition GeometryTypes.h:160
void Reserve(int NumElements)
Definition GeometryTypes.h:185
TMap< IntType, IntType > & GetReverseMap()
Definition GeometryTypes.h:122
bool ContainsFrom(IntType FromID) const
Definition GeometryTypes.h:134
TMap< IntType, IntType > ReverseMap
Definition GeometryTypes.h:99
TMap< IntType, IntType > ForwardMap
Definition GeometryTypes.h:98
SIZE_T GetAllocatedSize() const
Definition GeometryTypes.h:198
TMap< IntType, IntType > & GetForwardMap()
Definition GeometryTypes.h:119
const IntType * FindTo(IntType FromID) const
Definition GeometryTypes.h:169
const TMap< IntType, IntType > & GetForwardMap() const
Definition GeometryTypes.h:120
const TMap< IntType, IntType > & GetReverseMap() const
Definition GeometryTypes.h:123
bool ContainsTo(IntType ToID) const
Definition GeometryTypes.h:142
const IntType * FindFrom(IntType ToID) const
Definition GeometryTypes.h:177
bool bWantReverse
Definition GeometryTypes.h:101
void Add(IntType FromID, IntType ToID)
Definition GeometryTypes.h:126
void Reset()
Definition GeometryTypes.h:110
TIndexMap()
Definition GeometryTypes.h:105
bool bWantForward
Definition GeometryTypes.h:100
IntType GetTo(IntType FromID) const
Definition GeometryTypes.h:151
constexpr IntType UnmappedID() const
Definition GeometryTypes.h:117