SOIL C++
C++ Unified Device Interface
SOIL::Range< T > Class Template Reference

Range Helper Class. More...

#include <Range.h>

Public Member Functions

 Range ()
 Default Constructor. More...
 
 Range (T low, T high)
 Argument constructor. More...
 
 Range (std::vector< T > limits)
 List constructor. More...
 
 ~Range ()
 Destructor. More...
 
HTTP::Json wjson (void)
 HTTP JSON. More...
 
bool check (const T &value)
 Check. More...
 

Detailed Description

template<typename T>
class SOIL::Range< T >

Class to represent the acceptable range of a figure. This class is templated to be applicable to all types. For numerical values, the range indicates a lower and upper limit which may be validly assigned. The limit values are included. The same holds for times. For strings, it indicates the minimum and maximum length. For enumerations, this is a list of applicable choices. For these types, the template is explicitly implemented differently. The range can be explicitly unset to provide an easy default member implementation.

There is no set function, if the range changes, a new instance of this lightweight class should be created.

Template Parameters
TDatatype for which the range is defined

Definition at line 24 of file Range.h.

Constructor & Destructor Documentation

◆ Range() [1/3]

template<typename T >
SOIL::Range< T >::Range

Default Constructor, sets no limits and initializes set to false.

Definition at line 58 of file Range.cpp.

◆ Range() [2/3]

template<typename T >
SOIL::Range< T >::Range ( low,
high 
)

Constructs the range and initialized lower and upper limit with the provided values.

Parameters
[in]lowLower limit
[in]highUpper limit

Definition at line 151 of file Range.h.

◆ Range() [3/3]

template<typename T >
SOIL::Range< T >::Range ( std::vector< T >  limits)

Constructs the range and initialized lower and upper limit with the provided vector. This is constructor can be conveniently initialized with the list notation {low, high}.

Parameters
[in]limitsVector of length 2 for initialization

Definition at line 156 of file Range.h.

◆ ~Range()

template<typename T >
SOIL::Range< T >::~Range

Standard desctructor, no custom implementation.

Definition at line 68 of file Range.cpp.

Member Function Documentation

◆ check()

template<typename T >
bool SOIL::Range< T >::check ( const T &  value)

Check whether a given value is inside the prescribed range or not. If set is false, it always returns to true. The limits are included in the valid range, i.e. it is checked with <= and >=.

Parameters
[in]valueValue to check
Returns
Check result als boolean, i.e. true if in range

Definition at line 85 of file Range.cpp.

◆ wjson()

template<typename T >
HTTP::Json SOIL::Range< T >::wjson ( void  )

Returns the SOIL conformant partial representation of the range of Figure, i.e. null if not set.

Returns
JSON Object

Definition at line 72 of file Range.cpp.


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