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

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

Detailed Description

A class representing an interval of real (double precision) values with support of embedded units.

Constructor & Destructor Documentation

◆ real_range() [1/2]

datatools::real_range::real_range ( )

Default constructor.

◆ real_range() [2/2]

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.

Member Function Documentation

◆ _effective_tolerance()

double datatools::real_range::_effective_tolerance ( double  tolerance_) const
protected

Return an effective absolute tolerance.

◆ _set_defaults()

void datatools::real_range::_set_defaults ( )
protected

Set default attribute values.

◆ compare()

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

Compare intervals.

◆ compute_tolerance()

static double datatools::real_range::compute_tolerance ( double  lower_,
double  upper_,
double  relative_tolerance_ = -1.0 
)
static

Given a relative tolerance, compute the absolute tolerance associated to bounds.

◆ dump()

void datatools::real_range::dump ( std::ostream &  out_ = std::clog,
double  tolerance_ = -1.0 
) const

Basic print.

◆ first()

double datatools::real_range::first ( double  tolerance_ = -1.0) const

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

◆ get_lower()

double datatools::real_range::get_lower ( ) const

Return lower bound.

◆ get_preferred_unit()

const std::string& datatools::real_range::get_preferred_unit ( ) const

Reset the preferred unit symbol.

◆ get_unit_label()

const std::string& datatools::real_range::get_unit_label ( ) const

Return the unit label.

◆ get_upper()

double datatools::real_range::get_upper ( ) const

Return upper bound.

◆ has() [1/2]

bool datatools::real_range::has ( double  value_,
double  tolerance_ = -1.0 
) const

Check if a value belongs to the interval.

◆ has() [2/2]

bool datatools::real_range::has ( const real_range rr_,
double  tolerance_ = -1.0 
) const

Check if an real interval belongs to the interval.

◆ has_preferred_unit()

bool datatools::real_range::has_preferred_unit ( ) const

Check if the preferred unit label is set.

◆ has_unit_label()

bool datatools::real_range::has_unit_label ( ) const

Check if unit label is set.

◆ invalidate()

void datatools::real_range::invalidate ( )

Invalidate the interval.

◆ is_bounded()

bool datatools::real_range::is_bounded ( ) const

Check if both bounds are defined.

◆ is_empty()

bool datatools::real_range::is_empty ( double  tolerance_ = -1.0) const

Check if interval is empty.

◆ is_half_bounded()

bool datatools::real_range::is_half_bounded ( ) const

Check if the intervalis half-bounded.

◆ is_lower_bounded()

bool datatools::real_range::is_lower_bounded ( ) const

Check if lower bound is defined.

◆ is_lower_included()

bool datatools::real_range::is_lower_included ( ) const

Check if lower bound is included.

◆ is_singleton()

bool datatools::real_range::is_singleton ( double  tolerance_ = -1.0) const

Check if the interval is degenerated (one unique value)

◆ is_upper_bounded()

bool datatools::real_range::is_upper_bounded ( ) const

Check if upper bound is defined.

◆ is_upper_included()

bool datatools::real_range::is_upper_included ( ) const

Check if upper bound is included.

◆ is_valid()

bool datatools::real_range::is_valid ( ) const

Check the validity of the interval.

◆ last()

double datatools::real_range::last ( double  tolerance_ = -1.0) const

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

◆ make_bounded()

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.

◆ make_empty()

void datatools::real_range::make_empty ( )

Build an empty interval.

◆ make_lower_unbounded()

void datatools::real_range::make_lower_unbounded ( double  to_,
bool  inclusive_ = true 
)

Build a half bounded interval with no lower bound.

◆ make_negative_unbounded()

void datatools::real_range::make_negative_unbounded ( )

Build a fully bounded negative interval ending at 0.

◆ make_positive_unbounded()

void datatools::real_range::make_positive_unbounded ( )

Build a fully bounded positive interval starting at 0.

◆ make_singleton()

void datatools::real_range::make_singleton ( double  )

Build a singleton.

◆ make_unbounded()

void datatools::real_range::make_unbounded ( )

Build a full unbounded interval with no lower or upper bounds.

◆ make_upper_unbounded()

void datatools::real_range::make_upper_unbounded ( double  from_,
bool  inclusive_ = true 
)

Build a half bounded interval with no upper bound.

◆ operator<()

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

Comparison operator.

◆ operator==()

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

Comparison operator.

◆ operator>()

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

Comparison operator.

◆ reset()

void datatools::real_range::reset ( )

Reset the interval.

◆ reset_lower()

void datatools::real_range::reset_lower ( )

Reset lower bound.

◆ reset_preferred_unit()

void datatools::real_range::reset_preferred_unit ( )

Reset the preferred unit symbol.

◆ reset_unit_label()

void datatools::real_range::reset_unit_label ( )

Reset the unit label.

◆ reset_upper()

void datatools::real_range::reset_upper ( )

Reset upper bound.

◆ set()

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.

◆ set_lower()

void datatools::real_range::set_lower ( double  from_,
range_bound_info_type  policy_ = range_bound_included 
)

Set the lower bound.

◆ set_preferred_unit()

void datatools::real_range::set_preferred_unit ( const std::string &  pus_)

Set the preferred unit symbol.

◆ set_unit_label()

void datatools::real_range::set_unit_label ( const std::string &  )

Set the unit label.

◆ set_upper()

void datatools::real_range::set_upper ( double  to_,
range_bound_info_type  policy_ = range_bound_included 
)

Set the upper bound.

◆ singleton()

double datatools::real_range::singleton ( double  tolerance_ = -1.0) const

Return the singleton value.

◆ width()

double datatools::real_range::width ( double  tolerance_ = -1.0) const

Return the width of the interval.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out_,
const real_range range_ 
)
friend

Print operator using the ISO_31-11 standard.

◆ operator>>

std::istream& operator>> ( std::istream &  in_,
real_range range_ 
)
friend

Input operator using the ISO_31-11 standard.


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