UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Geometry::FOptionallySparseIndexMap Struct Reference

#include <SparseIndexCollectionTypes.h>

Public Types

enum class  EMapType : uint8 { Dense , Sparse , ScaleAndOffset }
 

Public Member Functions

 FOptionallySparseIndexMap ()
 
 FOptionallySparseIndexMap (EMapType MapType, int MaxIndex=-1)
 
 FOptionallySparseIndexMap (TArray< int > Dense, int MaxIndex=-1)
 
 FOptionallySparseIndexMap (int MaxIndex, int SubsetCountEst)
 
void Initialize (int MaxIndexIn, int SubsetCountEst)
 
void InitDefaults ()
 
bool BadIndex (int Index) const
 
bool Contains (int Index)
 
const int operator[] (int Index) const
 
void Unset (int Index)
 
void Set (int Index, int Value)
 
void SetInvalid (int Index)
 

Static Public Member Functions

static FOptionallySparseIndexMap IdentityMap (int MaxIndex=-1)
 
static FOptionallySparseIndexMap ConstantMap (int ConstantValue, int MaxIndex=-1)
 
static FOptionallySparseIndexMap SparseIdentityMap (int MaxIndex=-1)
 

Public Attributes

TArray< int > Dense
 
TMap< int, int > Sparse
 
int DefaultOffset = -1
 
int DefaultScale = 0
 
int MaxIndex = -1
 
EMapType MapType = EMapType::Sparse
 

Detailed Description

Index map that supports dense or sparse storage, or a simple formula-based map (e.g. constant, identity, shift) For dense and sparse, the formula can be used to set default values.

Member Enumeration Documentation

◆ EMapType

Enumerator
Dense 
Sparse 
ScaleAndOffset 

Constructor & Destructor Documentation

◆ FOptionallySparseIndexMap() [1/4]

UE::Geometry::FOptionallySparseIndexMap::FOptionallySparseIndexMap ( )
inline

default constructor sets map to sparse, w/ constant -1 default value

◆ FOptionallySparseIndexMap() [2/4]

UE::Geometry::FOptionallySparseIndexMap::FOptionallySparseIndexMap ( EMapType  MapType,
int  MaxIndex = -1 
)
inline

construct map with explicit choice of storage type

◆ FOptionallySparseIndexMap() [3/4]

UE::Geometry::FOptionallySparseIndexMap::FOptionallySparseIndexMap ( TArray< int >  Dense,
int  MaxIndex = -1 
)
inline

construct map with dense storage copied from an existing array

◆ FOptionallySparseIndexMap() [4/4]

UE::Geometry::FOptionallySparseIndexMap::FOptionallySparseIndexMap ( int  MaxIndex,
int  SubsetCountEst 
)
inline

construct map with automatically-chosen dense or sparse storage, based on max index and estimated element count

Member Function Documentation

◆ BadIndex()

bool UE::Geometry::FOptionallySparseIndexMap::BadIndex ( int  Index) const
inline
Returns
true if a given Index is invalid (below zero or above MaxIndex if MaxIndex is valid)

◆ ConstantMap()

static FOptionallySparseIndexMap UE::Geometry::FOptionallySparseIndexMap::ConstantMap ( int  ConstantValue,
int  MaxIndex = -1 
)
inlinestatic
Returns
a constant map

◆ Contains()

bool UE::Geometry::FOptionallySparseIndexMap::Contains ( int  Index)
inline

dense variant: returns true unless you have set index to InvalidIndex (eg via SetToInvalid) sparse variant: returns true if index is in map or default index is >= 0 scaleandoffset variant: returns true if default index is >= 0 all return false if index is out-of-bounds

◆ IdentityMap()

static FOptionallySparseIndexMap UE::Geometry::FOptionallySparseIndexMap::IdentityMap ( int  MaxIndex = -1)
inlinestatic
Returns
an identity map

◆ InitDefaults()

void UE::Geometry::FOptionallySparseIndexMap::InitDefaults ( )
inline

◆ Initialize()

void UE::Geometry::FOptionallySparseIndexMap::Initialize ( int  MaxIndexIn,
int  SubsetCountEst 
)
inline

Automatically choose sparse or dense storage based on use estimate

◆ operator[]()

const int UE::Geometry::FOptionallySparseIndexMap::operator[] ( int  Index) const
inline

Array-style accessor to the map

◆ Set()

void UE::Geometry::FOptionallySparseIndexMap::Set ( int  Index,
int  Value 
)
inline

Sets the map at a given index. Do not call if MapType is ScaleAndOffset.

◆ SetInvalid()

void UE::Geometry::FOptionallySparseIndexMap::SetInvalid ( int  Index)
inline
Parameters
IndexExplicitly sets the given index to Invalid (not default). Do not call if MapType is ScaleAndOffset.

◆ SparseIdentityMap()

static FOptionallySparseIndexMap UE::Geometry::FOptionallySparseIndexMap::SparseIdentityMap ( int  MaxIndex = -1)
inlinestatic
Returns
a sparsely-overriden an identity map; elements not explicitly set are identity

◆ Unset()

void UE::Geometry::FOptionallySparseIndexMap::Unset ( int  Index)
inline
Parameters
Indexthis index will be unset in map, restoring the default mapping (Index -> Index*DefaultScale + DefaultOffset)

Member Data Documentation

◆ DefaultOffset

int UE::Geometry::FOptionallySparseIndexMap::DefaultOffset = -1

◆ DefaultScale

int UE::Geometry::FOptionallySparseIndexMap::DefaultScale = 0

◆ Dense

TArray<int> UE::Geometry::FOptionallySparseIndexMap::Dense

◆ MapType

EMapType UE::Geometry::FOptionallySparseIndexMap::MapType = EMapType::Sparse

◆ MaxIndex

int UE::Geometry::FOptionallySparseIndexMap::MaxIndex = -1

◆ Sparse

TMap<int, int> UE::Geometry::FOptionallySparseIndexMap::Sparse

The documentation for this struct was generated from the following file: