ICF 3.0.5.47
Technical documentation of ICF Libraries
istd::TRange< ValueType > Class Template Reference

Implementation of a abstract range defined by two values - minimum and maximum. More...

#include <TRange.h>

Collaboration diagram for istd::TRange< ValueType >:

Public Member Functions

 TRange ()
 Constructs an empty range object.
 
 TRange (const TRange &range)
 Copy constructor.
 
 TRange (ValueType minValue, ValueType maxValue)
 Constructs a range object from two numbers.
 
bool IsValid () const
 Return true if the bottom value is smaller or equal then the top value.
 
bool IsEmpty () const
 Return true if the bottom value is equal to the top value.
 
bool IsValidNonEmpty () const
 Return true if the range is valid and it is not empty.
 
ValueType GetMinValue () const
 Get the bottom value.
 
ValueType & GetMinValueRef ()
 Get reference to the bottom value.
 
void SetMinValue (ValueType minValue)
 Set the bottom value.
 
ValueType GetMaxValue () const
 Get the top value.
 
ValueType & GetMaxValueRef ()
 Get reference to the top value.
 
void SetMaxValue (ValueType maxValue)
 Set the top value.
 
void Reset ()
 Set this range to be empty.
 
ValueType GetLength () const
 Get length of this range.
 
TRange GetValidated () const
 Get validated range, if it was invalid.
 
void GetValidated (TRange &result) const
 Get validated range, if it was invalid.
 
void Validate ()
 Force this range to be valid.
 
bool Contains (ValueType value) const
 Returns true, if value is in range between top and bottom.
 
bool Contains (const TRange &range) const
 Returns true, if this range is inside of the range.
 
bool IsIntersectedBy (const TRange &range) const
 Check if this range is intersected by other range.
 
bool IsOutsideOf (const TRange &range) const
 Check if this range is outside of the given range.
 
TRange GetTranslated (ValueType offset) const
 Get translated position range.
 
void Translate (ValueType offset)
 Translated position of this range.
 
TRange GetIntersection (const TRange &range) const
 Get intersection with the second range.
 
void Intersection (const TRange &range)
 Set this range to be intersection of two ranges.
 
TRange GetUnion (const TRange &range) const
 Get union with the second range.
 
TRange GetUnion (ValueType value) const
 Get union with the second range.
 
void Unite (const TRange &range)
 Set this range to be union of two ranges.
 
void Unite (ValueType value)
 Set this range to be union of two ranges.
 
TRange GetExpanded (const TRange &range) const
 Get expanded range using the second range.
 
void Expand (const TRange &range)
 Set this range to be expanded.
 
ValueType GetDistance (ValueType value) const
 Get distance from value to range.
 
ValueType GetNearestInside (ValueType value) const
 Get nearest value belonging to range.
 
ValueType GetClipped (ValueType value) const
 Get value clipped to the range.
 
TRange GetClipped (const TRange &range) const
 Get range clipped to the current range.
 
ValueType GetValueFromAlpha (double alpha) const
 Get value based on 'alpha' factor.
 
double GetAlphaFromValue (ValueType value) const
 Get value based on 'alpha' factor.
 
ValueType GetMappedTo (ValueType value, const TRange &range) const
 Returns the value, that corresponds the input value inputValue in the other range range.
 
TRange GetApply (const TRange &range) const
 Get a combined range.
 
TRange GetInvertApply (const TRange &range) const
 
TRange GetInverted () const
 
void SetInterpolated (const TRange &first, const TRange &second, double alpha)
 Set this range to be linear interpolated using two other ranges and adjast alpha value.
 
TRangeoperator= (const TRange &range)
 
bool operator== (const TRange &range) const
 
bool operator!= (const TRange &range) const
 
TRange operator* (double value) const
 
TRange operator/ (double value) const
 
TRangeoperator*= (double value)
 
TRangeoperator/= (double value)
 

Static Public Member Functions

static constexpr TRangeGetNull ()
 Return null range.
 
static constexpr TRangeGetInvalid ()
 Return invalid range.
 
static TRange GetValid (ValueType value1, ValueType value2)
 Return always valid range.
 

Detailed Description

template<typename ValueType>
class istd::TRange< ValueType >

Implementation of a abstract range defined by two values - minimum and maximum.

Definition at line 21 of file TRange.h.

Constructor & Destructor Documentation

◆ TRange() [1/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( )

Constructs an empty range object.

IsEmpty() will return true for this object.

Definition at line 290 of file TRange.h.

◆ TRange() [2/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( const TRange< ValueType > & range)

Copy constructor.

Definition at line 298 of file TRange.h.

◆ TRange() [3/3]

template<typename ValueType >
istd::TRange< ValueType >::TRange ( ValueType minValue,
ValueType maxValue )

Constructs a range object from two numbers.

Definition at line 306 of file TRange.h.

Member Function Documentation

◆ Contains() [1/2]

template<typename ValueType >
bool istd::TRange< ValueType >::Contains ( const TRange< ValueType > & range) const
inline

Returns true, if this range is inside of the range.

Definition at line 425 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

◆ Contains() [2/2]

template<typename ValueType >
bool istd::TRange< ValueType >::Contains ( ValueType value) const
inline

Returns true, if value is in range between top and bottom.

This range must be valid.

Definition at line 416 of file TRange.h.

Referenced by i2d::CRect::IsInside(), i2d::CRect::IsInside(), and imeas::TMeasurementValue< ValueType >::SetErrorRange().

◆ Expand()

template<typename ValueType >
void istd::TRange< ValueType >::Expand ( const TRange< ValueType > & range)
inline

Set this range to be expanded.

Expanding operation calculate simple sum for each components separately.

Definition at line 566 of file TRange.h.

Referenced by i2d::CRect::Expand().

◆ GetAlphaFromValue()

template<typename ValueType >
double istd::TRange< ValueType >::GetAlphaFromValue ( ValueType value) const
inline

Get value based on 'alpha' factor.

Parameters
valueif it equals minimal range value than 0 value will be returned. If equals maximal range value than 1 value will be returned. Rest values are linear interpolated.

Definition at line 642 of file TRange.h.

◆ GetApply()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetApply ( const TRange< ValueType > & range) const

Get a combined range.

It calculates combined range. Range [0, 1] is neutral element of this operation.

Definition at line 656 of file TRange.h.

◆ GetClipped() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetClipped ( const TRange< ValueType > & range) const

◆ GetClipped() [2/2]

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetClipped ( ValueType value) const

Get value clipped to the range.

Definition at line 604 of file TRange.h.

Referenced by icmm::TColorGradient< GradientFunction >::GetValueAt().

◆ GetDistance()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetDistance ( ValueType value) const
inline

Get distance from value to range.

Distance is the smallest absolute value difference of given value and the values belonging to range.

Definition at line 574 of file TRange.h.

◆ GetExpanded()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetExpanded ( const TRange< ValueType > & range) const
inline

Get expanded range using the second range.

Expanding operation calculate simple sum for each components separately.

Definition at line 559 of file TRange.h.

◆ GetIntersection()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetIntersection ( const TRange< ValueType > & range) const
inline

Get intersection with the second range.

Definition at line 464 of file TRange.h.

◆ GetInvalid()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::GetInvalid ( )
inlinestaticconstexpr

Return invalid range.

Definition at line 790 of file TRange.h.

◆ GetInvertApply()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetInvertApply ( const TRange< ValueType > & range) const

Definition at line 667 of file TRange.h.

◆ GetInverted()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetInverted ( ) const

Definition at line 680 of file TRange.h.

◆ GetLength()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetLength ( ) const
inline

Get length of this range.

Length is difference between top and bottom values.

Definition at line 385 of file TRange.h.

Referenced by i2d::CRect::GetCenter(), i2d::CRect::GetHeight(), istd::TRange< ValueType >::GetMappedTo(), i2d::CRect::GetRectangle(), i2d::CRect::GetSize(), and i2d::CRect::GetWidth().

◆ GetMappedTo()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetMappedTo ( ValueType value,
const TRange< ValueType > & range ) const
inline

Returns the value, that corresponds the input value inputValue in the other range range.

It is the same as range.GetValueFromAlpha(GetAlphaFromValue(value)).

Parameters
valuevalue definde in this range. If it is equal to minimum value in this range, it will be mapped to minimum value of range. If it is equal to maximum value in this range, it will be mapped to maximum value of range. Rest values are linear interpolated.
Note
This value must be in current range.

Definition at line 649 of file TRange.h.

References istd::TRange< ValueType >::GetLength(), and istd::TRange< ValueType >::GetMinValue().

◆ GetMaxValue()

◆ GetMaxValueRef()

template<typename ValueType >
ValueType & istd::TRange< ValueType >::GetMaxValueRef ( )
inline

Get reference to the top value.

Definition at line 363 of file TRange.h.

◆ GetMinValue()

◆ GetMinValueRef()

template<typename ValueType >
ValueType & istd::TRange< ValueType >::GetMinValueRef ( )
inline

Get reference to the bottom value.


Definition at line 342 of file TRange.h.

◆ GetNearestInside()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetNearestInside ( ValueType value) const
inline

Get nearest value belonging to range.

Definition at line 589 of file TRange.h.

◆ GetNull()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::GetNull ( )
inlinestaticconstexpr

Return null range.

Definition at line 783 of file TRange.h.

◆ GetTranslated()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetTranslated ( ValueType offset) const
inline

Get translated position range.

Translation adds the offset value to minimal and mavimal values.

Definition at line 449 of file TRange.h.

◆ GetUnion() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetUnion ( const TRange< ValueType > & range) const

Get union with the second range.

Definition at line 491 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

◆ GetUnion() [2/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetUnion ( ValueType value) const

Get union with the second range.

Definition at line 508 of file TRange.h.

◆ GetValid()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetValid ( ValueType value1,
ValueType value2 )
inlinestatic

Return always valid range.

Definition at line 774 of file TRange.h.

◆ GetValidated() [1/2]

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::GetValidated ( ) const
inline

Get validated range, if it was invalid.

Range is invalid if set min value is bigger than set max value. It returns range with smaller range value as minimum and bigger one as maximum.

Definition at line 392 of file TRange.h.

◆ GetValidated() [2/2]

template<typename ValueType >
void istd::TRange< ValueType >::GetValidated ( TRange< ValueType > & result) const
inline

Get validated range, if it was invalid.

Range is invalid if set min value is bigger than set max value. It returns range with smaller range value as minimum and bigger one as maximum.

Definition at line 401 of file TRange.h.

References istd::TRange< ValueType >::SetMaxValue(), and istd::TRange< ValueType >::SetMinValue().

◆ GetValueFromAlpha()

template<typename ValueType >
ValueType istd::TRange< ValueType >::GetValueFromAlpha ( double alpha) const
inline

Get value based on 'alpha' factor.

Parameters
alphaalpha factor. If it is 0, minimum range value will be returned. If it is 1, maximum range value will be returned. Rest values are linear interpolated.

Definition at line 635 of file TRange.h.

◆ Intersection()

template<typename ValueType >
void istd::TRange< ValueType >::Intersection ( const TRange< ValueType > & range)

Set this range to be intersection of two ranges.

Definition at line 476 of file TRange.h.

Referenced by i2d::CRect::Intersection().

◆ IsEmpty()

template<typename ValueType >
bool istd::TRange< ValueType >::IsEmpty ( ) const
inline

Return true if the bottom value is equal to the top value.

Definition at line 321 of file TRange.h.

Referenced by i2d::CRect::IsEmpty(), istd::TRanges< ValueType >::TRanges(), and istd::TRanges< ValueType >::Union().

◆ IsIntersectedBy()

template<typename ValueType >
bool istd::TRange< ValueType >::IsIntersectedBy ( const TRange< ValueType > & range) const
inline

Check if this range is intersected by other range.

Some range is intersected by another, if intercestion of this two ranges is not empty.

Definition at line 435 of file TRange.h.

◆ IsOutsideOf()

template<typename ValueType >
bool istd::TRange< ValueType >::IsOutsideOf ( const TRange< ValueType > & range) const
inline

Check if this range is outside of the given range.

Definition at line 442 of file TRange.h.

Referenced by i2d::CRect::IsOutside().

◆ IsValid()

template<typename ValueType >
bool istd::TRange< ValueType >::IsValid ( ) const
inline

Return true if the bottom value is smaller or equal then the top value.

Definition at line 314 of file TRange.h.

Referenced by istd::TRange< ValueType >::Contains(), istd::TRange< ValueType >::GetUnion(), i2d::CRect::Intersection(), i2d::CRect::IsValid(), and istd::TRange< ValueType >::Unite().

◆ IsValidNonEmpty()

template<typename ValueType >
bool istd::TRange< ValueType >::IsValidNonEmpty ( ) const
inline

Return true if the range is valid and it is not empty.

Definition at line 328 of file TRange.h.

Referenced by i2d::CRect::IsValidNonEmpty().

◆ operator!=()

template<typename ValueType >
bool istd::TRange< ValueType >::operator!= ( const TRange< ValueType > & range) const
inline

Definition at line 710 of file TRange.h.

◆ operator*()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::operator* ( double value) const
inline

Definition at line 728 of file TRange.h.

◆ operator*=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator*= ( double value)
inline

Definition at line 752 of file TRange.h.

◆ operator/()

template<typename ValueType >
TRange< ValueType > istd::TRange< ValueType >::operator/ ( double value) const
inline

Definition at line 740 of file TRange.h.

◆ operator/=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator/= ( double value)
inline

Definition at line 762 of file TRange.h.

◆ operator=()

template<typename ValueType >
TRange< ValueType > & istd::TRange< ValueType >::operator= ( const TRange< ValueType > & range)
inline

Definition at line 718 of file TRange.h.

◆ operator==()

template<typename ValueType >
bool istd::TRange< ValueType >::operator== ( const TRange< ValueType > & range) const
inline

Definition at line 703 of file TRange.h.

◆ Reset()

template<typename ValueType >
void istd::TRange< ValueType >::Reset ( )

Set this range to be empty.

Definition at line 377 of file TRange.h.

Referenced by i2d::CRect::Reset(), and imeas::TMeasurementValue< ValueType >::TMeasurementValue().

◆ SetInterpolated()

template<typename ValueType >
void istd::TRange< ValueType >::SetInterpolated ( const TRange< ValueType > & first,
const TRange< ValueType > & second,
double alpha )

Set this range to be linear interpolated using two other ranges and adjast alpha value.

Definition at line 693 of file TRange.h.

◆ SetMaxValue()

template<typename ValueType >
void istd::TRange< ValueType >::SetMaxValue ( ValueType maxValue)
inline

◆ SetMinValue()

template<typename ValueType >
void istd::TRange< ValueType >::SetMinValue ( ValueType minValue)
inline

◆ Translate()

template<typename ValueType >
void istd::TRange< ValueType >::Translate ( ValueType offset)
inline

Translated position of this range.

Translation adds the offset value to minimal and mavimal values.

Definition at line 456 of file TRange.h.

◆ Unite() [1/2]

template<typename ValueType >
void istd::TRange< ValueType >::Unite ( const TRange< ValueType > & range)

Set this range to be union of two ranges.

Definition at line 520 of file TRange.h.

References istd::TRange< ValueType >::IsValid().

Referenced by i2d::CRect::GetUnion(), and i2d::CRect::Union().

◆ Unite() [2/2]

template<typename ValueType >
void istd::TRange< ValueType >::Unite ( ValueType value)

Set this range to be union of two ranges.

Definition at line 540 of file TRange.h.

◆ Validate()

template<typename ValueType >
void istd::TRange< ValueType >::Validate ( )
inline

Force this range to be valid.

Range is invalid if set min value is bigger than set max value. It set smaller range value as minimum and bigger one as maximum.

Definition at line 409 of file TRange.h.


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

© Witold Gantzke and Kirill Lepskiy