APRONXX  0.9.7
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

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::interval ( ap_interval_t *  i)
inlineprotected

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

interval::interval ( )
inline

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

interval::interval ( const interval x)
inline

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

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

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

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

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

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

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

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

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

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

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

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::interval ( mpfr_t  inf,
mpfr_t  sup 
)
inline

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

interval::interval ( top  t)
inline

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

interval::interval ( bottom  t)
inline

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

interval::~interval ( )
inline

Member Function Documentation

const ap_interval_t * apron::interval::get_ap_interval_t ( ) const
inline

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

ap_interval_t * interval::get_ap_interval_t ( )
inline

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

scalar & interval::get_inf ( )
inline

Gets a (modifiable) reference to the lower bound.

const scalar & apron::interval::get_inf ( ) const
inline

Gets a reference to the lower bound.

scalar & interval::get_sup ( )
inline

Gets a (modifiable) reference to the upper bound.

const scalar & apron::interval::get_sup ( ) const
inline

Gets a reference to the upper bound.

long interval::hash ( ) const
inline

Returns a hash code.

void interval::init ( )
inlineprotected

Internal initialisation.

bool interval::is_bottom ( ) const
inline

Whether *this represents an empty interval.

bool interval::is_top ( ) const
inline

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

void interval::neg ( )
inline

Negates *this.

interval interval::operator- ( ) const
inline

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

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

Copies an interval into *this.

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

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

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

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

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

Prints to a C stream.

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

Copies an interval into *this.

Returns
*this.
interval & interval::set ( const scalar inf,
const scalar sup 
)
inline

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

Returns
*this.
interval & interval::set ( int  inf,
int  sup 
)
inline

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

Returns
*this.
interval & interval::set ( long  inf,
long  sup 
)
inline

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

Returns
*this.
interval & interval::set ( double  inf,
double  sup 
)
inline

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

Returns
*this.
interval & interval::set ( const frac inf,
const frac sup 
)
inline

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

Returns
*this.
interval & interval::set ( const mpq_class &  inf,
const mpq_class &  sup 
)
inline

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

Returns
*this.
interval & interval::set ( mpfr_t  inf,
mpfr_t  sup 
)
inline

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

Returns
*this.
interval & interval::set ( top  t)
inline

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

Returns
*this.
interval & interval::set ( bottom  t)
inline

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

Returns
*this.

Friends And Related Function Documentation

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

Interval ordering.

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

Set disequality.

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

Strict set inclusion.

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

Printing.

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

Set inclusion.

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

Set equality.

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

Strict set inclusion.

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

Set inclusion.

void swap ( interval a,
interval b 
)
friend

Swaps the contents of two intervals.

Member Data Documentation

ap_interval_t apron::interval::c
protected

Structure managed by APRON.


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