IDS peak ICV v1.6.0
Loading...
Searching...
No Matches
RangeT< T > Class Template Reference

Public Member Functions

 RangeT (T minimum, T maximum, T increment)
 Initializes a new instance of the RangeT<T> class with specified minimum, maximum, and increment values.
 
T Clamp (T value)
 Clamps a value to the bounds of this range.
 
T Constrain (T value)
 Returns a value that is constrained to this range.
 
override bool Equals (object? obj)
 Determines whether the specified object is equal to the current range.
 
override int GetHashCode ()
 Returns a hash code for the current range.
 
override string ToString ()
 Returns a string representation of the range.
 

Properties

T Minimum [get]
 Gets the lower boundary of the range.
 
T Maximum [get]
 Gets the upper boundary of the range.
 
T Increment [get]
 Gets the increment value associated with this range.
 

Detailed Description

Represents a numeric range with defined boundaries and a fixed increment. A Range models a continuous sequence of values starting from a minimum value, ending at a maximum value, and progressing in steps defined by an increment. It supports integers and floating-point numbers. This class ensures that the increment does not exceed the total span between the minimum and maximum bounds. The range is inclusive of its boundary values.

Template Parameters
TThe type of the parameters. Must be a value type implementing IComparable.
Since
IDSImaging.Peak.Common 1.3
Type Constraints
T :struct 
T :IComparable<T> 

Constructor & Destructor Documentation

◆ RangeT()

RangeT ( T minimum,
T maximum,
T increment )
inline

Initializes a new instance of the RangeT<T> class with specified minimum, maximum, and increment values.

Parameters
minimumThe inclusive starting (lower) boundary of the range.
maximumThe inclusive ending (upper) boundary of the range.
incrementThe step size or increment between values within the range.
Exceptions
CommonInvalidParameterExceptionThrown when minimum is greater than maximum or when increment is larger than the total range.

Member Function Documentation

◆ Clamp()

T Clamp ( T value)
inline

Clamps a value to the bounds of this range.

Values below the minimum are adjusted to the minimum value, while values above the maximum are adjusted to the maximum value.

Parameters
valueThe value to clamp.
Returns
The clamped value within this range's boundaries.
Since
IDSImaging.Peak.Common 2.1

◆ Constrain()

T Constrain ( T value)
inline

Returns a value that is constrained to this range.

The value is adjusted to the nearest valid increment and clamped between the minimum and maximum boundaries of this range.

Parameters
valueThe value to constrain.
Returns
The constrained value.
Since
IDSImaging.Peak.Common 2.1

◆ Equals()

override bool Equals ( object? obj)
inline

Determines whether the specified object is equal to the current range.

Parameters
objThe object to compare with the current range.
Returns
true if the specified object is equal to the current range; otherwise, false.

◆ GetHashCode()

override int GetHashCode ( )
inline

Returns a hash code for the current range.

◆ ToString()

override string ToString ( )
inline

Returns a string representation of the range.

Property Documentation

◆ Increment

T Increment
get

Gets the increment value associated with this range.

◆ Maximum

T Maximum
get

Gets the upper boundary of the range.

◆ Minimum

T Minimum
get

Gets the lower boundary of the range.