Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A class representing an interval of real (double precision) values with support of embedded units. More...
#include <bayeux/datatools/real_range.h>
Public Member Functions | |
real_range () | |
Default constructor. More... | |
real_range (double from_, double to_, range_bound_info_type from_policy_=range_bound_included, range_bound_info_type to_policy_=range_bound_included) | |
Constructor. More... | |
bool | is_valid () const |
Check the validity of the interval. More... | |
void | invalidate () |
Invalidate the interval. More... | |
void | reset_lower () |
Reset lower bound. More... | |
void | reset_upper () |
Reset upper bound. More... | |
void | reset () |
Reset the interval. More... | |
void | set_lower (double from_, range_bound_info_type policy_=range_bound_included) |
Set the lower bound. More... | |
void | set_upper (double to_, range_bound_info_type policy_=range_bound_included) |
Set the upper bound. More... | |
void | set (double from_, double to_, range_bound_info_type from_policy_=range_bound_included, range_bound_info_type to_policy_=range_bound_included) |
Set the bounds. More... | |
bool | is_lower_bounded () const |
Check if lower bound is defined. More... | |
bool | is_upper_bounded () const |
Check if upper bound is defined. More... | |
bool | is_half_bounded () const |
Check if the intervalis half-bounded. More... | |
bool | is_bounded () const |
Check if both bounds are defined. More... | |
bool | is_lower_included () const |
Check if lower bound is included. More... | |
bool | is_upper_included () const |
Check if upper bound is included. More... | |
double | get_lower () const |
Return lower bound. More... | |
double | get_upper () const |
Return upper bound. More... | |
double | width (double tolerance_=-1.0) const |
Return the width of the interval. More... | |
bool | is_empty (double tolerance_=-1.0) const |
Check if interval is empty. More... | |
bool | is_singleton (double tolerance_=-1.0) const |
Check if the interval is degenerated (one unique value) More... | |
double | singleton (double tolerance_=-1.0) const |
Return the singleton value. More... | |
void | make_singleton (double) |
Build a singleton. More... | |
void | make_empty () |
Build an empty interval. More... | |
void | make_positive_unbounded () |
Build a fully bounded positive interval starting at 0. More... | |
void | make_negative_unbounded () |
Build a fully bounded negative interval ending at 0. More... | |
void | make_upper_unbounded (double from_, bool inclusive_=true) |
Build a half bounded interval with no upper bound. More... | |
void | make_lower_unbounded (double to_, bool inclusive_=true) |
Build a half bounded interval with no lower bound. More... | |
void | make_unbounded () |
Build a full unbounded interval with no lower or upper bounds. More... | |
void | make_bounded (double from_, double to_, bool lower_included_=true, bool upper_included_=true) |
Build a fully bounded interval with specific lower and upper bounds. More... | |
bool | has (double value_, double tolerance_=-1.0) const |
Check if a value belongs to the interval. More... | |
bool | has (const real_range &rr_, double tolerance_=-1.0) const |
Check if an real interval belongs to the interval. More... | |
void | dump (std::ostream &out_=std::clog, double tolerance_=-1.0) const |
Basic print. More... | |
double | first (double tolerance_=-1.0) const |
Return the first value belonging to the half lower bounded interval. More... | |
double | last (double tolerance_=-1.0) const |
Return the last value belonging to the half upper bounded interval. More... | |
bool | has_unit_label () const |
Check if unit label is set. More... | |
void | set_unit_label (const std::string &) |
Set the unit label. More... | |
void | reset_unit_label () |
Reset the unit label. More... | |
const std::string & | get_unit_label () const |
Return the unit label. More... | |
bool | has_preferred_unit () const |
Check if the preferred unit label is set. More... | |
void | reset_preferred_unit () |
Reset the preferred unit symbol. More... | |
void | set_preferred_unit (const std::string &pus_) |
Set the preferred unit symbol. More... | |
const std::string & | get_preferred_unit () const |
Reset the preferred unit symbol. More... | |
int | compare (const real_range &range_) const |
Compare intervals. More... | |
bool | operator< (const real_range &range_) const |
Comparison operator. More... | |
bool | operator> (const real_range &range_) const |
Comparison operator. More... | |
bool | operator== (const real_range &range_) const |
Comparison operator. More... | |
Static Public Member Functions | |
static double | compute_tolerance (double lower_, double upper_, double relative_tolerance_=-1.0) |
Given a relative tolerance, compute the absolute tolerance associated to bounds. More... | |
Protected Member Functions | |
double | _effective_tolerance (double tolerance_) const |
Return an effective absolute tolerance. More... | |
void | _set_defaults () |
Set default attribute values. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out_, const real_range &range_) |
Print operator using the ISO_31-11 standard. More... | |
std::istream & | operator>> (std::istream &in_, real_range &range_) |
Input operator using the ISO_31-11 standard. More... | |
A class representing an interval of real (double precision) values with support of embedded units.
datatools::real_range::real_range | ( | ) |
Default constructor.
datatools::real_range::real_range | ( | double | from_, |
double | to_, | ||
range_bound_info_type | from_policy_ = range_bound_included , |
||
range_bound_info_type | to_policy_ = range_bound_included |
||
) |
Constructor.
|
protected |
Return an effective absolute tolerance.
|
protected |
Set default attribute values.
int datatools::real_range::compare | ( | const real_range & | range_ | ) | const |
Compare intervals.
|
static |
Given a relative tolerance, compute the absolute tolerance associated to bounds.
void datatools::real_range::dump | ( | std::ostream & | out_ = std::clog , |
double | tolerance_ = -1.0 |
||
) | const |
Basic print.
double datatools::real_range::first | ( | double | tolerance_ = -1.0 | ) | const |
Return the first value belonging to the half lower bounded interval.
double datatools::real_range::get_lower | ( | ) | const |
Return lower bound.
const std::string& datatools::real_range::get_preferred_unit | ( | ) | const |
Reset the preferred unit symbol.
const std::string& datatools::real_range::get_unit_label | ( | ) | const |
Return the unit label.
double datatools::real_range::get_upper | ( | ) | const |
Return upper bound.
bool datatools::real_range::has | ( | double | value_, |
double | tolerance_ = -1.0 |
||
) | const |
Check if a value belongs to the interval.
bool datatools::real_range::has | ( | const real_range & | rr_, |
double | tolerance_ = -1.0 |
||
) | const |
Check if an real interval belongs to the interval.
bool datatools::real_range::has_preferred_unit | ( | ) | const |
Check if the preferred unit label is set.
bool datatools::real_range::has_unit_label | ( | ) | const |
Check if unit label is set.
void datatools::real_range::invalidate | ( | ) |
Invalidate the interval.
bool datatools::real_range::is_bounded | ( | ) | const |
Check if both bounds are defined.
bool datatools::real_range::is_empty | ( | double | tolerance_ = -1.0 | ) | const |
Check if interval is empty.
bool datatools::real_range::is_half_bounded | ( | ) | const |
Check if the intervalis half-bounded.
bool datatools::real_range::is_lower_bounded | ( | ) | const |
Check if lower bound is defined.
bool datatools::real_range::is_lower_included | ( | ) | const |
Check if lower bound is included.
bool datatools::real_range::is_singleton | ( | double | tolerance_ = -1.0 | ) | const |
Check if the interval is degenerated (one unique value)
bool datatools::real_range::is_upper_bounded | ( | ) | const |
Check if upper bound is defined.
bool datatools::real_range::is_upper_included | ( | ) | const |
Check if upper bound is included.
bool datatools::real_range::is_valid | ( | ) | const |
Check the validity of the interval.
double datatools::real_range::last | ( | double | tolerance_ = -1.0 | ) | const |
Return the last value belonging to the half upper bounded interval.
void datatools::real_range::make_bounded | ( | double | from_, |
double | to_, | ||
bool | lower_included_ = true , |
||
bool | upper_included_ = true |
||
) |
Build a fully bounded interval with specific lower and upper bounds.
void datatools::real_range::make_empty | ( | ) |
Build an empty interval.
void datatools::real_range::make_lower_unbounded | ( | double | to_, |
bool | inclusive_ = true |
||
) |
Build a half bounded interval with no lower bound.
void datatools::real_range::make_negative_unbounded | ( | ) |
Build a fully bounded negative interval ending at 0.
void datatools::real_range::make_positive_unbounded | ( | ) |
Build a fully bounded positive interval starting at 0.
void datatools::real_range::make_singleton | ( | double | ) |
Build a singleton.
void datatools::real_range::make_unbounded | ( | ) |
Build a full unbounded interval with no lower or upper bounds.
void datatools::real_range::make_upper_unbounded | ( | double | from_, |
bool | inclusive_ = true |
||
) |
Build a half bounded interval with no upper bound.
bool datatools::real_range::operator< | ( | const real_range & | range_ | ) | const |
Comparison operator.
bool datatools::real_range::operator== | ( | const real_range & | range_ | ) | const |
Comparison operator.
bool datatools::real_range::operator> | ( | const real_range & | range_ | ) | const |
Comparison operator.
void datatools::real_range::reset | ( | ) |
Reset the interval.
void datatools::real_range::reset_lower | ( | ) |
Reset lower bound.
void datatools::real_range::reset_preferred_unit | ( | ) |
Reset the preferred unit symbol.
void datatools::real_range::reset_unit_label | ( | ) |
Reset the unit label.
void datatools::real_range::reset_upper | ( | ) |
Reset upper bound.
void datatools::real_range::set | ( | double | from_, |
double | to_, | ||
range_bound_info_type | from_policy_ = range_bound_included , |
||
range_bound_info_type | to_policy_ = range_bound_included |
||
) |
Set the bounds.
void datatools::real_range::set_lower | ( | double | from_, |
range_bound_info_type | policy_ = range_bound_included |
||
) |
Set the lower bound.
void datatools::real_range::set_preferred_unit | ( | const std::string & | pus_ | ) |
Set the preferred unit symbol.
void datatools::real_range::set_unit_label | ( | const std::string & | ) |
Set the unit label.
void datatools::real_range::set_upper | ( | double | to_, |
range_bound_info_type | policy_ = range_bound_included |
||
) |
Set the upper bound.
double datatools::real_range::singleton | ( | double | tolerance_ = -1.0 | ) | const |
Return the singleton value.
double datatools::real_range::width | ( | double | tolerance_ = -1.0 | ) | const |
Return the width of the interval.
|
friend |
Print operator using the ISO_31-11 standard.
|
friend |
Input operator using the ISO_31-11 standard.