Skip to content

Commit f8519e8

Browse files
committed
Adding expr() methods
This API mimics the API of smoek. We'll see if we keep this, but it seems to make sense.
1 parent a4a8899 commit f8519e8

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/coek/coek/api/constraint.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ Constraint& Constraint::operator=(const Constraint& expr)
2929
return *this;
3030
}
3131

32+
Constraint& Constraint::expr(const Constraint& expr)
33+
{ repn = expr.repn; return *this; }
34+
35+
Constraint Constraint::expr() const
36+
{ return *this; }
37+
3238
bool Constraint::active() const { return repn->active; }
3339

3440
void Constraint::activate() { repn->active = true; }

lib/coek/coek/api/constraint.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,19 @@ class Constraint {
3535

3636
Constraint& operator=(const Constraint& arg);
3737

38+
/** Set the constraint */
39+
Constraint& expr(const Constraint& body);
40+
/** \returns the constraint */
41+
Constraint expr() const;
42+
3843
/** \returns \c true if this is an inequality constraint */
3944
bool is_inequality() const;
4045
/** \returns \c true if this is an equality constraint */
4146
bool is_equality() const;
4247
/** \returns \c true if the constraint is feasible */
4348
bool is_feasible() const;
4449

50+
4551
/** \returns the expression for the constraint lower bound */
4652
Expression lower() const;
4753
/** \returns the expression for the constraint body */

0 commit comments

Comments
 (0)