Viskores  1.0
Public Member Functions | Public Attributes | List of all members
viskores::RangeId Struct Reference

Represent a range of viskores::Id values. More...

#include <RangeId.h>

Public Member Functions

 RangeId ()
 Construct a range with no indices. More...
 
 RangeId (viskores::Id min, viskores::Id max)
 Construct a range with the given minimum (inclusive) and maximum (exclusive) indices. More...
 
bool IsNonEmpty () const
 Determine if the range is valid. More...
 
bool Contains (viskores::Id value) const
 Determines if a value is within the range. More...
 
viskores::Id Length () const
 Returns the length of the range. More...
 
viskores::Id Center () const
 Returns the center of the range. More...
 
void Include (viskores::Id value)
 Expand range to include a value. More...
 
void Include (const viskores::RangeId &range)
 Expand range to include other range. More...
 
viskores::RangeId Union (const viskores::RangeId &other) const
 Return the union of this and another range. More...
 
viskores::RangeId operator+ (const viskores::RangeId &other) const
 Operator for union More...
 
bool operator== (const viskores::RangeId &other) const
 
bool operator!= (const viskores::RangeId &other) const
 

Public Attributes

viskores::Id Min
 The minimum index of the range (inclusive). More...
 
viskores::Id Max
 The maximum index of the range (exclusive). More...
 

Detailed Description

Represent a range of viskores::Id values.

viskores::RangeId is a helper class for representing a range of viskores::Id values. This is specified simply with a Min and Max value, where Max is exclusive.

RangeId also contains several helper functions for computing and maintaining the range.

Constructor & Destructor Documentation

◆ RangeId() [1/2]

viskores::RangeId::RangeId ( )
inline

Construct a range with no indices.

◆ RangeId() [2/2]

viskores::RangeId::RangeId ( viskores::Id  min,
viskores::Id  max 
)
inline

Construct a range with the given minimum (inclusive) and maximum (exclusive) indices.

Member Function Documentation

◆ Center()

viskores::Id viskores::RangeId::Center ( ) const
inline

Returns the center of the range.

Center computes the middle value of the range.

◆ Contains()

bool viskores::RangeId::Contains ( viskores::Id  value) const
inline

Determines if a value is within the range.

Contains returns true if the give value is within the range, false otherwise.

◆ Include() [1/2]

void viskores::RangeId::Include ( const viskores::RangeId range)
inline

Expand range to include other range.

This version of Include expands this range just enough to include that of another range. Essentially it is the union of the two ranges.

◆ Include() [2/2]

void viskores::RangeId::Include ( viskores::Id  value)
inline

Expand range to include a value.

This version of Include expands the range just enough to include the given value. If the range already includes this value, then nothing is done.

◆ IsNonEmpty()

bool viskores::RangeId::IsNonEmpty ( ) const
inline

Determine if the range is valid.

IsNonEmpty return true if the range contains some valid values between Min and Max. If Max <= Min, then no values satisfy the range and IsNonEmpty returns false. Otherwise, return true.

◆ Length()

viskores::Id viskores::RangeId::Length ( ) const
inline

Returns the length of the range.

Length computes the distance between the min and max. If the range is empty, 0 is returned.

◆ operator!=()

bool viskores::RangeId::operator!= ( const viskores::RangeId other) const
inline

◆ operator+()

viskores::RangeId viskores::RangeId::operator+ ( const viskores::RangeId other) const
inline

Operator for union

◆ operator==()

bool viskores::RangeId::operator== ( const viskores::RangeId other) const
inline

◆ Union()

viskores::RangeId viskores::RangeId::Union ( const viskores::RangeId other) const
inline

Return the union of this and another range.

This is a nondestructive form of Include.

Member Data Documentation

◆ Max

viskores::Id viskores::RangeId::Max

The maximum index of the range (exclusive).

◆ Min

viskores::Id viskores::RangeId::Min

The minimum index of the range (inclusive).


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