Inter4ql  5.2
Constraints.h
1 #ifndef __CONSTRAINTS_H__
2 #define __CONSTRAINTS_H__
3 
4 #include <string>
5 #include <vector>
6 
7 #include "Disposable.h"
8 #include "Expression.h"
9 
10 namespace Inter4ql {
11 
12  class Fact;
13 
15  public:
16  QuantifierEntry(std::string type, std::string id, std::string domain)
17  : type_(type),
18  id_(id),
19  domain_(domain) {};
20  std::string get_type() { return type_; };
21  std::string get_id() { return id_; };
22  std::string get_domain() { return domain_; };
23  private:
24  std::string type_;
25  std::string id_;
26  std::string domain_;
27  };
28 
30  public:
31  ConstraintEntry(std::vector<QuantifierEntry*>* q, Expression* body, std::vector<Inter4ql::Value*>* values)
32  : quantifiers_(q),
33  body_(body),
34  values_(values) {};
35  ~ConstraintEntry() {
37  if (this->quantifiers_) {
38  for(std::vector<QuantifierEntry*>::iterator it = quantifiers_->begin(); it != quantifiers_->end(); it++) {
39  delete (*it);
40  }
41  delete this->quantifiers_;
42  }
43 
44  if (this->values_) {
45  for(std::vector<Inter4ql::Value*>::iterator it = values_->begin(); it != values_->end(); it++) {
46  delete (*it);
47  }
48  delete this->values_;
49  }
50 
51  if (this->body_)
52  delete this->body_;
53  }
54  }
55  std::vector<QuantifierEntry*>* get_quantifiers() { return quantifiers_; };
56  Expression* get_body() { return body_; };
57  std::vector<Inter4ql::Value*>* get_values() { return values_; };
58  private:
59  std::vector<QuantifierEntry*>* quantifiers_;
60  Expression* body_;
61  std::vector<Inter4ql::Value *>* values_;
62  };
63 
64  typedef std::vector<Expression*>* Ctraints;
65 
68  class Constraints {
69  public:
75  Constraints(Ctraints _hard, Ctraints _soft);
78  ~Constraints();
83  Ctraints get_soft_constraints();
88  Ctraints get_hard_constraints();
89  private:
90  Ctraints soft;
91  Ctraints hard;
92  };
93 }
94 
95 #endif
Definition: Constraints.h:14
Definition: Expression.h:10
Definition: Application.cc:37
static bool errorMode
if true, destructors in objects will not free their internals
Definition: Disposable.h:72
Definition: Constraints.h:29
Output class handles standard output of interpreter.
Definition: Constraints.h:68