Bayeux  3.4.1
Core Foundation library for SuperNEMO
Public Types | Public Member Functions | Friends | List of all members
datatools::integer_range Class Reference

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...
 

Detailed Description

A class representing an interval of integer values.

Member Typedef Documentation

◆ value_type

Constructor & Destructor Documentation

◆ integer_range() [1/2]

datatools::integer_range::integer_range ( )

Default constructor.

◆ integer_range() [2/2]

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.

Member Function Documentation

◆ begin()

value_type datatools::integer_range::begin ( ) const

Return the first value from the fully bounded interval.

◆ compare()

int datatools::integer_range::compare ( const integer_range range_) const

Compare intervals.

◆ count()

uint64_t datatools::integer_range::count ( ) const

Return the number of values in the interval.

◆ dump()

void datatools::integer_range::dump ( std::ostream &  out = std::clog) const

Basic print.

◆ end()

value_type datatools::integer_range::end ( ) const

Return the past-the-end value (not belonging) from the fully bounded interval.

◆ first()

value_type datatools::integer_range::first ( ) const

Return the first value belonging to the half lower bounded interval.

◆ get_lower_bound()

value_type datatools::integer_range::get_lower_bound ( ) const

Return lower bound.

◆ get_upper_bound()

value_type datatools::integer_range::get_upper_bound ( ) const

Return upper bound.

◆ has() [1/2]

bool datatools::integer_range::has ( value_type  value) const

Check if a value belongs to the interval.

◆ has() [2/2]

bool datatools::integer_range::has ( const integer_range ir) const

Check if an integer interval belongs to the interval.

◆ intersect() [1/2]

bool datatools::integer_range::intersect ( const integer_range range_,
integer_range inter_ 
) const

Check intersect with another interval and build the resulting intersection interval.

◆ intersect() [2/2]

bool datatools::integer_range::intersect ( const integer_range range_) const

Check intersect with another interval.

◆ invalidate()

void datatools::integer_range::invalidate ( )

Invalidate the interval.

◆ is_bounded()

bool datatools::integer_range::is_bounded ( ) const

Check if both bounds are defined.

◆ is_empty()

bool datatools::integer_range::is_empty ( ) const

Check if interval is empty.

◆ is_half_bounded()

bool datatools::integer_range::is_half_bounded ( ) const

Check if the intervalis half-bounded.

◆ is_lower_bounded()

bool datatools::integer_range::is_lower_bounded ( ) const

Check if lower bound is defined.

◆ is_lower_included()

bool datatools::integer_range::is_lower_included ( ) const

Check if lower bound is included.

◆ is_singleton()

bool datatools::integer_range::is_singleton ( ) const

Check if the interval is degenerated (one unique value)

◆ is_upper_bounded()

bool datatools::integer_range::is_upper_bounded ( ) const

Check if upper bound is defined.

◆ is_upper_included()

bool datatools::integer_range::is_upper_included ( ) const

Check if upper bound is included.

◆ is_valid()

bool datatools::integer_range::is_valid ( ) const

Check the validity of the interval.

◆ last()

value_type datatools::integer_range::last ( ) const

Return the last value belonging to the half upper bounded interval.

◆ make_bounded()

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.

◆ make_canonical()

void datatools::integer_range::make_canonical ( integer_range range_) const

Build the associated canonical interval (with bounds flagged as included)

◆ make_empty()

void datatools::integer_range::make_empty ( )

Build an empty interval.

◆ make_full()

void datatools::integer_range::make_full ( )

Build a fully bounded interval.

◆ make_full_negative()

void datatools::integer_range::make_full_negative ( )

Build a fully bounded negative interval ending at 0.

◆ make_full_positive()

void datatools::integer_range::make_full_positive ( )

Build a fully bounded positive interval starting at 0.

◆ make_lower_unbounded()

void datatools::integer_range::make_lower_unbounded ( value_type  to_,
bool  inclusive_ = true 
)

Build a half bounded interval with no lower bound.

◆ make_upper_unbounded()

void datatools::integer_range::make_upper_unbounded ( value_type  from_,
bool  inclusive_ = true 
)

Build a half bounded interval with no upper bound.

◆ operator<()

bool datatools::integer_range::operator< ( const integer_range range_) const

Comparison operator.

◆ operator==()

bool datatools::integer_range::operator== ( const integer_range range_) const

Comparison operator.

◆ operator>()

bool datatools::integer_range::operator> ( const integer_range range_) const

Comparison operator.

◆ reset()

void datatools::integer_range::reset ( )

Reset the interval.

◆ reset_lower()

void datatools::integer_range::reset_lower ( )

Reset lower bound.

◆ reset_upper()

void datatools::integer_range::reset_upper ( )

Reset upper bound.

◆ set()

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.

◆ set_lower()

void datatools::integer_range::set_lower ( value_type  from_,
range_bound_info_type  policy_ = range_bound_included 
)

Set the lower bound.

◆ set_upper()

void datatools::integer_range::set_upper ( value_type  to_,
range_bound_info_type  policy_ = range_bound_included 
)

Set the upper bound.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const integer_range range_ 
)
friend

Print operator.

◆ operator>>

std::istream& operator>> ( std::istream &  in,
integer_range range_ 
)
friend

Input operator.


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