Otawa  0.10
otawa::ilp::AbstractConstraint Class Referenceabstract

Constraint generated by AbstractSystem. More...

#include <otawa/ilp/AbstractSystem.h>

Inheritance diagram for otawa::ilp::AbstractConstraint:
otawa::ilp::Constraint

Classes

class  TermIter
 

Public Types

enum  comparator_t {
  UNDEF = -3, LT = -2, LE = -1, EQ = 0,
  GE = 1, GT = 2
}
 
typedef enum
otawa::ilp::Constraint::comparator_t 
comparator_t
 
typedef otawa::ilp::Term Term
 

Public Member Functions

 AbstractConstraint (string label, comparator_t comp, double cst)
 Build an abstract constraint. More...
 
virtual ~AbstractConstraint (void)
 
virtual double coefficient (Var *var=0) const
 Get the coefficient for the given variable. More...
 
virtual double constant (void) const
 
virtual comparator_t comparator (void) const
 Get the constraint comparator. More...
 
virtual const stringlabel (void) const
 
virtual void add (double coef, Var *var=0)
 Add a term to the constraint to the left part of constraint. More...
 
virtual void sub (double coef, Var *var=0)
 Substact a factor from the constraint. More...
 
virtual
elm::datastruct::IteratorInst
< Term > * 
terms (void)
 
virtual void setComparator (comparator_t comp)
 
virtual void setLabel (const string &label)
 
void add (const Term &t)
 
void add (const Expression &e)
 void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint. More...
 
void sub (const Term &t)
 
void sub (const Expression &e)
 Subtract an expression from the left part of the constraint. More...
 
void addLeft (double coef, Var *var=0)
 Add a factor on the left side. More...
 
void addRight (double coef, Var *var=0)
 Add a factor on the right side. More...
 
virtual void setComparator (comparator_t comp)=0
 

Private Attributes

string _label
 
Expression _expr
 
comparator_t _comp
 
double _cst
 
int _idx
 
AbstractSystem_sys
 

Friends

class AbstractSystem
 

Detailed Description

Constraint generated by AbstractSystem.

Provided publicly to allow extension of AbstractSystem.

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
UNDEF 
LT 
LE 
EQ 
GE 
GT 

Constructor & Destructor Documentation

otawa::ilp::AbstractConstraint::AbstractConstraint ( string  label,
comparator_t  comp,
double  cst 
)

Build an abstract constraint.

Parameters
labelAssociated label.
compConstraint comparator.
cstNumeric constant put to the right of the constraint.
otawa::ilp::AbstractConstraint::~AbstractConstraint ( void  )
virtual

Member Function Documentation

void otawa::ilp::AbstractConstraint::add ( double  coef,
Var var = 0 
)
virtual

Add a term to the constraint to the left part of constraint.

If var is null, sum the coefficient to the right part of the constraint.

Parameters
coefCoefficient of the factor.
varVariable of the factor. When null, modify the constant.

Implements otawa::ilp::Constraint.

References _cst, _expr, and otawa::ilp::Expression::add().

void otawa::ilp::Constraint::add ( const Term t)
inlineinherited
void otawa::ilp::Constraint::add ( const Expression e)
inherited

void Constraint::setComparator(comparator_t comp); Change the comparator of the constraint.

Parameters
compComparator to set.
Since
ILP interface 1.2.0 void Constraint::setLabel(const string& label); Change the label of the constraint.
Parameters
labelLabel to set.
Since
ILP interface 1.2.0 Add an expression to the left part of the constraint.
Parameters
eAdded expression.

References otawa::ilp::Constraint::add().

double otawa::ilp::AbstractConstraint::coefficient ( Var var = 0) const
virtual

Get the coefficient for the given variable.

Parameters
varVariable to get the coefficent of. Null variable allows getting the constant part.
Returns
Variable coefficient.

Implements otawa::ilp::Constraint.

References _expr, and constant().

Constraint::comparator_t otawa::ilp::AbstractConstraint::comparator ( void  ) const
virtual

Get the constraint comparator.

Returns
Constraint comparator.

Implements otawa::ilp::Constraint.

References _comp.

double otawa::ilp::AbstractConstraint::constant ( void  ) const
virtual

Implements otawa::ilp::Constraint.

References _cst.

Referenced by coefficient().

const string & otawa::ilp::AbstractConstraint::label ( void  ) const
virtual

Implements otawa::ilp::Constraint.

References _label.

Referenced by setLabel().

void otawa::ilp::AbstractConstraint::setComparator ( comparator_t  comp)
virtual

References _comp.

virtual void otawa::ilp::Constraint::setComparator ( comparator_t  comp)
pure virtualinherited

Referenced by otawa::ilp::cons::set().

void otawa::ilp::AbstractConstraint::setLabel ( const string label)
virtual

Implements otawa::ilp::Constraint.

References _label, and label().

void otawa::ilp::AbstractConstraint::sub ( double  coef,
Var var = 0 
)
virtual

Substact a factor from the constraint.

Parameters
coefCoefficient of the factor.
varVariable of the factor.

Implements otawa::ilp::Constraint.

References _cst, _expr, and otawa::ilp::Expression::sub().

void otawa::ilp::Constraint::sub ( const Term t)
inlineinherited
void otawa::ilp::Constraint::sub ( const Expression e)
inherited

Subtract an expression from the left part of the constraint.

Parameters
eSubtracted expression.

References otawa::ilp::Constraint::sub().

elm::datastruct::IteratorInst< Term > * otawa::ilp::AbstractConstraint::terms ( void  )
virtual

Implements otawa::ilp::Constraint.

References _expr.

Friends And Related Function Documentation

friend class AbstractSystem
friend

Member Data Documentation

comparator_t otawa::ilp::AbstractConstraint::_comp
private

Referenced by comparator(), and setComparator().

double otawa::ilp::AbstractConstraint::_cst
private

Referenced by add(), constant(), and sub().

Expression otawa::ilp::AbstractConstraint::_expr
private

Referenced by add(), coefficient(), sub(), and terms().

int otawa::ilp::AbstractConstraint::_idx
private
string otawa::ilp::AbstractConstraint::_label
private

Referenced by label(), and setLabel().

AbstractSystem* otawa::ilp::AbstractConstraint::_sys
private

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