aGrUM  0.16.0
O3prm.cpp
Go to the documentation of this file.
1 
31 #include <agrum/PRM/o3prm/O3prm.h>
32 
33 namespace gum {
34  namespace prm {
35  namespace o3prm {
36 
37  O3Position::O3Position() : __file(""), __line(0), __column(0) {
38  GUM_CONSTRUCTOR(O3Position);
39  }
40 
41  O3Position::O3Position(const std::string& file, int line, int column) :
42  __file(file), __line(line), __column(column) {
43  GUM_CONSTRUCTOR(O3Position);
44  }
45 
47  __file(src.__file), __line(src.__line), __column(src.__column) {
48  GUM_CONS_CPY(O3Position);
49  }
50 
52  __file(std::move(src.__file)), __line(std::move(src.__line)),
53  __column(std::move(src.__column)) {
54  GUM_CONS_MOV(O3Position);
55  }
56 
57  O3Position::~O3Position() { GUM_DESTRUCTOR(O3Position); }
58 
60  if (this == &src) { return *this; }
61  __file = src.__file;
62  __line = src.__line;
63  __column = src.__column;
64  return *this;
65  }
66 
68  if (this == &src) { return *this; }
69  __file = std::move(src.__file);
70  __line = std::move(src.__line);
71  __column = std::move(src.__column);
72  return *this;
73  }
74 
75  std::string& O3Position::file() { return __file; }
76  const std::string& O3Position::file() const { return __file; }
77 
78  int& O3Position::line() { return __line; }
79  int O3Position::line() const { return __line; }
80 
81  int& O3Position::column() { return __column; }
82  int O3Position::column() const { return __column; }
83 
84  O3Integer::O3Integer() : __pos(), __value(0) { GUM_CONSTRUCTOR(O3Integer); }
85 
87  __pos(pos), __value(value) {
88  GUM_CONSTRUCTOR(O3Integer);
89  }
90 
92  __pos(src.__pos), __value(src.__value) {
93  GUM_CONS_CPY(O3Integer);
94  }
95 
97  __pos(std::move(src.__pos)), __value(std::move(src.__value)) {
98  GUM_CONS_MOV(O3Integer);
99  }
100 
101  O3Integer::~O3Integer() { GUM_DESTRUCTOR(O3Integer); }
102 
104  if (this == &src) { return *this; }
105  __pos = src.__pos;
106  __value = src.__value;
107  return *this;
108  }
109 
111  if (this == &src) { return *this; }
112  __pos = std::move(src.__pos);
113  __value = std::move(src.__value);
114  return *this;
115  }
116 
117  const O3Position& O3Integer::position() const { return __pos; }
119 
120  int O3Integer::value() const { return __value; }
121  int& O3Integer::value() { return __value; }
122 
123  O3Float::O3Float() { GUM_CONSTRUCTOR(O3Float); }
124 
125  O3Float::O3Float(const O3Position& pos, float value) :
126  __pos(pos), __value(value) {
127  GUM_CONSTRUCTOR(O3Float);
128  }
129 
130  O3Float::O3Float(const O3Float& src) :
131  __pos(src.__pos), __value(src.__value) {
132  GUM_CONS_CPY(O3Float);
133  }
134 
136  __pos(std::move(src.__pos)), __value(std::move(src.__value)) {
137  GUM_CONS_MOV(O3Float);
138  }
139 
140  O3Float::~O3Float() { GUM_DESTRUCTOR(O3Float); }
141 
143  if (this == &src) { return *this; }
144  __pos = src.__pos;
145  __value = src.__value;
146  return *this;
147  }
148 
150  if (this == &src) { return *this; }
151  __pos = std::move(src.__pos);
152  __value = std::move(src.__value);
153  return *this;
154  }
155 
156  const O3Position& O3Float::position() const { return __pos; }
158 
159  float O3Float::value() const { return __value; }
160  float& O3Float::value() { return __value; }
161 
163  __pos(), __formula(std::unique_ptr< Formula >(new Formula(""))) {
164  GUM_CONSTRUCTOR(O3Formula);
165  }
166 
168  __pos(pos), __formula(std::unique_ptr< Formula >(new Formula(formula))) {
169  GUM_CONSTRUCTOR(O3Formula);
170  }
171 
173  __pos(src.__pos),
174  __formula(std::unique_ptr< Formula >(new Formula(src.formula()))) {
175  GUM_CONS_CPY(O3Formula);
176  }
177 
179  __pos(std::move(src.__pos)), __formula(std::move(src.__formula)) {
180  GUM_CONS_MOV(O3Formula);
181  }
182 
183  O3Formula::~O3Formula() { GUM_DESTRUCTOR(O3Formula); }
184 
186  if (this == &src) { return *this; }
187  __pos = src.__pos;
188  __formula = std::unique_ptr< Formula >(new Formula(src.formula()));
189  return *this;
190  }
191 
193  if (this == &src) { return *this; }
194  __pos = std::move(src.__pos);
195  __formula = std::move(src.__formula);
196  return *this;
197  }
198 
199  const O3Position& O3Formula::position() const { return __pos; }
201 
202  const Formula& O3Formula::formula() const { return *__formula; }
204 
205  O3Label::O3Label() : __pos(), __label() { GUM_CONSTRUCTOR(O3Label); }
206 
207  O3Label::O3Label(const O3Position& pos, const std::string& label) :
208  __pos(pos), __label(label) {
209  GUM_CONSTRUCTOR(O3Label);
210  }
211 
212  O3Label::O3Label(const O3Label& src) :
213  __pos(src.__pos), __label(src.__label) {
214  GUM_CONS_CPY(O3Label);
215  }
216 
218  __pos(std::move(src.__pos)), __label(std::move(src.__label)) {
219  GUM_CONS_MOV(O3Label);
220  }
221 
222  O3Label::~O3Label() { GUM_DESTRUCTOR(O3Label); }
223 
225  if (this == &src) { return *this; }
226  __pos = src.__pos;
227  __label = src.__label;
228  return *this;
229  }
230 
232  if (this == &src) { return *this; }
233  __pos = std::move(src.__pos);
234  __label = std::move(src.__label);
235  return *this;
236  }
237 
238  const O3Position& O3Label::position() const { return __pos; }
240 
241  const std::string& O3Label::label() const { return __label; }
242  std::string& O3Label::label() { return __label; }
243 
244  O3Type::O3Type() : __dep_flag(false) { GUM_CONSTRUCTOR(O3Type); }
245 
246  O3Type::O3Type(const O3Type& src) :
249  GUM_CONS_CPY(O3Type);
250  }
251 
253  __pos(std::move(src.__pos)), __name(std::move(src.__name)),
254  __superLabel(std::move(src.__superLabel)),
255  __labels(std::move(src.__labels)),
256  __dep_flag(std::move(src.__dep_flag)) {
257  GUM_CONS_MOV(O3Type);
258  }
259 
260  O3Type::~O3Type() { GUM_DESTRUCTOR(O3Type); }
261 
263  if (this == &src) { return *this; }
264  __pos = src.__pos;
265  __name = src.__name;
267  __labels = src.__labels;
268  __dep_flag = src.__dep_flag;
269  return *this;
270  }
271 
273  if (this == &src) { return *this; }
274  __pos = std::move(src.__pos);
275  __name = std::move(src.__name);
276  __superLabel = std::move(src.__superLabel);
277  __labels = std::move(src.__labels);
278  __dep_flag = std::move(src.__dep_flag);
279  return *this;
280  }
281 
282  O3Label& O3Type::name() { return __name; }
283  const O3Label& O3Type::name() const { return __name; }
284 
286  const O3Label& O3Type::superLabel() const { return __superLabel; }
287 
289  const O3Type::LabelMap& O3Type::labels() const { return __labels; }
290 
292  const O3Position& O3Type::position() const { return __pos; }
293 
294  bool& O3Type::deprecated() { return __dep_flag; }
295  const bool& O3Type::deprecated() const { return __dep_flag; }
296 
297  O3IntType::O3IntType() : __dep_flag(false) { GUM_CONSTRUCTOR(O3IntType); }
298 
300  __pos(src.__pos), __name(src.__name), __start(src.__start),
301  __end(src.__end), __dep_flag(src.__dep_flag) {
302  GUM_CONS_CPY(O3IntType);
303  }
304 
306  __pos(std::move(src.__pos)), __name(std::move(src.__name)),
307  __start(std::move(src.__start)), __end(std::move(src.__end)),
308  __dep_flag(std::move(src.__dep_flag)) {
309  GUM_CONS_MOV(O3IntType);
310  }
311 
312  O3IntType::~O3IntType() { GUM_DESTRUCTOR(O3IntType); }
313 
315  if (this == &src) { return *this; }
316  __pos = src.__pos;
317  __name = src.__name;
318  __start = src.__start;
319  __end = src.__end;
320  __dep_flag = src.__dep_flag;
321  return *this;
322  }
323 
325  if (this == &src) { return *this; }
326  __pos = std::move(src.__pos);
327  __name = std::move(src.__name);
328  __start = std::move(src.__start);
329  __end = std::move(src.__end);
330  __dep_flag = std::move(src.__dep_flag);
331  return *this;
332  }
333 
335  const O3Label& O3IntType::name() const { return __name; }
336 
338  const O3Integer& O3IntType::start() const { return __start; }
339 
341  const O3Integer& O3IntType::end() const { return __end; }
342 
344  const O3Position& O3IntType::position() const { return __pos; }
345 
346  bool& O3IntType::deprecated() { return __dep_flag; }
347  const bool& O3IntType::deprecated() const { return __dep_flag; }
348 
349  O3RealType::O3RealType() : __dep_flag(false) { GUM_CONSTRUCTOR(O3RealType); }
350 
352  __pos(src.__pos), __name(src.__name), __values(src.__values),
353  __dep_flag(src.__dep_flag) {
354  GUM_CONS_CPY(O3RealType);
355  }
356 
358  __pos(std::move(src.__pos)), __name(std::move(src.__name)),
359  __values(std::move(src.__values)),
360  __dep_flag(std::move(src.__dep_flag)) {
361  GUM_CONS_MOV(O3RealType);
362  }
363 
364  O3RealType::~O3RealType() { GUM_DESTRUCTOR(O3RealType); }
365 
367  if (this == &src) { return *this; }
368 
369  __pos = src.__pos;
370  __name = src.__name;
371  __values = src.__values;
372  __dep_flag = src.__dep_flag;
373  return *this;
374  }
375 
377  if (this == &src) { return *this; }
378 
379  __pos = std::move(src.__pos);
380  __name = std::move(src.__name);
381  __values = std::move(src.__values);
382  __dep_flag = std::move(src.__dep_flag);
383  return *this;
384  }
385 
387  const O3Position& O3RealType::position() const { return __pos; }
388 
390  const O3Label& O3RealType::name() const { return __name; }
391 
392  std::vector< O3Float >& O3RealType::values() { return __values; }
393  const std::vector< O3Float >& O3RealType::values() const { return __values; }
394 
395  bool& O3RealType::deprecated() { return __dep_flag; }
396  const bool& O3RealType::deprecated() const { return __dep_flag; }
397 
399  GUM_CONSTRUCTOR(O3PRM);
400  // Creating the boolean type
401  auto name = O3Label(O3Position(), "boolean");
402  auto f = O3Label(O3Position(), "false");
403  auto t = O3Label(O3Position(), "true");
404  auto labels = O3Type::LabelMap();
405  labels.push_back(O3Type::LabelPair(f, O3Label()));
406  labels.push_back(O3Type::LabelPair(t, O3Label()));
407  auto boolean = std::unique_ptr< O3Type >(new O3Type());
408  boolean->name() = std::move(name);
409  boolean->labels() = std::move(labels);
410  __types.push_back(std::move(boolean));
411  }
412 
413  O3PRM::O3PRM(const O3PRM& src) {
414  GUM_CONS_CPY(O3PRM);
415  for (const auto& t : src.__types) {
416  __types.emplace_back(new O3Type(*t));
417  }
418  for (const auto& t : src.__int_types) {
419  __int_types.emplace_back(new O3IntType(*t));
420  }
421  for (const auto& t : src.__real_types) {
422  __real_types.emplace_back(new O3RealType(*t));
423  }
424  for (const auto& i : src.__interfaces) {
425  __interfaces.emplace_back(new O3Interface(*i));
426  }
427  for (const auto& c : src.__classes) {
428  __classes.emplace_back(new O3Class(*c));
429  }
430  for (const auto& s : src.__systems) {
431  __systems.emplace_back(new O3System(*s));
432  }
433  for (const auto& i : src.__imports) {
434  __imports.emplace_back(new O3Import(*i));
435  }
436  }
437 
439  __types(std::move(src.__types)), __int_types(std::move(src.__int_types)),
440  __real_types(std::move(src.__real_types)),
441  __interfaces(std::move(src.__interfaces)),
442  __classes(std::move(src.__classes)), __systems(std::move(src.__systems)),
443  __imports(std::move(src.__imports)) {
444  GUM_CONS_MOV(O3PRM);
445  }
446 
447  O3PRM::~O3PRM() { GUM_DESTRUCTOR(O3PRM); }
448 
449  O3PRM& O3PRM::operator=(const O3PRM& src) {
450  if (this == &src) { return *this; }
451  for (const auto& t : src.__types) {
452  __types.emplace_back(new O3Type(*t));
453  }
454  for (const auto& t : src.__int_types) {
455  __int_types.emplace_back(new O3IntType(*t));
456  }
457  for (const auto& t : src.__real_types) {
458  __real_types.emplace_back(new O3RealType(*t));
459  }
460  for (const auto& i : src.__interfaces) {
461  __interfaces.emplace_back(new O3Interface(*i));
462  }
463  for (const auto& c : src.__classes) {
464  __classes.emplace_back(new O3Class(*c));
465  }
466  for (const auto& s : src.__systems) {
467  __systems.emplace_back(new O3System(*s));
468  }
469  for (const auto& i : src.__imports) {
470  __imports.emplace_back(new O3Import(*i));
471  }
472  return *this;
473  }
474 
476  if (this == &src) { return *this; }
477  __types = std::move(src.__types);
478  __int_types = std::move(src.__int_types);
479  __real_types = std::move(src.__real_types);
480  __interfaces = std::move(src.__interfaces);
481  __classes = std::move(src.__classes);
482  __systems = std::move(src.__systems);
483  __imports = std::move(src.__imports);
484  return *this;
485  }
486 
488  const O3PRM::O3TypeList& O3PRM::types() const { return __types; }
489 
492 
495  return __real_types;
496  }
497 
500  return __interfaces;
501  }
502 
504 
505  const O3PRM::O3ClassList& O3PRM::classes() const { return __classes; }
506 
508 
509  const O3PRM::O3SystemList& O3PRM::systems() const { return __systems; }
510 
512 
513  const O3PRM::O3ImportList& O3PRM::imports() const { return __imports; }
514 
516  GUM_CONSTRUCTOR(O3InterfaceElement);
517  }
518 
520  const O3Label& name,
521  bool isArray) :
522  __type(type),
523  __name(name), __isArray(isArray) {
524  GUM_CONSTRUCTOR(O3InterfaceElement);
525  }
526 
528  __type(src.__type), __name(src.__name), __isArray(src.__isArray) {
529  GUM_CONS_CPY(O3InterfaceElement);
530  }
531 
533  __type(std::move(src.__type)), __name(std::move(src.__name)),
534  __isArray(std::move(src.__isArray)) {
535  GUM_CONS_MOV(O3InterfaceElement);
536  }
537 
539  GUM_DESTRUCTOR(O3InterfaceElement);
540  }
541 
544  if (this == &src) { return *this; }
545  __type = src.__type;
546  __name = src.__name;
547  __isArray = src.__isArray;
548  return *this;
549  }
550 
552  if (this == &src) { return *this; }
553  __type = std::move(src.__type);
554  __name = std::move(src.__name);
555  __isArray = std::move(src.__isArray);
556  return *this;
557  }
558 
560  const O3Label& O3InterfaceElement::type() const { return __type; }
561 
563  const O3Label& O3InterfaceElement::name() const { return __name; }
564 
566  bool O3InterfaceElement::isArray() const { return __isArray; }
567 
569  GUM_CONSTRUCTOR(O3Interface);
570  }
571 
573  __pos(src.__pos), __name(src.__name), __superLabel(src.__superLabel) {
574  GUM_CONS_CPY(O3Interface);
575  auto copy = new O3InterfaceElementList(src.elements());
576  __elts = std::unique_ptr< O3InterfaceElementList >(copy);
577  }
578 
580  __pos(std::move(src.__pos)), __name(std::move(src.__name)),
581  __superLabel(std::move(src.__superLabel)),
582  __elts(std::move(src.__elts)) {
583  GUM_CONS_MOV(O3Interface);
584  }
585 
586  O3Interface::~O3Interface() { GUM_DESTRUCTOR(O3Interface); }
587 
589  if (this == &src) { return *this; }
590  __pos = src.__pos;
591  __name = src.__name;
593  auto copy = new O3InterfaceElementList(src.elements());
594  __elts = std::unique_ptr< O3InterfaceElementList >(copy);
595  return *this;
596  }
597 
599  if (this == &src) { return *this; }
600  __pos = std::move(src.__pos);
601  __name = std::move(src.__name);
602  __superLabel = std::move(src.__superLabel);
603  __elts = std::move(src.__elts);
604  return *this;
605  }
606 
608  const O3Position& O3Interface::position() const { return __pos; }
609 
611  const O3Label& O3Interface::name() const { return __name; }
612 
614  const O3Label& O3Interface::superLabel() const { return __superLabel; }
615 
617  return *__elts;
618  }
620  return *__elts;
621  }
622 
623  O3Attribute::O3Attribute() { GUM_CONSTRUCTOR(O3Attribute); }
624 
626  const O3Label& name,
627  const O3LabelList& parents) :
628  __type(type),
629  __name(name), __parents(parents) {
630  GUM_CONSTRUCTOR(O3Attribute);
631  }
632 
634  __type(src.__type), __name(src.__name), __parents(src.__parents) {
635  GUM_CONS_CPY(O3Attribute);
636  }
637 
639  __type(std::move(src.__type)), __name(std::move(src.__name)),
640  __parents(std::move(src.__parents)) {
641  GUM_CONS_MOV(O3Attribute);
642  }
643 
644  O3Attribute::~O3Attribute() { GUM_DESTRUCTOR(O3Attribute); }
645 
647  if (this == &src) { return *this; }
648  __type = src.__type;
649  __name = src.__name;
650  __parents = src.__parents;
651  return *this;
652  }
653 
655  if (this == &src) { return *this; }
656  __type = std::move(src.__type);
657  __name = std::move(src.__name);
658  __parents = std::move(src.__parents);
659  return *this;
660  }
661 
663  const O3Label& O3Attribute::type() const { return __type; }
664 
666  const O3Label& O3Attribute::name() const { return __name; }
667 
670  return __parents;
671  }
672 
674  GUM_CONSTRUCTOR(O3RawCPT);
675  }
676 
678  const O3Label& name,
679  const O3LabelList& parents,
680  const O3FormulaList& values) :
681  O3Attribute(type, name, parents) {
682  GUM_CONSTRUCTOR(O3RawCPT);
683  auto copy = new O3FormulaList(values);
684  __values = std::unique_ptr< O3FormulaList >(copy);
685  }
686 
688  GUM_CONS_CPY(O3RawCPT);
689  auto copy = new O3FormulaList(*(src.__values));
690  __values = std::unique_ptr< O3FormulaList >(copy);
691  }
692 
694  O3Attribute(src), __values(std::move(src.__values)) {
695  GUM_CONS_MOV(O3RawCPT);
696  }
697 
698  O3RawCPT::~O3RawCPT() { GUM_DESTRUCTOR(O3RawCPT); }
699 
701  if (this == &src) { return *this; }
703  auto copy = new O3FormulaList(*(src.__values));
704  __values = std::unique_ptr< O3FormulaList >(copy);
705  return *this;
706  }
707 
709  if (this == &src) { return *this; }
711  __values = std::move(src.__values);
712  return *this;
713  }
714 
716 
718 
719  std::unique_ptr< O3Attribute > O3RawCPT::copy() const {
720  auto copy = new O3RawCPT(*this);
721  return std::unique_ptr< O3Attribute >(copy);
722  }
723 
725  GUM_CONSTRUCTOR(O3RuleCPT);
726  }
727 
729  const O3Label& name,
731  O3RuleList&& rules) :
732  O3Attribute(type, name, parents),
733  __rules(std::unique_ptr< O3RuleList >(new O3RuleList(rules))) {
734  GUM_CONSTRUCTOR(O3RuleCPT);
735  }
736 
738  O3Attribute(src),
739  __rules(std::unique_ptr< O3RuleList >(new O3RuleList(src.rules()))) {
740  GUM_CONS_CPY(O3RuleCPT);
741  }
742 
744  O3Attribute(src), __rules(std::move(src.__rules)) {
745  GUM_CONS_MOV(O3RuleCPT);
746  }
747 
748  O3RuleCPT::~O3RuleCPT() { GUM_DESTRUCTOR(O3RuleCPT); }
749 
751  if (this == &src) { return *this; }
752 
754  __rules = std::unique_ptr< O3RuleList >(new O3RuleList(src.rules()));
755  return *this;
756  }
757 
759  if (this == &src) { return *this; }
760 
762  __rules = std::move(src.__rules);
763  return *this;
764  }
765 
767  const O3RuleCPT::O3RuleList& O3RuleCPT::rules() const { return *__rules; }
768 
769  std::unique_ptr< O3Attribute > O3RuleCPT::copy() const {
770  auto copy = new O3RuleCPT(*this);
771  return std::unique_ptr< O3Attribute >(copy);
772  }
773 
775  GUM_CONSTRUCTOR(O3Class);
776 
777  auto i = new O3LabelList();
778  __interfaces = std::unique_ptr< O3LabelList >(i);
779 
780  auto p = new O3ParameterList();
781  __params = std::unique_ptr< O3ParameterList >(p);
782 
783  auto r = new O3ReferenceSlotList();
784  __refs = std::unique_ptr< O3ReferenceSlotList >(r);
785 
786  auto e = new O3AttributeList();
787  __attrs = std::unique_ptr< O3AttributeList >(e);
788 
789  auto a = new O3AggregateList();
790  __aggs = std::unique_ptr< O3AggregateList >(a);
791  }
792 
793  O3Class::O3Class(const O3Class& src) :
794  __pos(src.__pos), __name(src.__name), __superLabel(src.__superLabel) {
795  GUM_CONS_CPY(O3Class);
796  auto i = new O3LabelList(src.interfaces());
797  __interfaces = std::unique_ptr< O3LabelList >(i);
798 
799  auto p = new O3ParameterList(src.parameters());
800  __params = std::unique_ptr< O3ParameterList >(p);
801 
802  auto r = new O3ReferenceSlotList(src.referenceSlots());
803  __refs = std::unique_ptr< O3ReferenceSlotList >(r);
804 
805  auto e = new O3AttributeList();
806  __attrs = std::unique_ptr< O3AttributeList >(e);
807  for (const auto& elt : src.attributes()) {
808  __attrs->push_back(elt->copy());
809  }
810 
811  auto a = new O3AggregateList(src.aggregates());
812  __aggs = std::unique_ptr< O3AggregateList >(a);
813  }
814 
816  __pos(std::move(src.__pos)), __name(std::move(src.__name)),
817  __superLabel(std::move(src.__superLabel)),
818  __interfaces(std::move(src.__interfaces)),
819  __params(std::move(src.__params)), __refs(std::move(src.__refs)),
820  __attrs(std::move(src.__attrs)), __aggs(std::move(src.__aggs)) {
821  GUM_CONS_MOV(O3Class);
822  }
823 
824  O3Class::~O3Class() { GUM_DESTRUCTOR(O3Class); }
825 
827  if (this == &src) { return *this; }
828  __pos = src.__pos;
829  __name = src.__name;
831 
832  auto i = new O3LabelList(src.interfaces());
833  __interfaces = std::unique_ptr< O3LabelList >(i);
834 
835  auto p = new O3ParameterList(src.parameters());
836  __params = std::unique_ptr< O3ParameterList >(p);
837 
838  auto r = new O3ReferenceSlotList(src.referenceSlots());
839  __refs = std::unique_ptr< O3ReferenceSlotList >(r);
840 
841  auto e = new O3AttributeList();
842  __attrs = std::unique_ptr< O3AttributeList >(e);
843  for (const auto& elt : src.attributes()) {
844  __attrs->push_back(elt->copy());
845  }
846 
847  auto a = new O3AggregateList(src.aggregates());
848  __aggs = std::unique_ptr< O3AggregateList >(a);
849  return *this;
850  }
851 
853  if (this == &src) { return *this; }
854  __pos = std::move(src.__pos);
855  __name = std::move(src.__name);
856  __superLabel = std::move(src.__superLabel);
857  __interfaces = std::move(src.__interfaces);
858  __params = std::move(src.__params);
859  __refs = std::move(src.__refs);
860  __attrs = std::move(src.__attrs);
861  __aggs = std::move(src.__aggs);
862  return *this;
863  }
864 
865  const O3Position& O3Class::position() const { return __pos; }
867 
868  const O3Label& O3Class::name() const { return __name; }
869  O3Label& O3Class::name() { return __name; }
870 
871  const O3Label& O3Class::superLabel() const { return __superLabel; }
873 
875  return *__interfaces;
876  }
878 
880  return *__params;
881  }
883 
885  return *__refs;
886  }
888 
890 
892  return *__attrs;
893  }
894 
897  return *__aggs;
898  }
899 
901  GUM_CONSTRUCTOR(O3Parameter);
902  }
903 
905  const O3Label& name,
906  const O3Integer& value) :
907  __type(O3Parameter::PRMType::INT),
908  __pos(pos), __name(name),
909  __value(O3Float(value.position(), (float)value.value())) {
910  GUM_CONSTRUCTOR(O3Parameter);
911  }
912 
914  const O3Label& name,
915  const O3Float& value) :
916  __type(O3Parameter::PRMType::FLOAT),
917  __pos(pos), __name(name), __value(value) {
918  GUM_CONSTRUCTOR(O3Parameter);
919  }
920 
922  __type(src.__type), __pos(src.__pos), __name(src.__name),
923  __value(src.__value) {
924  GUM_CONS_CPY(O3Parameter);
925  }
926 
928  __type(std::move(src.__type)), __pos(std::move(src.__pos)),
929  __name(std::move(src.__name)), __value(std::move(src.__value)) {
930  GUM_CONS_MOV(O3Parameter);
931  }
932 
933  O3Parameter::~O3Parameter() { GUM_DESTRUCTOR(O3Parameter); }
934 
936  if (this == &src) { return *this; }
937  __type = src.__type;
938  __pos = src.__pos;
939  __name = src.__name;
940  __value = src.__value;
941  return *this;
942  }
943 
945  if (this == &src) { return *this; }
946  __type = std::move(src.__type);
947  __pos = std::move(src.__pos);
948  __name = std::move(src.__name);
949  __value = std::move(src.__value);
950  return *this;
951  }
952 
955 
957  const O3Position& O3Parameter::position() const { return __pos; }
958 
960  const O3Label& O3Parameter::name() const { return __name; }
961 
963  const O3Float& O3Parameter::value() const { return __value; }
964 
966 
968  const O3Label& name,
969  bool isArray) :
970  __type(type),
971  __name(name), __isArray(isArray) {
972  GUM_CONSTRUCTOR(O3ReferenceSlot);
973  }
974 
976  __type(src.__type), __name(src.__name), __isArray(src.__isArray) {
977  GUM_CONS_CPY(O3ReferenceSlot);
978  }
979 
981  __type(std::move(src.__type)), __name(std::move(src.__name)),
982  __isArray(std::move(src.__isArray)) {
983  GUM_CONS_MOV(O3ReferenceSlot);
984  }
985 
987 
989  if (this == &src) { return *this; }
990  __type = src.__type;
991  __name = src.__name;
992  __isArray = src.__isArray;
993  return *this;
994  }
995 
997  if (this == &src) { return *this; }
998  __type = std::move(src.__type);
999  __name = std::move(src.__name);
1000  __isArray = std::move(src.__isArray);
1001  return *this;
1002  }
1003 
1005  const O3Label& O3ReferenceSlot::type() const { return __type; }
1006 
1008  const O3Label& O3ReferenceSlot::name() const { return __name; }
1009 
1011  bool O3ReferenceSlot::isArray() const { return __isArray; }
1012 
1014  __variableType(), __aggregateType(), __name(), __parents(),
1015  __parameters() {
1016  GUM_CONSTRUCTOR(O3Aggregate);
1017  }
1018 
1021  __name(src.__name), __parents(src.__parents),
1022  __parameters(src.__parameters) {
1023  GUM_CONS_CPY(O3Aggregate);
1024  }
1025 
1027  __variableType(std::move(src.__variableType)),
1028  __aggregateType(std::move(src.__aggregateType)),
1029  __name(std::move(src.__name)), __parents(std::move(src.__parents)),
1030  __parameters(std::move(src.__parameters)) {
1031  GUM_CONS_MOV(O3Aggregate);
1032  }
1033 
1035 
1037  if (this == &src) { return *this; }
1040  __name = src.__name;
1041  __parents = src.__parents;
1042  __parameters = src.__parameters;
1043  return *this;
1044  }
1045 
1047  if (this == &src) { return *this; }
1048  __aggregateType = std::move(src.__aggregateType);
1049  __variableType = std::move(src.__variableType);
1050  __name = std::move(src.__name);
1051  __parents = std::move(src.__parents);
1052  __parameters = std::move(src.__parameters);
1053  return *this;
1054  }
1055 
1057 
1059 
1061 
1063 
1065 
1066  const O3Label& O3Aggregate::name() const { return __name; }
1067 
1069 
1071  return __parents;
1072  }
1073 
1075 
1077  return __parameters;
1078  }
1079 
1081 
1083  __leftInstance(src.__leftInstance), __leftIndex(src.__leftIndex),
1084  __leftReference(src.__leftReference),
1085  __rightInstance(src.__rightInstance), __rightIndex(src.__rightIndex) {
1086  GUM_CONS_CPY(O3Assignment);
1087  }
1088 
1090  __leftInstance(std::move(src.__leftInstance)),
1091  __leftIndex(std::move(src.__leftIndex)),
1092  __leftReference(std::move(src.__leftReference)),
1093  __rightInstance(std::move(src.__rightInstance)),
1094  __rightIndex(std::move(src.__rightIndex)) {
1095  GUM_CONS_CPY(O3Assignment);
1096  }
1097 
1099 
1101  if (this == &src) { return *this; }
1103  __leftIndex = src.__leftIndex;
1106  __rightIndex = src.__rightIndex;
1107  return *this;
1108  }
1109 
1111  if (this == &src) { return *this; }
1112  __leftInstance = std::move(src.__leftInstance);
1113  __leftIndex = std::move(src.__leftIndex);
1114  __leftReference = std::move(src.__leftReference);
1115  __rightInstance = std::move(src.__rightInstance);
1116  __rightIndex = std::move(src.__rightIndex);
1117  return *this;
1118  }
1119 
1121 
1123 
1124  const O3Integer& O3Assignment::leftIndex() const { return __leftIndex; }
1125 
1127 
1129  return __leftReference;
1130  }
1131 
1133 
1135  return __rightInstance;
1136  }
1137 
1139 
1141 
1143 
1144  O3Increment::O3Increment() { GUM_CONSTRUCTOR(O3Increment); }
1145 
1150  GUM_CONS_CPY(O3Increment);
1151  }
1152 
1154  __leftInstance(std::move(src.__leftInstance)),
1155  __leftIndex(std::move(src.__leftIndex)),
1156  __leftReference(std::move(src.__leftReference)),
1157  __rightInstance(std::move(src.__rightInstance)),
1158  __rightIndex(std::move(src.__rightIndex)) {
1159  GUM_CONS_CPY(O3Increment);
1160  }
1161 
1163 
1165  if (this == &src) { return *this; }
1167  __leftIndex = src.__leftIndex;
1170  __rightIndex = src.__rightIndex;
1171  return *this;
1172  }
1173 
1175  if (this == &src) { return *this; }
1176  __leftInstance = std::move(src.__leftInstance);
1177  __leftIndex = std::move(src.__leftIndex);
1178  __leftReference = std::move(src.__leftReference);
1179  __rightInstance = std::move(src.__rightInstance);
1180  __rightIndex = std::move(src.__rightIndex);
1181  return *this;
1182  }
1183 
1185 
1187 
1188  const O3Integer& O3Increment::leftIndex() const { return __leftIndex; }
1189 
1191 
1193 
1195 
1197 
1200 
1202 
1203  O3Instance::O3Instance() { GUM_CONSTRUCTOR(O3Instance); }
1204 
1206  __type(src.__type), __name(src.__name), __size(src.__size),
1207  __parameters(src.__parameters) {
1208  GUM_CONS_CPY(O3Instance);
1209  }
1210 
1212  __type(std::move(src.__type)), __name(std::move(src.__name)),
1213  __size(std::move(src.__size)),
1214  __parameters(std::move(src.__parameters)) {
1215  GUM_CONS_MOV(O3Instance);
1216  }
1217 
1218  O3Instance::~O3Instance() { GUM_DESTRUCTOR(O3Instance); }
1219 
1221  if (this == &src) { return *this; }
1222  __type = src.__type;
1223  __name = src.__name;
1224  __size = src.__size;
1225  __parameters = src.__parameters;
1226  return *this;
1227  }
1228 
1230  if (this == &src) { return *this; }
1231  __type = std::move(src.__type);
1232  __name = std::move(src.__name);
1233  __size = std::move(src.__size);
1234  __parameters = std::move(src.__parameters);
1235  return *this;
1236  }
1237 
1238  const O3Label& O3Instance::type() const { return __type; }
1239 
1241 
1242  const O3Label& O3Instance::name() const { return __name; }
1243 
1245 
1246  const O3Integer& O3Instance::size() const { return __size; }
1247 
1249 
1251  return __parameters;
1252  }
1253 
1255  return __parameters;
1256  }
1257 
1258  O3System::O3System() { GUM_CONSTRUCTOR(O3System); }
1259 
1261  __name(src.__name), __instances(src.__instances),
1262  __assigments(src.__assigments), __increments(src.__increments) {
1263  GUM_CONS_CPY(O3System);
1264  }
1265 
1267  __name(std::move(src.__name)), __instances(std::move(src.__instances)),
1268  __assigments(std::move(src.__assigments)),
1269  __increments(std::move(src.__increments)) {
1270  GUM_CONS_MOV(O3System);
1271  }
1272 
1273  O3System::~O3System() { GUM_DESTRUCTOR(O3System); }
1274 
1276  if (this == &src) { return *this; }
1277  __name = src.__name;
1278  __instances = src.__instances;
1279  __assigments = src.__assigments;
1280  __increments = src.__increments;
1281  return *this;
1282  }
1283 
1285  if (this == &src) { return *this; }
1286  __name = std::move(src.__name);
1287  __instances = std::move(src.__instances);
1288  __assigments = std::move(src.__assigments);
1289  __increments = std::move(src.__increments);
1290  return *this;
1291  }
1292 
1293  const O3Label& O3System::name() const { return __name; }
1294 
1296 
1298  return __instances;
1299  }
1300 
1302 
1304  return __assigments;
1305  }
1306 
1308 
1310  return __increments;
1311  }
1312 
1314 
1315  std::ostream& operator<<(std::ostream& o, const O3Label& src) {
1316  o << src.label();
1317  return o;
1318  }
1319 
1321  GUM_CONSTRUCTOR(O3InstanceParameter);
1322  }
1323 
1325  __name(src.__name), __value(src.__value), __isInteger(src.__isInteger) {
1326  GUM_CONS_CPY(O3InstanceParameter);
1327  }
1328 
1330  __name(std::move(src.__name)), __value(std::move(src.__value)),
1331  __isInteger(std::move(src.__isInteger)) {
1332  GUM_CONS_MOV(O3InstanceParameter);
1333  }
1334 
1336  GUM_DESTRUCTOR(O3InstanceParameter);
1337  }
1338 
1341  if (this == &src) { return *this; }
1342  __name = src.__name;
1343  __value = src.__value;
1344  __isInteger = src.__isInteger;
1345  return *this;
1346  }
1347 
1350  if (this == &src) { return *this; }
1351  __name = std::move(src.__name);
1352  __value = std::move(src.__value);
1353  __isInteger = std::move(src.__isInteger);
1354  return *this;
1355  }
1356 
1357  const O3Label& O3InstanceParameter::name() const { return __name; }
1358 
1360 
1361  const O3Float& O3InstanceParameter::value() const { return __value; }
1362 
1364 
1366 
1368 
1369  O3Import::O3Import() { GUM_CONSTRUCTOR(O3Import); }
1370 
1371  O3Import::O3Import(const O3Import& src) : __import(src.__import) {
1372  GUM_CONSTRUCTOR(O3Import);
1373  }
1374 
1376  GUM_CONS_MOV(O3Import);
1377  }
1378 
1379  O3Import::~O3Import() { GUM_DESTRUCTOR(O3Import); }
1380 
1382  if (this == &src) { return *this; }
1383  __import = src.__import;
1384  return *this;
1385  }
1386 
1388  if (this == &src) { return *this; }
1389  __import = std::move(src.__import);
1390  return *this;
1391  }
1392 
1393  const O3Label& O3Import::import() const { return __import; }
1394 
1396 
1397  } // namespace o3prm
1398  } // namespace prm
1399 } // namespace gum
std::vector< std::unique_ptr< O3RealType > > O3RealTypeList
Definition: O3prm.h:896
virtual O3RuleCPT & operator=(const O3RuleCPT &src)
Definition: O3prm.cpp:750
O3LabelList & parents()
Definition: O3prm.cpp:1068
O3ClassList & classes()
Definition: O3prm.cpp:503
O3SystemList __systems
Definition: O3prm.h:937
O3ReferenceSlot & operator=(const O3ReferenceSlot &src)
Definition: O3prm.cpp:988
std::vector< O3ReferenceSlot > O3ReferenceSlotList
Definition: O3prm.h:623
O3IncrementList & increments()
Definition: O3prm.cpp:1313
O3LabelList __parameters
Definition: O3prm.h:609
virtual O3LabelList & parents()
Definition: O3prm.cpp:668
O3ClassList __classes
Definition: O3prm.h:936
O3Position & operator=(const O3Position &src)
Definition: O3prm.cpp:59
std::unique_ptr< O3ParameterList > __params
Definition: O3prm.h:664
O3Position & position()
Definition: O3prm.cpp:607
std::vector< O3InstanceParameter > O3InstanceParameterList
Definition: O3prm.h:792
O3IncrementList __increments
Definition: O3prm.h:858
The O3Increment is part of the AST of the O3PRM language.
Definition: O3prm.h:717
O3Position & position()
Definition: O3prm.cpp:239
O3Position & position()
Definition: O3prm.cpp:291
O3Formula & operator=(const O3Formula &src)
Definition: O3prm.cpp:185
virtual O3RuleList & rules()
Definition: O3prm.cpp:766
std::vector< O3Increment > O3IncrementList
Definition: O3prm.h:832
The O3InstanceParameter is part of the AST of the O3PRM language.
Definition: O3prm.h:758
O3Position __pos
Definition: O3prm.h:660
O3Increment & operator=(const O3Increment &src)
Definition: O3prm.cpp:1164
The O3Parameter is part of the AST of the O3PRM language.
Definition: O3prm.h:394
std::vector< O3Label > O3LabelList
Definition: O3prm.h:544
O3PRM & operator=(const O3PRM &src)
Definition: O3prm.cpp:449
The O3IntType is part of the AST of the O3PRM language.
Definition: O3prm.h:247
O3Label & name()
Definition: O3prm.cpp:282
O3Position & position()
Definition: O3prm.cpp:343
O3Position & position()
Definition: O3prm.cpp:956
O3ReferenceSlotList & referenceSlots()
Definition: O3prm.cpp:887
Evaluates a string as a algebraic formula.
Definition: formula.h:274
std::unique_ptr< O3ReferenceSlotList > __refs
Definition: O3prm.h:665
O3Position __pos
Definition: O3prm.h:133
O3RealTypeList & real_types()
Definition: O3prm.cpp:493
O3Interface & operator=(const O3Interface &src)
Definition: O3prm.cpp:588
std::vector< std::unique_ptr< O3Attribute > > O3AttributeList
Definition: O3prm.h:624
std::unique_ptr< O3LabelList > __interfaces
Definition: O3prm.h:663
std::vector< std::unique_ptr< O3Import > > O3ImportList
Definition: O3prm.h:900
The O3Aggregate is part of the AST of the O3PRM language.
Definition: O3prm.h:577
O3AggregateList & aggregates()
Definition: O3prm.cpp:895
std::ostream & operator<<(std::ostream &o, const O3Label &src)
Definition: O3prm.cpp:1315
STL namespace.
std::vector< std::unique_ptr< O3IntType > > O3IntTypeList
Definition: O3prm.h:895
The O3RealType is part of the AST of the O3PRM language.
Definition: O3prm.h:287
O3Integer & start()
Definition: O3prm.cpp:337
std::unique_ptr< O3AttributeList > __attrs
Definition: O3prm.h:666
O3InstanceParameterList & parameters()
Definition: O3prm.cpp:1254
std::vector< O3Label > O3LabelList
Definition: O3prm.h:621
The O3Type is part of the AST of the O3PRM language.
Definition: O3prm.h:204
O3RealType & operator=(const O3RealType &src)
Definition: O3prm.cpp:366
O3InstanceList & instances()
Definition: O3prm.cpp:1301
O3Assignment & operator=(const O3Assignment &src)
Definition: O3prm.cpp:1100
The O3Label is part of the AST of the O3PRM language.
Definition: O3prm.h:173
The O3Attribute is part of the AST of the O3PRM language.
Definition: O3prm.h:471
O3Position & position()
Definition: O3prm.cpp:157
virtual O3FormulaList & values()
Definition: O3prm.cpp:715
std::unique_ptr< O3FormulaList > __values
Definition: O3prm.h:532
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
O3RealTypeList __real_types
Definition: O3prm.h:934
The O3Import is part of the AST of the O3PRM language.
Definition: O3prm.h:868
O3LabelList & parameters()
Definition: O3prm.cpp:1074
O3ParameterList & parameters()
Definition: O3prm.cpp:882
std::string __file
Definition: O3prm.h:74
std::vector< O3Label > O3LabelList
Definition: O3prm.h:473
std::string & label()
Definition: O3prm.cpp:242
virtual std::unique_ptr< O3Attribute > copy() const
Definition: O3prm.cpp:719
virtual O3Attribute & operator=(const O3Attribute &src)
Definition: O3prm.cpp:646
std::vector< O3Formula > O3FormulaList
Definition: O3prm.h:512
std::string & file()
Definition: O3prm.cpp:75
O3IntTypeList __int_types
Definition: O3prm.h:933
O3Parameter & operator=(const O3Parameter &src)
Definition: O3prm.cpp:935
std::vector< std::unique_ptr< O3Interface > > O3InterfaceList
Definition: O3prm.h:897
The O3RuleCPT is part of the AST of the O3PRM language.
Definition: O3prm.h:542
std::vector< O3Float > & values()
Definition: O3prm.cpp:392
The O3Position is part of the AST of the O3PRM language.
Definition: O3prm.h:53
std::unique_ptr< O3AggregateList > __aggs
Definition: O3prm.h:667
std::vector< O3Float > __values
Definition: O3prm.h:312
std::unique_ptr< O3RuleList > __rules
Definition: O3prm.h:567
std::vector< std::unique_ptr< O3Class > > O3ClassList
Definition: O3prm.h:898
O3Position __pos
Definition: O3prm.h:191
The O3Class is part of the AST of the O3PRM language.
Definition: O3prm.h:619
O3Label & superLabel()
Definition: O3prm.cpp:872
O3Integer & rightIndex()
Definition: O3prm.cpp:1198
std::vector< O3Rule > O3RuleList
Definition: O3prm.h:547
virtual O3RawCPT & operator=(const O3RawCPT &src)
Definition: O3prm.cpp:700
O3TypeList __types
Definition: O3prm.h:932
O3Integer & operator=(const O3Integer &src)
Definition: O3prm.cpp:103
std::string __label
Definition: O3prm.h:192
The O3Instance is part of the AST of the O3PRM language.
Definition: O3prm.h:790
O3IntType & operator=(const O3IntType &src)
Definition: O3prm.cpp:314
O3ImportList & imports()
Definition: O3prm.cpp:511
O3Position & position()
Definition: O3prm.cpp:118
std::unique_ptr< O3InterfaceElementList > __elts
Definition: O3prm.h:384
The O3ReferenceSlot is part of the AST of the O3PRM language.
Definition: O3prm.h:438
std::vector< LabelPair > LabelMap
Definition: O3prm.h:207
virtual O3Label & type()
Definition: O3prm.cpp:662
O3AssignmentList & assignments()
Definition: O3prm.cpp:1307
O3IntTypeList & int_types()
Definition: O3prm.cpp:490
O3InstanceParameterList __parameters
Definition: O3prm.h:818
O3Instance & operator=(const O3Instance &src)
Definition: O3prm.cpp:1220
std::vector< O3Aggregate > O3AggregateList
Definition: O3prm.h:625
std::vector< O3Parameter > O3ParameterList
Definition: O3prm.h:622
O3Aggregate & operator=(const O3Aggregate &src)
Definition: O3prm.cpp:1036
std::pair< O3Label, O3Label > LabelPair
Definition: O3prm.h:206
The O3System is part of the AST of the O3PRM language.
Definition: O3prm.h:828
std::vector< std::unique_ptr< O3Type > > O3TypeList
Definition: O3prm.h:894
O3AttributeList & attributes()
Definition: O3prm.cpp:889
virtual std::unique_ptr< O3Attribute > copy() const
Definition: O3prm.cpp:769
O3SystemList & systems()
Definition: O3prm.cpp:507
O3InterfaceList __interfaces
Definition: O3prm.h:935
O3InterfaceList & interfaces()
Definition: O3prm.cpp:498
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
O3InterfaceElementList & elements()
Definition: O3prm.cpp:616
The O3Float is part of the AST of the O3PRM language.
Definition: O3prm.h:115
O3Position & position()
Definition: O3prm.cpp:386
The O3RawCPT is part of the AST of the O3PRM language.
Definition: O3prm.h:510
O3ImportList __imports
Definition: O3prm.h:938
std::vector< O3Label > O3LabelList
Definition: O3prm.h:579
O3InterfaceElement & operator=(const O3InterfaceElement &src)
Definition: O3prm.cpp:543
O3Import & operator=(const O3Import &src)
Definition: O3prm.cpp:1381
The O3Assignment is part of the AST of the O3PRM language.
Definition: O3prm.h:677
std::vector< O3InterfaceElement > O3InterfaceElementList
Definition: O3prm.h:358
O3Label & superLabel()
Definition: O3prm.cpp:285
O3LabelList & interfaces()
Definition: O3prm.cpp:877
O3Float & operator=(const O3Float &src)
Definition: O3prm.cpp:142
O3TypeList & types()
Definition: O3prm.cpp:487
std::unique_ptr< Formula > __formula
Definition: O3prm.h:105
The O3Integer is part of the AST of the O3PRM language.
Definition: O3prm.h:144
std::vector< O3Instance > O3InstanceList
Definition: O3prm.h:830
The O3InterfaceElement is part of the AST of the O3PRM language.
Definition: O3prm.h:323
The O3PRM is part of the AST of the O3PRM language.
Definition: O3prm.h:892
O3Label & operator=(const O3Label &src)
Definition: O3prm.cpp:224
O3Position __pos
Definition: O3prm.h:233
O3Type & operator=(const O3Type &src)
Definition: O3prm.cpp:262
O3Position & position()
Definition: O3prm.cpp:866
O3InstanceList __instances
Definition: O3prm.h:856
O3Class & operator=(const O3Class &src)
Definition: O3prm.cpp:826
The O3Interface is part of the AST of the O3PRM language.
Definition: O3prm.h:356
O3AssignmentList __assigments
Definition: O3prm.h:857
std::vector< std::unique_ptr< O3System > > O3SystemList
Definition: O3prm.h:899
virtual O3Label & name()
Definition: O3prm.cpp:665
The O3Formula is part of the AST of the O3PRM language.
Definition: O3prm.h:86
std::vector< O3Assignment > O3AssignmentList
Definition: O3prm.h:831
LabelMap & labels()
Definition: O3prm.cpp:288
O3Position & position()
Definition: O3prm.cpp:200
O3Label __superLabel
Definition: O3prm.h:235
O3InstanceParameter & operator=(const O3InstanceParameter &src)
Definition: O3prm.cpp:1340
O3System & operator=(const O3System &src)
Definition: O3prm.cpp:1275