Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

constraints.h File Reference

#include <limits.h>
#include <assert.h>
#include "base/inttypes.h"
#include <iostream>

Go to the source code of this file.

Typedefs

typedef int32_t raw_t
 To distinguish normal integers and those representing constraints.

Enumerations

enum  { dbm_INFINITY = INT_MAX >> 1, dbm_OVERFLOW = INT_MAX >> 2 }
 *Bound* constants. More...
enum  strictness_t { dbm_STRICT = 0, dbm_WEAK = 1 }
 Bound *strictness*. More...
enum  { dbm_LE_ZERO = 1, dbm_LS_INFINITY = (dbm_INFINITY << 1), dbm_LE_OVERFLOW = dbm_LS_INFINITY >> 1 }
 *Raw* encoded constants. More...

Functions

static raw_t dbm_bound2raw (int32_t bound, strictness_t strict)
 Encoding of bound into (strict) less or less equal.
static raw_t dbm_boundbool2raw (int32_t bound, bool isStrict)
 Encoding of bound into (strict) less or less equal.
static int32_t dbm_raw2bound (raw_t raw)
 Decoding of raw representation: bound.
static raw_t dbm_strictRaw (raw_t raw)
 Make an encoded constraint strict.
static raw_t dbm_weakRaw (raw_t raw)
 Make an encoded constraint weak.
static strictness_t dbm_raw2strict (raw_t raw)
 Decoding of raw representation: strictness.
static BOOL dbm_rawIsStrict (raw_t raw)
 Tests of strictness.
static BOOL dbm_rawIsWeak (raw_t raw)
 Tests of non strictness.
static strictness_t dbm_negStrict (strictness_t strictness)
 Negate the strictness of a constraint.
static raw_t dbm_negRaw (raw_t c)
 Negate a constraint: neg(<a) = <=-a neg(<=a) = <-a.
static raw_t dbm_weakNegRaw (raw_t c)
 "Weak" negate a constraint: neg(<=a) = <= -a.
static BOOL dbm_isValidRaw (raw_t x)
 A valid raw bound should not cause overflow in computations.
static raw_t dbm_addRawRaw (raw_t x, raw_t y)
 Constraint addition on raw values : + constraints - excess bit.
static raw_t dbm_addRawFinite (raw_t x, raw_t y)
 Constraint addition:.
static raw_t dbm_addFiniteRaw (raw_t x, raw_t y)
static raw_t dbm_addFiniteFinite (raw_t x, raw_t y)
 Constraint addition.
static raw_t dbm_addFiniteWeak (raw_t x, raw_t y)
 Specialized constraint addition.
static raw_t dbm_rawInc (raw_t c, raw_t i)
 Raw constraint increment:.
static raw_t dbm_rawDec (raw_t c, raw_t d)
 Raw constraint decrement:.
static constraint_t dbm_constraint (cindex_t i, cindex_t j, int32_t bound, strictness_t strictness)
 Convenience function to build a constraint.
static constraint_t dbm_constraint2 (cindex_t i, cindex_t j, int32_t bound, BOOL isStrict)
 2nd convenience function to build a constraint.
static constraint_t dbm_negConstraint (constraint_t c)
 Negation of a constraint.
static BOOL dbm_areConstraintsEqual (constraint_t c1, constraint_t c2)
 Equality of constraints.
static bool operator< (const constraint_t &a, const constraint_t &b)
 Comparison operator < defined if C++.
static constraint_t operator! (const constraint_t &c)
 Negation operator for constraint_t.


Typedef Documentation

typedef int32_t raw_t
 

To distinguish normal integers and those representing constraints.

"raw" is used because it represents an encoding and this is the raw representation of it.


Enumeration Type Documentation

anonymous enum
 

*Bound* constants.

Enumeration values:
dbm_INFINITY  infinity
dbm_OVERFLOW  to detect overflow on computations

anonymous enum
 

*Raw* encoded constants.

Enumeration values:
dbm_LE_ZERO  Less Equal Zero.
dbm_LS_INFINITY  Less Strict than infinity.
dbm_LE_OVERFLOW  to detect overflow on computations

enum strictness_t
 

Bound *strictness*.

Vital constant values *DO NOT CHANGE*.

Enumeration values:
dbm_STRICT  strict less than constraints: < x
dbm_WEAK  less or equal constraints : <= x


Function Documentation

static raw_t dbm_addFiniteFinite raw_t  x,
raw_t  y
[inline, static]
 

Constraint addition.

Parameters:
x,y,: encoded constraints to add.
Returns:
encoded constraint x+y.
Precondition:
x and y finite.

static raw_t dbm_addFiniteRaw raw_t  x,
raw_t  y
[inline, static]
 

static raw_t dbm_addFiniteWeak raw_t  x,
raw_t  y
[inline, static]
 

Specialized constraint addition.

Parameters:
x,y,: finite encoded constraints to add.
Precondition:
x & y finite, x or y weak.
Returns:
encoded constraint x+y

static raw_t dbm_addRawFinite raw_t  x,
raw_t  y
[inline, static]
 

Constraint addition:.

Parameters:
x,y,: encoded constraints to add.
Returns:
encoded constraint x+y.
Precondition:
y finite.

static raw_t dbm_addRawRaw raw_t  x,
raw_t  y
[inline, static]
 

Constraint addition on raw values : + constraints - excess bit.

Parameters:
x,y,: encoded constraints to add.
Returns:
encoded constraint x+y.

static BOOL dbm_areConstraintsEqual constraint_t  c1,
constraint_t  c2
[inline, static]
 

Equality of constraints.

Parameters:
c1,c2,: constraints.
Returns:
TRUE if c1 == c2.

static raw_t dbm_bound2raw int32_t  bound,
strictness_t  strict
[inline, static]
 

Encoding of bound into (strict) less or less equal.

Parameters:
bound,strict,: the bound to encode with the strictness.
Returns:
encoded constraint ("raw").

static raw_t dbm_boundbool2raw int32_t  bound,
bool  isStrict
[inline, static]
 

Encoding of bound into (strict) less or less equal.

Parameters:
bound,isStrict,: the bound to encode with a flag telling if the bound is strict or not. if isStrict is TRUE then dbm_STRICT is taken, otherwise dbm_WEAK.
Returns:
encoded constraint ("raw").

static constraint_t dbm_constraint cindex_t  i,
cindex_t  j,
int32_t  bound,
strictness_t  strictness
[inline, static]
 

Convenience function to build a constraint.

Parameters:
i,j,: indices.
bound,: the bound.
strictness,: strictness of the constraint.

static constraint_t dbm_constraint2 cindex_t  i,
cindex_t  j,
int32_t  bound,
BOOL  isStrict
[inline, static]
 

2nd convenience function to build a constraint.

Parameters:
i,j,: indices.
bound,: the bound.
isStrict,: true if constraint is strict

static BOOL dbm_isValidRaw raw_t  x  )  [inline, static]
 

A valid raw bound should not cause overflow in computations.

Parameters:
x,: encoded constraint (bound + strictness)
Returns:
TRUE if adding this constraint to any constraint does not overflow.

static constraint_t dbm_negConstraint constraint_t  c  )  [inline, static]
 

Negation of a constraint.

Swap indices i,j, negate value, and toggle the strictness.

Parameters:
c,: constraint to negate.
Returns:
negated constraint.

static raw_t dbm_negRaw raw_t  c  )  [inline, static]
 

Negate a constraint: neg(<a) = <=-a neg(<=a) = <-a.

Parameters:
c,: the constraint.

static strictness_t dbm_negStrict strictness_t  strictness  )  [inline, static]
 

Negate the strictness of a constraint.

Parameters:
strictness,: the flag to negate.

static int32_t dbm_raw2bound raw_t  raw  )  [inline, static]
 

Decoding of raw representation: bound.

Parameters:
raw,: encoded constraint (bound + strictness).
Returns:
the decoded bound value.

static strictness_t dbm_raw2strict raw_t  raw  )  [inline, static]
 

Decoding of raw representation: strictness.

Parameters:
raw,: encoded constraint (bound + strictness).
Returns:
the decoded strictness.

static raw_t dbm_rawDec raw_t  c,
raw_t  d
[inline, static]
 

Raw constraint decrement:.

Returns:
constraint + decremen with test infinity
Parameters:
c,: constraint
d,: decrement

static raw_t dbm_rawInc raw_t  c,
raw_t  i
[inline, static]
 

Raw constraint increment:.

Returns:
constraint + increment with test infinity
Parameters:
c,: constraint
i,: increment

static BOOL dbm_rawIsStrict raw_t  raw  )  [inline, static]
 

Tests of strictness.

Parameters:
raw,: encoded constraint (bound + strictness).
Returns:
TRUE if the constraint is strict. dbm_rawIsStrict(x) == !dbm_rawIsEq(x)

static BOOL dbm_rawIsWeak raw_t  raw  )  [inline, static]
 

Tests of non strictness.

Parameters:
raw,: encoded constraint (bound + strictness).
Returns:
TRUE if the constraint is not strict. dbm_rawIsStrict(x) == !dbm_rawIsEq(x)

static raw_t dbm_strictRaw raw_t  raw  )  [inline, static]
 

Make an encoded constraint strict.

Parameters:
raw,: bound to make strict.
Returns:
strict raw.

static raw_t dbm_weakNegRaw raw_t  c  )  [inline, static]
 

"Weak" negate a constraint: neg(<=a) = <= -a.

Precondition:
c is weak.

static raw_t dbm_weakRaw raw_t  raw  )  [inline, static]
 

Make an encoded constraint weak.

Parameters:
raw,: bound to make weak.
Precondition:
raw != dbm_LS_INFINITY because <= infinity is wrong.
Returns:
weak raw.

static constraint_t operator! const constraint_t c  )  [inline, static]
 

Negation operator for constraint_t.

static bool operator< const constraint_t a,
const constraint_t b
[inline, static]
 

Comparison operator < defined if C++.

Parameters:
a,b,: constraints to compare.
Returns:
true: if a < b


Generated on Fri Jun 30 00:02:46 2006 for Module dbm by  doxygen 1.4.2