Otawa  0.10
impl.h
Go to the documentation of this file.
1 /*
2  * ilp impl module interface
3  *
4  * This file is part of OTAWA
5  * Copyright (c) 2013, IRIT UPS.
6  *
7  * OTAWA is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * OTAWA is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OTAWA; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 #ifndef OTAWA_ILP_IMPL_H_
22 #define OTAWA_ILP_IMPL_H_
23 
24 #include "Var.h"
25 #include "Constraint.h"
26 #include "System.h"
27 
28 namespace otawa { namespace ilp {
29 
30 class VarImpl: public Var {
31 public:
32  inline VarImpl(void) { }
33  inline VarImpl(string name): Var(name) { }
34 };
35 
36 
37 class ConstraintImpl: public Constraint {
38 public:
40  virtual double coefficient(Var *var);
41  virtual double constant(void) const;
42  virtual comparator_t comparator(void) const;
43  virtual const string& label(void) const;
44 
45  virtual void add(double coef, Var *var);
46  virtual void sub(double coef, Var *var);
47 
49 
50 private:
53  string lab;
54 };
55 
56 } } // otawa::ilp
57 
58 #endif /* OTAWA_ILP_IMPL_H_ */
An expression allows to represent a sum of terms and may be used to represent the value of an aliased...
Definition: Expression.h:43
Expression expr
Definition: impl.h:51
const string & name(void) const
Get the name of the variable if any.
Definition: Var.h:46
comparator_t
Definition: Constraint.h:36
ConstraintImpl(comparator_t comparator, string label="")
Build an empty constraint.
Definition: ilp_impl.cpp:57
VarImpl(string name)
Named variable constructor.
Definition: impl.h:33
VarImpl(void)
Anonymous variable constructor.
Definition: impl.h:32
Very trivial implementation of the Var class.
Definition: impl.h:30
string lab
Definition: impl.h:53
This class is used to represent constraints in an ILP system with the following form: ...
Definition: Constraint.h:33
virtual comparator_t comparator(void) const
Get the constraint comparator.
Definition: ilp_impl.cpp:86
Provide a simple implementation of a constraint using expression.
Definition: impl.h:37
virtual void sub(double coef, Var *var)
Substact a factor from the constraint.
Definition: ilp_impl.cpp:107
virtual void add(double coef, Var *var)
Add a term to the constraint to the left part of constraint.
Definition: ilp_impl.cpp:100
virtual double constant(void) const
Definition: ilp_impl.cpp:75
virtual double coefficient(Var *var)
Definition: ilp_impl.cpp:64
virtual const string & label(void) const
Definition: ilp_impl.cpp:93
A variable is an identifier used for performing ILP computation.
Definition: Var.h:36
Encapsulation for ilp::Var pointers for {ilp} expr user-fiendly interface.
Definition: expr.h:29
virtual elm::datastruct::IteratorInst< Term > * terms(void)
Definition: ilp_impl.cpp:126
comparator_t comp
Definition: impl.h:52