Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TRangeSet< ElementType > Class Template Reference

#include <RangeSet.h>

+ Collaboration diagram for TRangeSet< ElementType >:

Public Member Functions

 TRangeSet ()
 
 ~TRangeSet ()
 
void Add (RangeType Range)
 
void Merge (const TRangeSet &Other)
 
void Empty ()
 
bool Contains (ElementValueOrConstRef Element) const
 
bool Contains (const RangeType &Range) const
 
BoundsType GetMinBound () const
 
ElementType GetMinBoundValue () const
 
BoundsType GetMaxBound () const
 
ElementType GetMaxBoundValue () const
 
template<typename Allocator >
const void GetRanges (TArray< RangeType, Allocator > &OutRanges) const
 
bool HasMinBound () const
 
bool HasMaxBound () const
 
bool IsEmpty () const
 
bool Overlaps (const RangeType &Range) const
 
bool Overlaps (const TRangeSet &Other) const
 

Private Types

typedef TRangeBound< ElementType > BoundsType
 
typedef TRange< ElementType > RangeType
 
typedef TCallTraits< ElementType >::ParamType ElementValueOrConstRef
 

Private Attributes

TArray< RangeTypeRanges
 

Friends

class FArchiveoperator<< (class FArchive &Ar, TRangeSet &RangeSet)
 

Detailed Description

template<typename ElementType>
class TRangeSet< ElementType >

Template for range sets.

Todo
gmp: Implement more efficient storage of range sets

Definition at line 16 of file RangeSet.h.

Member Typedef Documentation

◆ BoundsType

template<typename ElementType >
typedef TRangeBound<ElementType> TRangeSet< ElementType >::BoundsType
private

Definition at line 18 of file RangeSet.h.

◆ ElementValueOrConstRef

template<typename ElementType >
typedef TCallTraits<ElementType>::ParamType TRangeSet< ElementType >::ElementValueOrConstRef
private

Definition at line 22 of file RangeSet.h.

◆ RangeType

template<typename ElementType >
typedef TRange<ElementType> TRangeSet< ElementType >::RangeType
private

Definition at line 19 of file RangeSet.h.

Constructor & Destructor Documentation

◆ TRangeSet()

template<typename ElementType >
TRangeSet< ElementType >::TRangeSet ( )
inline

Default constructor.

Definition at line 27 of file RangeSet.h.

◆ ~TRangeSet()

template<typename ElementType >
TRangeSet< ElementType >::~TRangeSet ( )
inline

Destructor.

Definition at line 30 of file RangeSet.h.

Member Function Documentation

◆ Add()

template<typename ElementType >
void TRangeSet< ElementType >::Add ( RangeType Range)
inline

Adds a range to the set.

This method merges overlapping ranges into a single range (i.e. {[1, 5], [4, 6]} becomes [1, 6]). Adjacent ranges (i.e. {[1, 4), [4, 6)} are also merged.

Parameters
RangeThe range to add.

Definition at line 42 of file RangeSet.h.

◆ Contains() [1/2]

template<typename ElementType >
bool TRangeSet< ElementType >::Contains ( const RangeType & Range) const
inline

Checks whether this set contains the specified range.

Parameters
RangeThe range to check.
Returns
true if the set contains the range, false otherwise.

Definition at line 138 of file RangeSet.h.

◆ Contains() [2/2]

template<typename ElementType >
bool TRangeSet< ElementType >::Contains ( ElementValueOrConstRef Element) const
inline

Checks whether this set contains the specified element.

Parameters
ElementThe element to check.
Returns
true if the element is in the set, false otherwise.

Definition at line 119 of file RangeSet.h.

◆ Empty()

template<typename ElementType >
void TRangeSet< ElementType >::Empty ( )
inline

Removes a range from the set.

Ranges that overlap with the removed range will be split.

Parameters
RangeThe range to remove. Removes all ranges from the set.

Definition at line 106 of file RangeSet.h.

◆ GetMaxBound()

template<typename ElementType >
BoundsType TRangeSet< ElementType >::GetMaxBound ( ) const
inline

Gets the range set's uppermost bound.

Returns
Uppermost bound.
See also
GetMaxBoundValue, GetMinBound, HasMaxBound

Definition at line 192 of file RangeSet.h.

◆ GetMaxBoundValue()

template<typename ElementType >
ElementType TRangeSet< ElementType >::GetMaxBoundValue ( ) const
inline

Gets the value of the uppermost bound.

Use HasMaxBound() to ensure that this range actually has an upper bound.

Returns
Bound value.
See also
GetMaxBound, GetMinBoundValue, HasMaxBound

Definition at line 216 of file RangeSet.h.

◆ GetMinBound()

template<typename ElementType >
BoundsType TRangeSet< ElementType >::GetMinBound ( ) const
inline

Gets the range set's lowest bound.

Returns
Lowest bound.
See also
GetMaxBound, GetMinBoundValue, HasMinBound

Definition at line 157 of file RangeSet.h.

◆ GetMinBoundValue()

template<typename ElementType >
ElementType TRangeSet< ElementType >::GetMinBoundValue ( ) const
inline

Gets the value of the lowest bound.

Use HasMinBound() to ensure that this range set actually has a lowest bound.

Returns
Bound value.
See also
GetMaxBoundValue, GetMinBound, HasMinBound

Definition at line 181 of file RangeSet.h.

◆ GetRanges()

template<typename ElementType >
template<typename Allocator >
const void TRangeSet< ElementType >::GetRanges ( TArray< RangeType, Allocator > & OutRanges) const
inline

Returns a read-only collection of the ranges contained in this set.

Parameters
AllocatorThe array allocator to use.
OutRangesWill contain the collection of ranges.

Definition at line 229 of file RangeSet.h.

◆ HasMaxBound()

template<typename ElementType >
bool TRangeSet< ElementType >::HasMaxBound ( ) const
inline

Checks whether the range has an uppermost bound.

Returns
true if the range has an uppermost bound, false otherwise.
See also
GetUpperBound, GetUpperBoundValue, HasMinBound

Definition at line 251 of file RangeSet.h.

◆ HasMinBound()

template<typename ElementType >
bool TRangeSet< ElementType >::HasMinBound ( ) const
inline

Checks whether the range has a lowest bound.

Returns
true if the range has a lowest bound, false otherwise.
See also
GetMinBound, GetMinBoundValue, HasMaxBound

Definition at line 240 of file RangeSet.h.

◆ IsEmpty()

template<typename ElementType >
bool TRangeSet< ElementType >::IsEmpty ( ) const
inline

Checks whether this range set is empty.

Returns
true if the range set is empty, false otherwise.

Definition at line 261 of file RangeSet.h.

◆ Merge()

template<typename ElementType >
void TRangeSet< ElementType >::Merge ( const TRangeSet< ElementType > & Other)
inline

Merges another range set into this set.

Parameters
OtherThe range set to merge.

Definition at line 67 of file RangeSet.h.

◆ Overlaps() [1/2]

template<typename ElementType >
bool TRangeSet< ElementType >::Overlaps ( const RangeType & Range) const
inline

Checks whether this range set overlaps with the specified range.

Parameters
RangeThe range to check.
Returns
true if this set overlaps with the range, false otherwise.

Definition at line 272 of file RangeSet.h.

◆ Overlaps() [2/2]

template<typename ElementType >
bool TRangeSet< ElementType >::Overlaps ( const TRangeSet< ElementType > & Other) const
inline

Checks whether this range set overlaps with another.

Parameters
OtherThe other range set.
Returns
true if the range sets overlap, false otherwise.
Todo
gmp: This could be optimized to O(n*logn) using a line sweep on a pre-sorted array of bounds.

Definition at line 293 of file RangeSet.h.

Friends And Related Symbol Documentation

◆ operator<<

template<typename ElementType >
class FArchive & operator<< ( class FArchive & Ar,
TRangeSet< ElementType > & RangeSet )
friend

Serializes the given range set from or into the specified archive.

Parameters
ArThe archive to serialize from or into.
RangeSetThe range set to serialize.
Returns
The archive.

Definition at line 315 of file RangeSet.h.

Member Data Documentation

◆ Ranges

template<typename ElementType >
TArray<RangeType> TRangeSet< ElementType >::Ranges
private

Holds the set of ranges.

Definition at line 323 of file RangeSet.h.


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