Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
A class representing an interval of integer values. More...
#include <bayeux/datatools/integer_range.h>
Public Types | |
typedef int32_t | value_type |
Public Member Functions | |
integer_range () | |
Default constructor. More... | |
integer_range (value_type from_, value_type 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 (value_type from_, range_bound_info_type policy_=range_bound_included) |
Set the lower bound. More... | |
void | set_upper (value_type to_, range_bound_info_type policy_=range_bound_included) |
Set the upper bound. More... | |
void | set (value_type from, value_type 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_singleton () const |
Check if the interval is degenerated (one unique value) 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... | |
value_type | get_lower_bound () const |
Return lower bound. More... | |
value_type | get_upper_bound () const |
Return upper bound. More... | |
uint64_t | count () const |
Return the number of values in the interval. More... | |
bool | is_empty () const |
Check if interval is empty. More... | |
void | make_empty () |
Build an empty interval. More... | |
void | make_full () |
Build a fully bounded interval. More... | |
void | make_full_positive () |
Build a fully bounded positive interval starting at 0. More... | |
void | make_full_negative () |
Build a fully bounded negative interval ending at 0. More... | |
void | make_upper_unbounded (value_type from_, bool inclusive_=true) |
Build a half bounded interval with no upper bound. More... | |
void | make_lower_unbounded (value_type to_, bool inclusive_=true) |
Build a half bounded interval with no lower bound. More... | |
void | make_bounded (value_type from_, value_type to_, bool lower_included_=true, bool upper_included_=true) |
Build a fully bounded interval with specific lower and upper bounds. More... | |
bool | has (value_type value) const |
Check if a value belongs to the interval. More... | |
bool | has (const integer_range &ir) const |
Check if an integer interval belongs to the interval. More... | |
void | dump (std::ostream &out=std::clog) const |
Basic print. More... | |
value_type | begin () const |
Return the first value from the fully bounded interval. More... | |
value_type | end () const |
Return the past-the-end value (not belonging) from the fully bounded interval. More... | |
value_type | first () const |
Return the first value belonging to the half lower bounded interval. More... | |
value_type | last () const |
Return the last value belonging to the half upper bounded interval. More... | |
int | compare (const integer_range &range_) const |
Compare intervals. More... | |
bool | operator< (const integer_range &range_) const |
Comparison operator. More... | |
bool | operator> (const integer_range &range_) const |
Comparison operator. More... | |
bool | operator== (const integer_range &range_) const |
Comparison operator. More... | |
void | make_canonical (integer_range &range_) const |
Build the associated canonical interval (with bounds flagged as included) More... | |
bool | intersect (const integer_range &range_, integer_range &inter_) const |
Check intersect with another interval and build the resulting intersection interval. More... | |
bool | intersect (const integer_range &range_) const |
Check intersect with another interval. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const integer_range &range_) |
Print operator. More... | |
std::istream & | operator>> (std::istream &in, integer_range &range_) |
Input operator. More... | |
A class representing an interval of integer values.
typedef int32_t datatools::integer_range::value_type |
datatools::integer_range::integer_range | ( | ) |
Default constructor.
datatools::integer_range::integer_range | ( | value_type | from_, |
value_type | to_, | ||
range_bound_info_type | from_policy_ = range_bound_included , |
||
range_bound_info_type | to_policy_ = range_bound_included |
||
) |
Constructor.
value_type datatools::integer_range::begin | ( | ) | const |
Return the first value from the fully bounded interval.
int datatools::integer_range::compare | ( | const integer_range & | range_ | ) | const |
Compare intervals.
uint64_t datatools::integer_range::count | ( | ) | const |
Return the number of values in the interval.
void datatools::integer_range::dump | ( | std::ostream & | out = std::clog | ) | const |
Basic print.
value_type datatools::integer_range::end | ( | ) | const |
Return the past-the-end value (not belonging) from the fully bounded interval.
value_type datatools::integer_range::first | ( | ) | const |
Return the first value belonging to the half lower bounded interval.
value_type datatools::integer_range::get_lower_bound | ( | ) | const |
Return lower bound.
value_type datatools::integer_range::get_upper_bound | ( | ) | const |
Return upper bound.
bool datatools::integer_range::has | ( | value_type | value | ) | const |
Check if a value belongs to the interval.
bool datatools::integer_range::has | ( | const integer_range & | ir | ) | const |
Check if an integer interval belongs to the interval.
bool datatools::integer_range::intersect | ( | const integer_range & | range_, |
integer_range & | inter_ | ||
) | const |
Check intersect with another interval and build the resulting intersection interval.
bool datatools::integer_range::intersect | ( | const integer_range & | range_ | ) | const |
Check intersect with another interval.
void datatools::integer_range::invalidate | ( | ) |
Invalidate the interval.
bool datatools::integer_range::is_bounded | ( | ) | const |
Check if both bounds are defined.
bool datatools::integer_range::is_empty | ( | ) | const |
Check if interval is empty.
bool datatools::integer_range::is_half_bounded | ( | ) | const |
Check if the intervalis half-bounded.
bool datatools::integer_range::is_lower_bounded | ( | ) | const |
Check if lower bound is defined.
bool datatools::integer_range::is_lower_included | ( | ) | const |
Check if lower bound is included.
bool datatools::integer_range::is_singleton | ( | ) | const |
Check if the interval is degenerated (one unique value)
bool datatools::integer_range::is_upper_bounded | ( | ) | const |
Check if upper bound is defined.
bool datatools::integer_range::is_upper_included | ( | ) | const |
Check if upper bound is included.
bool datatools::integer_range::is_valid | ( | ) | const |
Check the validity of the interval.
value_type datatools::integer_range::last | ( | ) | const |
Return the last value belonging to the half upper bounded interval.
void datatools::integer_range::make_bounded | ( | value_type | from_, |
value_type | to_, | ||
bool | lower_included_ = true , |
||
bool | upper_included_ = true |
||
) |
Build a fully bounded interval with specific lower and upper bounds.
void datatools::integer_range::make_canonical | ( | integer_range & | range_ | ) | const |
Build the associated canonical interval (with bounds flagged as included)
void datatools::integer_range::make_empty | ( | ) |
Build an empty interval.
void datatools::integer_range::make_full | ( | ) |
Build a fully bounded interval.
void datatools::integer_range::make_full_negative | ( | ) |
Build a fully bounded negative interval ending at 0.
void datatools::integer_range::make_full_positive | ( | ) |
Build a fully bounded positive interval starting at 0.
void datatools::integer_range::make_lower_unbounded | ( | value_type | to_, |
bool | inclusive_ = true |
||
) |
Build a half bounded interval with no lower bound.
void datatools::integer_range::make_upper_unbounded | ( | value_type | from_, |
bool | inclusive_ = true |
||
) |
Build a half bounded interval with no upper bound.
bool datatools::integer_range::operator< | ( | const integer_range & | range_ | ) | const |
Comparison operator.
bool datatools::integer_range::operator== | ( | const integer_range & | range_ | ) | const |
Comparison operator.
bool datatools::integer_range::operator> | ( | const integer_range & | range_ | ) | const |
Comparison operator.
void datatools::integer_range::reset | ( | ) |
Reset the interval.
void datatools::integer_range::reset_lower | ( | ) |
Reset lower bound.
void datatools::integer_range::reset_upper | ( | ) |
Reset upper bound.
void datatools::integer_range::set | ( | value_type | from, |
value_type | to, | ||
range_bound_info_type | from_policy = range_bound_included , |
||
range_bound_info_type | to_policy = range_bound_included |
||
) |
Set the bounds.
void datatools::integer_range::set_lower | ( | value_type | from_, |
range_bound_info_type | policy_ = range_bound_included |
||
) |
Set the lower bound.
void datatools::integer_range::set_upper | ( | value_type | to_, |
range_bound_info_type | policy_ = range_bound_included |
||
) |
Set the upper bound.
|
friend |
Print operator.
|
friend |
Input operator.