Represents a range of legal integer or floating-point values. More...
#include "dcNumericRange.h"
Public Types | |
typedef NUM | Number |
Public Member Functions | |
DCNumericRange (Number min, Number max) | |
DCNumericRange (const DCNumericRange ©) | |
bool | add_range (Number min, Number max) |
Adds a new minmax to the list of ranges. More... | |
void | clear () |
void | generate_hash (HashGenerator &hashgen) const |
Number | get_max (int n) const |
Returns the maximum value defined by the nth component. More... | |
Number | get_min (int n) const |
Returns the minimum value defined by the nth component. More... | |
int | get_num_ranges () const |
Returns the number of minmax components in the range description. More... | |
Number | get_one_value () const |
If has_one_value() returns true, this returns the one legal value accepted by the numeric range. More... | |
bool | has_one_value () const |
Returns true if the numeric range specifies exactly one legal value, false if multiple values are legal. More... | |
bool | is_empty () const |
Returns true if the range contains no elements (and thus allows all numbers), false if it contains at least one. More... | |
bool | is_in_range (Number num) const |
Returns true if the indicated number is within the specified range, false otherwise. More... | |
void | operator= (const DCNumericRange ©) |
void | output (std::ostream &out, Number divisor=1) const |
void | output_char (std::ostream &out, Number divisor=1) const |
Outputs the range, formatting the numeric values as quoted ASCII characters. More... | |
void | validate (Number num, bool &range_error) const |
Convenience function to validate the indicated number. More... | |
Represents a range of legal integer or floating-point values.
This is used to constrain simple numeric types, as well as array sizes.
Definition at line 26 of file dcNumericRange.h.
|
inline |
Adds a new minmax to the list of ranges.
This is normally called only during dc file parsing. Returns true if successful, or false if the new minmax overlaps an existing minmax.
Definition at line 183 of file dcNumericRange.I.
|
inline |
Returns the maximum value defined by the nth component.
Definition at line 241 of file dcNumericRange.I.
|
inline |
Returns the minimum value defined by the nth component.
Definition at line 231 of file dcNumericRange.I.
Referenced by DCArrayParameter::pack_default_value().
|
inline |
Returns the number of minmax components in the range description.
Definition at line 222 of file dcNumericRange.I.
Referenced by DCSimpleParameter::set_range().
|
inline |
If has_one_value() returns true, this returns the one legal value accepted by the numeric range.
Definition at line 100 of file dcNumericRange.I.
|
inline |
Returns true if the numeric range specifies exactly one legal value, false if multiple values are legal.
Definition at line 90 of file dcNumericRange.I.
|
inline |
Returns true if the range contains no elements (and thus allows all numbers), false if it contains at least one.
Definition at line 213 of file dcNumericRange.I.
Referenced by DCArrayParameter::pack_default_value().
|
inline |
Returns true if the indicated number is within the specified range, false otherwise.
Definition at line 56 of file dcNumericRange.I.
|
inline |
Outputs the range, formatting the numeric values as quoted ASCII characters.
Definition at line 148 of file dcNumericRange.I.
|
inline |
Convenience function to validate the indicated number.
If the number is within the specified range, does nothing; otherwise, if it is outside the range, sets range_error to true.
Definition at line 78 of file dcNumericRange.I.
Referenced by DCArrayParameter::validate_num_nested_fields().