APRONXX  0.9.12
Public Types | Protected Member Functions | Protected Attributes | List of all members
apron::interval Class Reference

Interval (ap_interval_t wrapper). More...

#include <apxx_interval.hh>

Inherits apron::use_malloc.

Public Types

enum  order {
  INCLUDED = -1, EQUAL = 0, CONTAINS = 1, LESS = -2,
  GREATER = 2
}
 Returned by ordering functions. More...
 

Public Member Functions

Constructors
 interval ()
 Makes a new interval [0,0] with double bounds. More...
 
 interval (const interval &x)
 Makes a copy of an interval (bounds are copied). More...
 
 interval (const scalar &inf, const scalar &sup)
 Makes a new interval with the specified scalar bounds (copied). More...
 
 interval (int inf, int sup)
 Makes a new interval with the specified integer bounds, using MPQ scalars. More...
 
 interval (long inf, long sup)
 Makes a new interval with the specified integer bounds, using MPQ scalars. More...
 
 interval (double inf, double sup)
 Makes a new interval with the specified double bounds, using double scalars. More...
 
 interval (const frac &inf, const frac &sup)
 Makes a new interval with the specified fraction bounds, using MPQ scalars. More...
 
 interval (const mpq_class &inf, const mpq_class &sup)
 Makes a new interval with the specified MPQ bounds (copied), using MPQ scalars. More...
 
 interval (mpfr_t inf, mpfr_t sup)
 Makes a new interval with the specified MPFR bounds (copied), using MPFR scalars. More...
 
 interval (top t)
 Makes a new interval representing ]-oo,+oo[. More...
 
 interval (bottom t)
 Makes a new empty interval [+1;-1]. More...
 
Destructor
 ~interval ()
 
Accesses
scalarget_inf ()
 Gets a (modifiable) reference to the lower bound. More...
 
scalarget_sup ()
 Gets a (modifiable) reference to the upper bound. More...
 
const scalarget_inf () const
 Gets a reference to the lower bound. More...
 
const scalarget_sup () const
 Gets a reference to the upper bound. More...
 
Operators
void neg ()
 Negates *this. More...
 
interval operator- () const
 Returns a new interval which is the opposite of *this. More...
 
long hash () const
 Returns a hash code. More...
 
C API compatibility
const ap_interval_t * get_ap_interval_t () const
 Returns a pointer to the internal APRON object stored in *this. More...
 
ap_interval_t * get_ap_interval_t ()
 Returns a pointer to the internal APRON object stored in *this. More...
 
- Public Member Functions inherited from apron::use_malloc
void * operator new (size_t sz)
 
void * operator new[] (size_t sz)
 
void operator delete (void *p)
 
void operator delete[] (void *p)
 

Protected Member Functions

void init ()
 Internal initialisation. More...
 
 interval (ap_interval_t *i)
 Internal use only. Take ownership of an object created by ap_interval_alloc. More...
 

Protected Attributes

ap_interval_t c
 Structure managed by APRON. More...
 

Assignments

void swap (interval &a, interval &b)
 Swaps the contents of two intervals. More...
 
intervaloperator= (const interval &x)
 Copies an interval into *this. More...
 
intervaloperator= (top t)
 Sets *this to top (]-oo;+oo[), no change in scalar types. More...
 
intervaloperator= (bottom t)
 Sets *this to empty ([+1;-1]), no change in scalar types. More...
 
intervalset (const interval &x)
 Copies an interval into *this. More...
 
intervalset (const scalar &inf, const scalar &sup)
 Sets *this to [inf;sup], copying both scalar bounds. More...
 
intervalset (int inf, int sup)
 Sets *this to [inf;sup], using MPQ scalar bounds. More...
 
intervalset (long inf, long sup)
 Sets *this to [inf;sup], using MPQ scalar bounds. More...
 
intervalset (double inf, double sup)
 Sets *this to [inf;sup], using double scalar bounds. More...
 
intervalset (const frac &inf, const frac &sup)
 Sets *this to [inf;sup], using MPQ scalar bounds. More...
 
intervalset (const mpq_class &inf, const mpq_class &sup)
 Sets *this to [inf;sup], using MPQ scalar bounds (copied). More...
 
intervalset (mpfr_t inf, mpfr_t sup)
 Sets *this to [inf;sup], using MPFR scalar bounds (copied). More...
 
intervalset (top t)
 Sets *this to top (]-oo;+oo[). More...
 
intervalset (bottom t)
 Sets *this to empty ([+1;-1]). More...
 

Printing

std::ostream & operator<< (std::ostream &os, const interval &s)
 Printing. More...
 
void print (FILE *stream=stdout) const
 Prints to a C stream. More...
 

Tests

bool operator<= (const interval &a, const interval &b)
 Set inclusion. More...
 
bool operator>= (const interval &a, const interval &b)
 Set inclusion. More...
 
bool operator< (const interval &a, const interval &b)
 Strict set inclusion. More...
 
bool operator> (const interval &a, const interval &b)
 Strict set inclusion. More...
 
bool operator== (const interval &a, const interval &b)
 Set equality. More...
 
bool operator!= (const interval &a, const interval &b)
 Set disequality. More...
 
order cmp (const interval &a, const interval &b)
 Interval ordering. More...
 
bool is_top () const
 Whether *this equals ]-oo;+oo[. More...
 
bool is_bottom () const
 Whether *this represents an empty interval. More...
 

Detailed Description

Interval (ap_interval_t wrapper).

An interval is represented using two scalar bounds (of double or MPQ type).

Member Enumeration Documentation

◆ order

Returned by ordering functions.

Enumerator
INCLUDED 

Means i1 is included in i2.

EQUAL 

Means i1 equals i2.

CONTAINS 

Means i2 is included in i1.

LESS 

Means min i1 <= min i2.

GREATER 

Means min i1 >= min i2.

Constructor & Destructor Documentation

◆ interval() [1/12]

interval::interval ( ap_interval_t *  i)
inlineprotected

Internal use only. Take ownership of an object created by ap_interval_alloc.

◆ interval() [2/12]

interval::interval ( )
inline

Makes a new interval [0,0] with double bounds.

◆ interval() [3/12]

interval::interval ( const interval x)
inline

Makes a copy of an interval (bounds are copied).

◆ interval() [4/12]

interval::interval ( const scalar inf,
const scalar sup 
)
inline

Makes a new interval with the specified scalar bounds (copied).

◆ interval() [5/12]

interval::interval ( int  inf,
int  sup 
)
inline

Makes a new interval with the specified integer bounds, using MPQ scalars.

◆ interval() [6/12]

interval::interval ( long  inf,
long  sup 
)
inline

Makes a new interval with the specified integer bounds, using MPQ scalars.

◆ interval() [7/12]

interval::interval ( double  inf,
double  sup 
)
inline

Makes a new interval with the specified double bounds, using double scalars.

◆ interval() [8/12]

interval::interval ( const frac inf,
const frac sup 
)
inline

Makes a new interval with the specified fraction bounds, using MPQ scalars.

◆ interval() [9/12]

interval::interval ( const mpq_class &  inf,
const mpq_class &  sup 
)
inline

Makes a new interval with the specified MPQ bounds (copied), using MPQ scalars.

◆ interval() [10/12]

interval::interval ( mpfr_t  inf,
mpfr_t  sup 
)
inline

Makes a new interval with the specified MPFR bounds (copied), using MPFR scalars.

◆ interval() [11/12]

interval::interval ( top  t)
inline

Makes a new interval representing ]-oo,+oo[.

◆ interval() [12/12]

interval::interval ( bottom  t)
inline

Makes a new empty interval [+1;-1].

◆ ~interval()

interval::~interval ( )
inline

Member Function Documentation

◆ get_ap_interval_t() [1/2]

const ap_interval_t * interval::get_ap_interval_t ( ) const
inline

Returns a pointer to the internal APRON object stored in *this.

◆ get_ap_interval_t() [2/2]

ap_interval_t * interval::get_ap_interval_t ( )
inline

Returns a pointer to the internal APRON object stored in *this.

◆ get_inf() [1/2]

scalar & interval::get_inf ( )
inline

Gets a (modifiable) reference to the lower bound.

◆ get_inf() [2/2]

const scalar & interval::get_inf ( ) const
inline

Gets a reference to the lower bound.

◆ get_sup() [1/2]

scalar & interval::get_sup ( )
inline

Gets a (modifiable) reference to the upper bound.

◆ get_sup() [2/2]

const scalar & interval::get_sup ( ) const
inline

Gets a reference to the upper bound.

◆ hash()

long interval::hash ( ) const
inline

Returns a hash code.

◆ init()

void interval::init ( )
inlineprotected

Internal initialisation.

◆ is_bottom()

bool interval::is_bottom ( ) const
inline

Whether *this represents an empty interval.

◆ is_top()

bool interval::is_top ( ) const
inline

Whether *this equals ]-oo;+oo[.

◆ neg()

void interval::neg ( )
inline

Negates *this.

◆ operator-()

interval interval::operator- ( ) const
inline

Returns a new interval which is the opposite of *this.

◆ operator=() [1/3]

interval & interval::operator= ( const interval x)
inline

Copies an interval into *this.

◆ operator=() [2/3]

interval & interval::operator= ( top  t)
inline

Sets *this to top (]-oo;+oo[), no change in scalar types.

◆ operator=() [3/3]

interval & interval::operator= ( bottom  t)
inline

Sets *this to empty ([+1;-1]), no change in scalar types.

◆ print()

void interval::print ( FILE *  stream = stdout) const
inline

Prints to a C stream.

◆ set() [1/10]

interval & interval::set ( const interval x)
inline

Copies an interval into *this.

Returns
*this.

◆ set() [2/10]

interval & interval::set ( const scalar inf,
const scalar sup 
)
inline

Sets *this to [inf;sup], copying both scalar bounds.

Returns
*this.

◆ set() [3/10]

interval & interval::set ( int  inf,
int  sup 
)
inline

Sets *this to [inf;sup], using MPQ scalar bounds.

Returns
*this.

◆ set() [4/10]

interval & interval::set ( long  inf,
long  sup 
)
inline

Sets *this to [inf;sup], using MPQ scalar bounds.

Returns
*this.

◆ set() [5/10]

interval & interval::set ( double  inf,
double  sup 
)
inline

Sets *this to [inf;sup], using double scalar bounds.

Returns
*this.

◆ set() [6/10]

interval & interval::set ( const frac inf,
const frac sup 
)
inline

Sets *this to [inf;sup], using MPQ scalar bounds.

Returns
*this.

◆ set() [7/10]

interval & interval::set ( const mpq_class &  inf,
const mpq_class &  sup 
)
inline

Sets *this to [inf;sup], using MPQ scalar bounds (copied).

Returns
*this.

◆ set() [8/10]

interval & interval::set ( mpfr_t  inf,
mpfr_t  sup 
)
inline

Sets *this to [inf;sup], using MPFR scalar bounds (copied).

Returns
*this.

◆ set() [9/10]

interval & interval::set ( top  t)
inline

Sets *this to top (]-oo;+oo[).

Returns
*this.

◆ set() [10/10]

interval & interval::set ( bottom  t)
inline

Sets *this to empty ([+1;-1]).

Returns
*this.

Friends And Related Function Documentation

◆ cmp

order cmp ( const interval a,
const interval b 
)
friend

Interval ordering.

◆ operator!=

bool operator!= ( const interval a,
const interval b 
)
friend

Set disequality.

◆ operator<

bool operator< ( const interval a,
const interval b 
)
friend

Strict set inclusion.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const interval s 
)
friend

Printing.

◆ operator<=

bool operator<= ( const interval a,
const interval b 
)
friend

Set inclusion.

◆ operator==

bool operator== ( const interval a,
const interval b 
)
friend

Set equality.

◆ operator>

bool operator> ( const interval a,
const interval b 
)
friend

Strict set inclusion.

◆ operator>=

bool operator>= ( const interval a,
const interval b 
)
friend

Set inclusion.

◆ swap

void swap ( interval a,
interval b 
)
friend

Swaps the contents of two intervals.

Member Data Documentation

◆ c

ap_interval_t apron::interval::c
protected

Structure managed by APRON.


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