SemOpt  0.2alpha2-SCC
Labelling.cpp
Go to the documentation of this file.
1 
10 #include "Labelling.h"
11 
16 const Label Labelling::lab_in = "in";
17 
22 const Label Labelling::lab_out = "out";
23 
28 const Label Labelling::lab_undec = "undec";
29 
34 {
35  this->labelling = map<Argument *, Label>();
36  this->in = SetArguments();
37  this->out = SetArguments();
38  this->undec = SetArguments();
39 }
40 
49 void Labelling::add_label(Argument * arg, Label l)
50 {
51  this->labelling.insert(pair<Argument *, Label>(arg, l));
52  if (l.compare(Labelling::lab_in) == 0)
53  this->in.add_Argument(arg);
54  else if (l.compare(Labelling::lab_out) == 0)
55  this->out.add_Argument(arg);
56  else if (l.compare(Labelling::lab_undec) == 0)
57  this->undec.add_Argument(arg);
58 }
59 
66 {
67  return (this->labelling.find(arg) != this->labelling.end());
68 }
69 
76 {
77  return this->labelling.at(arg);
78 }
79 
85 {
86  return &(this->in);
87 }
88 
94 {
95  return &(this->out);
96 }
97 
103 {
104  return &(this->undec);
105 }
106 
112 {
113  return this->labelling.empty() && this->in.empty() && this->out.empty() && this->undec.empty();
114 }
115 
122 {
123  map<Argument *, Label>::iterator it;
124  for (it = this->labelling.begin(); it != this->labelling.end(); it++)
125  {
126  other->add_label((*it).first, (*it).second);
127  }
128 }
129 
130 Labelling::~Labelling()
131 {
132  // TODO Auto-generated destructor stub
133 }
134