aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
O3prm.cpp
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
49
51
52namespace gum {
53 namespace prm {
54 namespace o3prm {
55
56 O3Position::O3Position() : _file_(""), _line_(0), _column_(0) { GUM_CONSTRUCTOR(O3Position); }
57
58 O3Position::O3Position(const std::string& file, int line, int column) :
60 GUM_CONSTRUCTOR(O3Position);
61 }
62
64 _file_(src._file_), _line_(src._line_), _column_(src._column_) {
65 GUM_CONS_CPY(O3Position);
66 }
67
69 _file_(std::move(src._file_)), _line_(std::move(src._line_)),
70 _column_(std::move(src._column_)) {
71 GUM_CONS_MOV(O3Position);
72 }
73
75 GUM_DESTRUCTOR(O3Position);
76 ;
77 }
78
80 if (this == &src) { return *this; }
81 _file_ = src._file_;
82 _line_ = src._line_;
83 _column_ = src._column_;
84 return *this;
85 }
86
88 if (this == &src) { return *this; }
89 _file_ = std::move(src._file_);
90 _line_ = std::move(src._line_);
91 _column_ = std::move(src._column_);
92 return *this;
93 }
94
95 std::string& O3Position::file() { return _file_; }
96
97 const std::string& O3Position::file() const { return _file_; }
98
99 int& O3Position::line() { return _line_; }
100
101 int O3Position::line() const { return _line_; }
102
103 int& O3Position::column() { return _column_; }
104
105 int O3Position::column() const { return _column_; }
106
108 GUM_CONSTRUCTOR(O3Integer);
109 ;
110 }
111
113 GUM_CONSTRUCTOR(O3Integer);
114 }
115
117 GUM_CONS_CPY(O3Integer);
118 }
119
121 _pos_(std::move(src._pos_)), _value_(std::move(src._value_)) {
122 GUM_CONS_MOV(O3Integer);
123 }
124
126 GUM_DESTRUCTOR(O3Integer);
127 ;
128 }
129
131 if (this == &src) { return *this; }
132 _pos_ = src._pos_;
133 _value_ = src._value_;
134 return *this;
135 }
136
138 if (this == &src) { return *this; }
139 _pos_ = std::move(src._pos_);
140 _value_ = std::move(src._value_);
141 return *this;
142 }
143
144 const O3Position& O3Integer::position() const { return _pos_; }
145
147
148 int O3Integer::value() const { return _value_; }
149
150 int& O3Integer::value() { return _value_; }
151
153 GUM_CONSTRUCTOR(O3Float);
154 ;
155 }
156
157 O3Float::O3Float(const O3Position& pos, float value) : _pos_(pos), _value_(value) {
158 GUM_CONSTRUCTOR(O3Float);
159 }
160
162 GUM_CONS_CPY(O3Float);
163 }
164
166 _pos_(std::move(src._pos_)), _value_(std::move(src._value_)) {
167 GUM_CONS_MOV(O3Float);
168 }
169
171 GUM_DESTRUCTOR(O3Float);
172 ;
173 }
174
176 if (this == &src) { return *this; }
177 _pos_ = src._pos_;
178 _value_ = src._value_;
179 return *this;
180 }
181
183 if (this == &src) { return *this; }
184 _pos_ = std::move(src._pos_);
185 _value_ = std::move(src._value_);
186 return *this;
187 }
188
189 const O3Position& O3Float::position() const { return _pos_; }
190
192
193 float O3Float::value() const { return _value_; }
194
195 float& O3Float::value() { return _value_; }
196
197 O3Formula::O3Formula() : _pos_(), _formula_(std::unique_ptr< Formula >(new Formula(""))) {
198 GUM_CONSTRUCTOR(O3Formula);
199 }
200
202 _pos_(pos), _formula_(std::unique_ptr< Formula >(new Formula(formula))) {
203 GUM_CONSTRUCTOR(O3Formula);
204 }
205
207 _pos_(src._pos_), _formula_(std::unique_ptr< Formula >(new Formula(src.formula()))) {
208 GUM_CONS_CPY(O3Formula);
209 }
210
212 _pos_(std::move(src._pos_)), _formula_(std::move(src._formula_)) {
213 GUM_CONS_MOV(O3Formula);
214 }
215
217 GUM_DESTRUCTOR(O3Formula);
218 ;
219 }
220
222 if (this == &src) { return *this; }
223 _pos_ = src._pos_;
224 _formula_ = std::unique_ptr< Formula >(new Formula(src.formula()));
225 return *this;
226 }
227
229 if (this == &src) { return *this; }
230 _pos_ = std::move(src._pos_);
231 _formula_ = std::move(src._formula_);
232 return *this;
233 }
234
235 const O3Position& O3Formula::position() const { return _pos_; }
236
238
239 const Formula& O3Formula::formula() const { return *_formula_; }
240
242
244 GUM_CONSTRUCTOR(O3Label);
245 ;
246 }
247
248 O3Label::O3Label(const O3Position& pos, const std::string& label) :
249 _pos_(pos), _label_(label) {
250 GUM_CONSTRUCTOR(O3Label);
251 }
252
254 GUM_CONS_CPY(O3Label);
255 }
256
258 _pos_(std::move(src._pos_)), _label_(std::move(src._label_)) {
259 GUM_CONS_MOV(O3Label);
260 }
261
263 GUM_DESTRUCTOR(O3Label);
264 ;
265 }
266
268 if (this == &src) { return *this; }
269 _pos_ = src._pos_;
270 _label_ = src._label_;
271 return *this;
272 }
273
275 if (this == &src) { return *this; }
276 _pos_ = std::move(src._pos_);
277 _label_ = std::move(src._label_);
278 return *this;
279 }
280
281 const O3Position& O3Label::position() const { return _pos_; }
282
284
285 const std::string& O3Label::label() const { return _label_; }
286
287 std::string& O3Label::label() { return _label_; }
288
290 GUM_CONSTRUCTOR(O3Type);
291 ;
292 }
293
294 O3Type::O3Type(const O3Type& src) :
297 GUM_CONS_CPY(O3Type);
298 }
299
301 _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
302 _superLabel_(std::move(src._superLabel_)), _labels_(std::move(src._labels_)),
303 _dep_flag_(std::move(src._dep_flag_)) {
304 GUM_CONS_MOV(O3Type);
305 }
306
308 GUM_DESTRUCTOR(O3Type);
309 ;
310 }
311
313 if (this == &src) { return *this; }
314 _pos_ = src._pos_;
315 _name_ = src._name_;
317 _labels_ = src._labels_;
319 return *this;
320 }
321
323 if (this == &src) { return *this; }
324 _pos_ = std::move(src._pos_);
325 _name_ = std::move(src._name_);
326 _superLabel_ = std::move(src._superLabel_);
327 _labels_ = std::move(src._labels_);
328 _dep_flag_ = std::move(src._dep_flag_);
329 return *this;
330 }
331
333
334 const O3Label& O3Type::name() const { return _name_; }
335
337
338 const O3Label& O3Type::superLabel() const { return _superLabel_; }
339
341
342 const O3Type::LabelMap& O3Type::labels() const { return _labels_; }
343
345
346 const O3Position& O3Type::position() const { return _pos_; }
347
349
350 const bool& O3Type::o3prm_deprecated() const { return _dep_flag_; }
351
353 GUM_CONSTRUCTOR(O3IntType);
354 ;
355 }
356
358 _pos_(src._pos_), _name_(src._name_), _start_(src._start_), _end_(src._end_),
360 GUM_CONS_CPY(O3IntType);
361 }
362
364 _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
365 _start_(std::move(src._start_)), _end_(std::move(src._end_)),
366 _dep_flag_(std::move(src._dep_flag_)) {
367 GUM_CONS_MOV(O3IntType);
368 }
369
371 GUM_DESTRUCTOR(O3IntType);
372 ;
373 }
374
376 if (this == &src) { return *this; }
377 _pos_ = src._pos_;
378 _name_ = src._name_;
379 _start_ = src._start_;
380 _end_ = src._end_;
382 return *this;
383 }
384
386 if (this == &src) { return *this; }
387 _pos_ = std::move(src._pos_);
388 _name_ = std::move(src._name_);
389 _start_ = std::move(src._start_);
390 _end_ = std::move(src._end_);
391 _dep_flag_ = std::move(src._dep_flag_);
392 return *this;
393 }
394
396
397 const O3Label& O3IntType::name() const { return _name_; }
398
400
401 const O3Integer& O3IntType::start() const { return _start_; }
402
404
405 const O3Integer& O3IntType::end() const { return _end_; }
406
408
409 const O3Position& O3IntType::position() const { return _pos_; }
410
412
413 const bool& O3IntType::o3prm_deprecated() const { return _dep_flag_; }
414
416 GUM_CONSTRUCTOR(O3RealType);
417 ;
418 }
419
422 GUM_CONS_CPY(O3RealType);
423 }
424
426 _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
427 _values_(std::move(src._values_)), _dep_flag_(std::move(src._dep_flag_)) {
428 GUM_CONS_MOV(O3RealType);
429 }
430
432 GUM_DESTRUCTOR(O3RealType);
433 ;
434 }
435
437 if (this == &src) { return *this; }
438
439 _pos_ = src._pos_;
440 _name_ = src._name_;
441 _values_ = src._values_;
443 return *this;
444 }
445
447 if (this == &src) { return *this; }
448
449 _pos_ = std::move(src._pos_);
450 _name_ = std::move(src._name_);
451 _values_ = std::move(src._values_);
452 _dep_flag_ = std::move(src._dep_flag_);
453 return *this;
454 }
455
457
458 const O3Position& O3RealType::position() const { return _pos_; }
459
461
462 const O3Label& O3RealType::name() const { return _name_; }
463
464 std::vector< O3Float >& O3RealType::values() { return _values_; }
465
466 const std::vector< O3Float >& O3RealType::values() const { return _values_; }
467
469
470 const bool& O3RealType::o3prm_deprecated() const { return _dep_flag_; }
471
473 GUM_CONSTRUCTOR(O3PRM);
474 // Creating the boolean type
475 auto name = O3Label(O3Position(), "boolean");
476 auto f = O3Label(O3Position(), "false");
477 auto t = O3Label(O3Position(), "true");
478 auto labels = O3Type::LabelMap();
479 labels.push_back(O3Type::LabelPair(f, O3Label()));
480 labels.push_back(O3Type::LabelPair(t, O3Label()));
481 auto boolean = std::unique_ptr< O3Type >(new O3Type());
482 boolean->name() = std::move(name);
483 boolean->labels() = std::move(labels);
484 _types_.push_back(std::move(boolean));
485 }
486
487 O3PRM::O3PRM(const O3PRM& src) {
488 GUM_CONS_CPY(O3PRM);
489 for (const auto& t: src._types_) {
490 _types_.emplace_back(new O3Type(*t));
491 }
492 for (const auto& t: src._int_types_) {
493 _int_types_.emplace_back(new O3IntType(*t));
494 }
495 for (const auto& t: src._real_types_) {
496 _real_types_.emplace_back(new O3RealType(*t));
498 for (const auto& i: src._interfaces_) {
499 _interfaces_.emplace_back(new O3Interface(*i));
500 }
501 for (const auto& c: src._classes_) {
502 _classes_.emplace_back(new O3Class(*c));
503 }
504 for (const auto& s: src._systems_) {
505 _systems_.emplace_back(new O3System(*s));
506 }
507 for (const auto& i: src._imports_) {
508 _imports_.emplace_back(new O3Import(*i));
509 }
510 }
511
513 _types_(std::move(src._types_)), _int_types_(std::move(src._int_types_)),
514 _real_types_(std::move(src._real_types_)), _interfaces_(std::move(src._interfaces_)),
515 _classes_(std::move(src._classes_)), _systems_(std::move(src._systems_)),
516 _imports_(std::move(src._imports_)) {
517 GUM_CONS_MOV(O3PRM);
518 }
519
521 GUM_DESTRUCTOR(O3PRM);
522 ;
523 }
524
526 if (this == &src) { return *this; }
527 for (const auto& t: src._types_) {
528 _types_.emplace_back(new O3Type(*t));
529 }
530 for (const auto& t: src._int_types_) {
531 _int_types_.emplace_back(new O3IntType(*t));
532 }
533 for (const auto& t: src._real_types_) {
534 _real_types_.emplace_back(new O3RealType(*t));
535 }
536 for (const auto& i: src._interfaces_) {
537 _interfaces_.emplace_back(new O3Interface(*i));
538 }
539 for (const auto& c: src._classes_) {
540 _classes_.emplace_back(new O3Class(*c));
541 }
542 for (const auto& s: src._systems_) {
543 _systems_.emplace_back(new O3System(*s));
544 }
545 for (const auto& i: src._imports_) {
546 _imports_.emplace_back(new O3Import(*i));
547 }
548 return *this;
549 }
550
552 if (this == &src) { return *this; }
553 _types_ = std::move(src._types_);
554 _int_types_ = std::move(src._int_types_);
555 _real_types_ = std::move(src._real_types_);
556 _interfaces_ = std::move(src._interfaces_);
557 _classes_ = std::move(src._classes_);
558 _systems_ = std::move(src._systems_);
559 _imports_ = std::move(src._imports_);
560 return *this;
561 }
562
564
565 const O3PRM::O3TypeList& O3PRM::types() const { return _types_; }
566
568
570
572
574
576
578
580
581 const O3PRM::O3ClassList& O3PRM::classes() const { return _classes_; }
582
584
586
588
590
594
596 const O3Label& name,
597 bool isArray) :
599 GUM_CONSTRUCTOR(O3InterfaceElement);
600 }
601
606
608 _type_(std::move(src._type_)), _name_(std::move(src._name_)),
609 _isArray_(std::move(src._isArray_)) {
610 GUM_CONS_MOV(O3InterfaceElement);
611 }
612
614
616 if (this == &src) { return *this; }
617 _type_ = src._type_;
618 _name_ = src._name_;
619 _isArray_ = src._isArray_;
620 return *this;
621 }
622
624 if (this == &src) { return *this; }
625 _type_ = std::move(src._type_);
626 _name_ = std::move(src._name_);
627 _isArray_ = std::move(src._isArray_);
628 return *this;
629 }
630
632
633 const O3Label& O3InterfaceElement::type() const { return _type_; }
634
636
637 const O3Label& O3InterfaceElement::name() const { return _name_; }
638
640
641 bool O3InterfaceElement::isArray() const { return _isArray_; }
642
644 GUM_CONSTRUCTOR(O3Interface);
645 }
646
649 GUM_CONS_CPY(O3Interface);
650 auto copy = new O3InterfaceElementList(src.elements());
651 _elts_ = std::unique_ptr< O3InterfaceElementList >(copy);
652 }
653
655 _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
656 _superLabel_(std::move(src._superLabel_)), _elts_(std::move(src._elts_)) {
657 GUM_CONS_MOV(O3Interface);
658 }
659
661 GUM_DESTRUCTOR(O3Interface);
662 ;
663 }
664
666 if (this == &src) { return *this; }
667 _pos_ = src._pos_;
668 _name_ = src._name_;
670 auto copy = new O3InterfaceElementList(src.elements());
671 _elts_ = std::unique_ptr< O3InterfaceElementList >(copy);
672 return *this;
673 }
674
676 if (this == &src) { return *this; }
677 _pos_ = std::move(src._pos_);
678 _name_ = std::move(src._name_);
679 _superLabel_ = std::move(src._superLabel_);
680 _elts_ = std::move(src._elts_);
681 return *this;
682 }
683
685
686 const O3Position& O3Interface::position() const { return _pos_; }
687
689
690 const O3Label& O3Interface::name() const { return _name_; }
691
693
695
697
699
701 GUM_CONSTRUCTOR(O3Attribute);
702 ;
703 }
704
706 const O3Label& name,
707 const O3LabelList& parents) :
709 GUM_CONSTRUCTOR(O3Attribute);
710 }
711
713 _type_(src._type_), _name_(src._name_), _parents_(src._parents_) {
714 GUM_CONS_CPY(O3Attribute);
715 }
716
718 _type_(std::move(src._type_)), _name_(std::move(src._name_)),
719 _parents_(std::move(src._parents_)) {
720 GUM_CONS_MOV(O3Attribute);
721 }
722
724 GUM_DESTRUCTOR(O3Attribute);
725 ;
726 }
727
729 if (this == &src) { return *this; }
730 _type_ = src._type_;
731 _name_ = src._name_;
732 _parents_ = src._parents_;
733 return *this;
734 }
735
737 if (this == &src) { return *this; }
738 _type_ = std::move(src._type_);
739 _name_ = std::move(src._name_);
740 _parents_ = std::move(src._parents_);
741 return *this;
742 }
743
745
746 const O3Label& O3Attribute::type() const { return _type_; }
747
749
750 const O3Label& O3Attribute::name() const { return _name_; }
751
753
755
757 GUM_CONSTRUCTOR(O3RawCPT);
758 }
759
761 const O3Label& name,
762 const O3LabelList& parents,
764 GUM_CONSTRUCTOR(O3RawCPT);
765 auto copy = new O3FormulaList(values);
766 _values_ = std::unique_ptr< O3FormulaList >(copy);
767 }
768
770 GUM_CONS_CPY(O3RawCPT);
771 auto copy = new O3FormulaList(*(src._values_));
772 _values_ = std::unique_ptr< O3FormulaList >(copy);
773 }
774
776 GUM_CONS_MOV(O3RawCPT);
777 }
778
780 GUM_DESTRUCTOR(O3RawCPT);
781 ;
782 }
783
785 if (this == &src) { return *this; }
787 auto copy = new O3FormulaList(*(src._values_));
788 _values_ = std::unique_ptr< O3FormulaList >(copy);
789 return *this;
790 }
791
793 if (this == &src) { return *this; }
795 _values_ = std::move(src._values_);
796 return *this;
797 }
798
800
802
803 std::unique_ptr< O3Attribute > O3RawCPT::copy() const {
804 auto copy = new O3RawCPT(*this);
805 return std::unique_ptr< O3Attribute >(copy);
806 }
807
809 GUM_CONSTRUCTOR(O3RuleCPT);
810 }
811
813 const O3Label& name,
815 O3RuleList&& rules) :
817 _rules_(std::unique_ptr< O3RuleList >(new O3RuleList(rules))) {
818 GUM_CONSTRUCTOR(O3RuleCPT);
819 }
820
822 O3Attribute(src), _rules_(std::unique_ptr< O3RuleList >(new O3RuleList(src.rules()))) {
823 GUM_CONS_CPY(O3RuleCPT);
824 }
825
827 GUM_CONS_MOV(O3RuleCPT);
828 }
829
831 GUM_DESTRUCTOR(O3RuleCPT);
832 ;
833 }
834
836 if (this == &src) { return *this; }
837
839 _rules_ = std::unique_ptr< O3RuleList >(new O3RuleList(src.rules()));
840 return *this;
841 }
842
844 if (this == &src) { return *this; }
845
847 _rules_ = std::move(src._rules_);
848 return *this;
849 }
850
852
854
855 std::unique_ptr< O3Attribute > O3RuleCPT::copy() const {
856 auto copy = new O3RuleCPT(*this);
857 return std::unique_ptr< O3Attribute >(copy);
858 }
859
861 GUM_CONSTRUCTOR(O3Class);
862
863 auto i = new O3LabelList();
864 _interfaces_ = std::unique_ptr< O3LabelList >(i);
865
866 auto p = new O3ParameterList();
867 _params_ = std::unique_ptr< O3ParameterList >(p);
868
869 auto r = new O3ReferenceSlotList();
870 _refs_ = std::unique_ptr< O3ReferenceSlotList >(r);
871
872 auto e = new O3AttributeList();
873 _attrs_ = std::unique_ptr< O3AttributeList >(e);
874
875 auto a = new O3AggregateList();
876 _aggs_ = std::unique_ptr< O3AggregateList >(a);
877 }
878
881 GUM_CONS_CPY(O3Class);
882 auto i = new O3LabelList(src.interfaces());
883 _interfaces_ = std::unique_ptr< O3LabelList >(i);
884
885 auto p = new O3ParameterList(src.parameters());
886 _params_ = std::unique_ptr< O3ParameterList >(p);
887
888 auto r = new O3ReferenceSlotList(src.referenceSlots());
889 _refs_ = std::unique_ptr< O3ReferenceSlotList >(r);
890
891 auto e = new O3AttributeList();
892 _attrs_ = std::unique_ptr< O3AttributeList >(e);
893 for (const auto& elt: src.attributes()) {
894 _attrs_->push_back(elt->copy());
895 }
896
897 auto a = new O3AggregateList(src.aggregates());
898 _aggs_ = std::unique_ptr< O3AggregateList >(a);
899 }
900
902 _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
903 _superLabel_(std::move(src._superLabel_)), _interfaces_(std::move(src._interfaces_)),
904 _params_(std::move(src._params_)), _refs_(std::move(src._refs_)),
905 _attrs_(std::move(src._attrs_)), _aggs_(std::move(src._aggs_)) {
906 GUM_CONS_MOV(O3Class);
907 }
908
910 GUM_DESTRUCTOR(O3Class);
911 ;
912 }
913
915 if (this == &src) { return *this; }
916 _pos_ = src._pos_;
917 _name_ = src._name_;
919
920 auto i = new O3LabelList(src.interfaces());
921 _interfaces_ = std::unique_ptr< O3LabelList >(i);
922
923 auto p = new O3ParameterList(src.parameters());
924 _params_ = std::unique_ptr< O3ParameterList >(p);
925
926 auto r = new O3ReferenceSlotList(src.referenceSlots());
927 _refs_ = std::unique_ptr< O3ReferenceSlotList >(r);
928
929 auto e = new O3AttributeList();
930 _attrs_ = std::unique_ptr< O3AttributeList >(e);
931 for (const auto& elt: src.attributes()) {
932 _attrs_->push_back(elt->copy());
933 }
934
935 auto a = new O3AggregateList(src.aggregates());
936 _aggs_ = std::unique_ptr< O3AggregateList >(a);
937 return *this;
938 }
939
941 if (this == &src) { return *this; }
942 _pos_ = std::move(src._pos_);
943 _name_ = std::move(src._name_);
944 _superLabel_ = std::move(src._superLabel_);
945 _interfaces_ = std::move(src._interfaces_);
946 _params_ = std::move(src._params_);
947 _refs_ = std::move(src._refs_);
948 _attrs_ = std::move(src._attrs_);
949 _aggs_ = std::move(src._aggs_);
950 return *this;
951 }
952
953 const O3Position& O3Class::position() const { return _pos_; }
954
956
957 const O3Label& O3Class::name() const { return _name_; }
958
960
961 const O3Label& O3Class::superLabel() const { return _superLabel_; }
962
964
966
968
970
972
974
976
978
980
982
984
988
990 _type_(O3Parameter::PRMType::INT), _pos_(pos), _name_(name),
991 _value_(O3Float(value.position(), (float)value.value())) {
992 GUM_CONSTRUCTOR(O3Parameter);
993 }
994
997 GUM_CONSTRUCTOR(O3Parameter);
998 }
999
1001 _type_(src._type_), _pos_(src._pos_), _name_(src._name_), _value_(src._value_) {
1002 GUM_CONS_CPY(O3Parameter);
1003 }
1004
1006 _type_(std::move(src._type_)), _pos_(std::move(src._pos_)), _name_(std::move(src._name_)),
1007 _value_(std::move(src._value_)) {
1008 GUM_CONS_MOV(O3Parameter);
1009 }
1010
1012 GUM_DESTRUCTOR(O3Parameter);
1013 ;
1014 }
1015
1017 if (this == &src) { return *this; }
1018 _type_ = src._type_;
1019 _pos_ = src._pos_;
1020 _name_ = src._name_;
1021 _value_ = src._value_;
1022 return *this;
1023 }
1024
1026 if (this == &src) { return *this; }
1027 _type_ = std::move(src._type_);
1028 _pos_ = std::move(src._pos_);
1029 _name_ = std::move(src._name_);
1030 _value_ = std::move(src._value_);
1031 return *this;
1032 }
1033
1035
1037
1039
1040 const O3Position& O3Parameter::position() const { return _pos_; }
1041
1043
1044 const O3Label& O3Parameter::name() const { return _name_; }
1045
1047
1048 const O3Float& O3Parameter::value() const { return _value_; }
1049
1051 GUM_CONSTRUCTOR(O3ReferenceSlot);
1052 ;
1053 }
1054
1057 GUM_CONSTRUCTOR(O3ReferenceSlot);
1058 }
1059
1061 _type_(src._type_), _name_(src._name_), _isArray_(src._isArray_) {
1062 GUM_CONS_CPY(O3ReferenceSlot);
1063 }
1064
1066 _type_(std::move(src._type_)), _name_(std::move(src._name_)),
1067 _isArray_(std::move(src._isArray_)) {
1068 GUM_CONS_MOV(O3ReferenceSlot);
1069 }
1070
1072 GUM_DESTRUCTOR(O3ReferenceSlot);
1073 ;
1074 }
1075
1077 if (this == &src) { return *this; }
1078 _type_ = src._type_;
1079 _name_ = src._name_;
1080 _isArray_ = src._isArray_;
1081 return *this;
1082 }
1083
1085 if (this == &src) { return *this; }
1086 _type_ = std::move(src._type_);
1087 _name_ = std::move(src._name_);
1088 _isArray_ = std::move(src._isArray_);
1089 return *this;
1090 }
1091
1093
1094 const O3Label& O3ReferenceSlot::type() const { return _type_; }
1095
1097
1098 const O3Label& O3ReferenceSlot::name() const { return _name_; }
1099
1101
1102 bool O3ReferenceSlot::isArray() const { return _isArray_; }
1103
1108
1114
1116 _variableType_(std::move(src._variableType_)),
1117 _aggregateType_(std::move(src._aggregateType_)), _name_(std::move(src._name_)),
1118 _parents_(std::move(src._parents_)), _parameters_(std::move(src._parameters_)) {
1119 GUM_CONS_MOV(O3Aggregate);
1120 }
1121
1123 GUM_DESTRUCTOR(O3Aggregate);
1124 ;
1125 }
1126
1128 if (this == &src) { return *this; }
1131 _name_ = src._name_;
1132 _parents_ = src._parents_;
1134 return *this;
1135 }
1136
1138 if (this == &src) { return *this; }
1139 _aggregateType_ = std::move(src._aggregateType_);
1140 _variableType_ = std::move(src._variableType_);
1141 _name_ = std::move(src._name_);
1142 _parents_ = std::move(src._parents_);
1143 _parameters_ = std::move(src._parameters_);
1144 return *this;
1145 }
1146
1148
1150
1152
1154
1156
1157 const O3Label& O3Aggregate::name() const { return _name_; }
1158
1160
1162
1164
1166
1168 GUM_CONSTRUCTOR(O3Assignment);
1169 ;
1170 }
1171
1178
1183 _rightIndex_(std::move(src._rightIndex_)) {
1184 GUM_CONS_CPY(O3Assignment);
1185 }
1186
1188 GUM_DESTRUCTOR(O3Assignment);
1189 ;
1190 }
1191
1193 if (this == &src) { return *this; }
1199 return *this;
1200 }
1201
1203 if (this == &src) { return *this; }
1204 _leftInstance_ = std::move(src._leftInstance_);
1205 _leftIndex_ = std::move(src._leftIndex_);
1206 _leftReference_ = std::move(src._leftReference_);
1207 _rightInstance_ = std::move(src._rightInstance_);
1208 _rightIndex_ = std::move(src._rightIndex_);
1209 return *this;
1210 }
1211
1213
1215
1217
1219
1221
1223
1225
1227
1229
1231
1233 GUM_CONSTRUCTOR(O3Increment);
1234 ;
1235 }
1236
1243
1248 _rightIndex_(std::move(src._rightIndex_)) {
1249 GUM_CONS_CPY(O3Increment);
1250 }
1251
1253 GUM_DESTRUCTOR(O3Increment);
1254 ;
1255 }
1256
1258 if (this == &src) { return *this; }
1264 return *this;
1265 }
1266
1268 if (this == &src) { return *this; }
1269 _leftInstance_ = std::move(src._leftInstance_);
1270 _leftIndex_ = std::move(src._leftIndex_);
1271 _leftReference_ = std::move(src._leftReference_);
1272 _rightInstance_ = std::move(src._rightInstance_);
1273 _rightIndex_ = std::move(src._rightIndex_);
1274 return *this;
1275 }
1276
1278
1280
1282
1284
1286
1288
1290
1292
1294
1296
1298 GUM_CONSTRUCTOR(O3Instance);
1299 ;
1300 }
1301
1303 _type_(src._type_), _name_(src._name_), _size_(src._size_),
1305 GUM_CONS_CPY(O3Instance);
1306 }
1307
1309 _type_(std::move(src._type_)), _name_(std::move(src._name_)),
1310 _size_(std::move(src._size_)), _parameters_(std::move(src._parameters_)) {
1311 GUM_CONS_MOV(O3Instance);
1312 }
1313
1315 GUM_DESTRUCTOR(O3Instance);
1316 ;
1317 }
1318
1320 if (this == &src) { return *this; }
1321 _type_ = src._type_;
1322 _name_ = src._name_;
1323 _size_ = src._size_;
1325 return *this;
1326 }
1327
1329 if (this == &src) { return *this; }
1330 _type_ = std::move(src._type_);
1331 _name_ = std::move(src._name_);
1332 _size_ = std::move(src._size_);
1333 _parameters_ = std::move(src._parameters_);
1334 return *this;
1335 }
1336
1337 const O3Label& O3Instance::type() const { return _type_; }
1338
1340
1341 const O3Label& O3Instance::name() const { return _name_; }
1342
1344
1345 const O3Integer& O3Instance::size() const { return _size_; }
1346
1348
1352
1354
1356 GUM_CONSTRUCTOR(O3System);
1357 ;
1358 }
1359
1363 GUM_CONS_CPY(O3System);
1364 }
1365
1367 _name_(std::move(src._name_)), _instances_(std::move(src._instances_)),
1368 _assigments_(std::move(src._assigments_)), _increments_(std::move(src._increments_)) {
1369 GUM_CONS_MOV(O3System);
1370 }
1371
1373 GUM_DESTRUCTOR(O3System);
1374 ;
1375 }
1376
1378 if (this == &src) { return *this; }
1379 _name_ = src._name_;
1383 return *this;
1384 }
1385
1387 if (this == &src) { return *this; }
1388 _name_ = std::move(src._name_);
1389 _instances_ = std::move(src._instances_);
1390 _assigments_ = std::move(src._assigments_);
1391 _increments_ = std::move(src._increments_);
1392 return *this;
1393 }
1394
1395 const O3Label& O3System::name() const { return _name_; }
1396
1398
1400
1402
1404
1406
1408
1410
1411 std::ostream& operator<<(std::ostream& o, const O3Label& src) {
1412 o << src.label();
1413 return o;
1414 }
1415
1419
1424
1426 _name_(std::move(src._name_)), _value_(std::move(src._value_)),
1427 _isInteger_(std::move(src._isInteger_)) {
1428 GUM_CONS_MOV(O3InstanceParameter);
1429 }
1430
1432
1434 if (this == &src) { return *this; }
1435 _name_ = src._name_;
1436 _value_ = src._value_;
1438 return *this;
1439 }
1440
1442 if (this == &src) { return *this; }
1443 _name_ = std::move(src._name_);
1444 _value_ = std::move(src._value_);
1445 _isInteger_ = std::move(src._isInteger_);
1446 return *this;
1447 }
1448
1449 const O3Label& O3InstanceParameter::name() const { return _name_; }
1450
1452
1453 const O3Float& O3InstanceParameter::value() const { return _value_; }
1454
1456
1458
1460
1462 GUM_CONSTRUCTOR(O3Import);
1463 ;
1464 }
1465
1467 GUM_CONSTRUCTOR(O3Import);
1468 }
1469
1471 GUM_CONS_MOV(O3Import);
1472 }
1473
1475 GUM_DESTRUCTOR(O3Import);
1476 ;
1477 }
1478
1480 if (this == &src) { return *this; }
1481 _import_ = src._import_;
1482 return *this;
1483 }
1484
1486 if (this == &src) { return *this; }
1487 _import_ = std::move(src._import_);
1488 return *this;
1489 }
1490
1491 const O3Label& O3Import::import() const { return _import_; }
1492
1494
1495 } // namespace o3prm
1496 } // namespace prm
1497} // namespace gum
Headers for the AST of the O3PRM language.
Evaluates a string as a algebraic formula.
Definition formula.h:293
O3LabelList & parameters()
Definition O3prm.cpp:1163
O3Aggregate & operator=(const O3Aggregate &src)
Definition O3prm.cpp:1127
O3LabelList & parents()
Definition O3prm.cpp:1159
std::vector< O3Label > O3LabelList
Definition O3prm.h:600
O3Assignment & operator=(const O3Assignment &src)
Definition O3prm.cpp:1192
virtual O3Label & type()
Definition O3prm.cpp:744
virtual O3Attribute & operator=(const O3Attribute &src)
Definition O3prm.cpp:728
virtual O3Label & name()
Definition O3prm.cpp:748
std::vector< O3Label > O3LabelList
Definition O3prm.h:488
virtual O3LabelList & parents()
Definition O3prm.cpp:752
The O3Class is part of the AST of the O3PRM language.
Definition O3prm.h:640
O3ParameterList & parameters()
Definition O3prm.cpp:971
std::vector< std::unique_ptr< O3Attribute > > O3AttributeList
Definition O3prm.h:645
std::unique_ptr< O3ParameterList > _params_
Definition O3prm.h:685
std::vector< O3Aggregate > O3AggregateList
Definition O3prm.h:646
O3Position & position()
Definition O3prm.cpp:955
std::vector< O3Label > O3LabelList
Definition O3prm.h:642
std::vector< O3Parameter > O3ParameterList
Definition O3prm.h:643
std::unique_ptr< O3ReferenceSlotList > _refs_
Definition O3prm.h:686
O3AggregateList & aggregates()
Definition O3prm.cpp:981
O3LabelList & interfaces()
Definition O3prm.cpp:967
std::unique_ptr< O3AttributeList > _attrs_
Definition O3prm.h:687
std::unique_ptr< O3LabelList > _interfaces_
Definition O3prm.h:684
std::unique_ptr< O3AggregateList > _aggs_
Definition O3prm.h:688
O3ReferenceSlotList & referenceSlots()
Definition O3prm.cpp:975
O3Label & superLabel()
Definition O3prm.cpp:963
O3Class & operator=(const O3Class &src)
Definition O3prm.cpp:914
std::vector< O3ReferenceSlot > O3ReferenceSlotList
Definition O3prm.h:644
O3AttributeList & attributes()
Definition O3prm.cpp:977
The O3Float is part of the AST of the O3PRM language.
Definition O3prm.h:134
O3Position & position()
Definition O3prm.cpp:191
O3Float & operator=(const O3Float &src)
Definition O3prm.cpp:175
std::unique_ptr< Formula > _formula_
Definition O3prm.h:124
O3Formula & operator=(const O3Formula &src)
Definition O3prm.cpp:221
O3Position & position()
Definition O3prm.cpp:237
The O3Import is part of the AST of the O3PRM language.
Definition O3prm.h:889
O3Import & operator=(const O3Import &src)
Definition O3prm.cpp:1479
O3Increment & operator=(const O3Increment &src)
Definition O3prm.cpp:1257
O3InstanceParameter & operator=(const O3InstanceParameter &src)
Definition O3prm.cpp:1433
O3InstanceParameterList _parameters_
Definition O3prm.h:839
O3Instance & operator=(const O3Instance &src)
Definition O3prm.cpp:1319
O3InstanceParameterList & parameters()
Definition O3prm.cpp:1353
std::vector< O3InstanceParameter > O3InstanceParameterList
Definition O3prm.h:813
The O3IntType is part of the AST of the O3PRM language.
Definition O3prm.h:266
O3IntType & operator=(const O3IntType &src)
Definition O3prm.cpp:375
O3Position & position()
Definition O3prm.cpp:407
The O3Integer is part of the AST of the O3PRM language.
Definition O3prm.h:163
O3Integer & operator=(const O3Integer &src)
Definition O3prm.cpp:130
O3Position & position()
Definition O3prm.cpp:146
O3InterfaceElement & operator=(const O3InterfaceElement &src)
Definition O3prm.cpp:615
The O3Interface is part of the AST of the O3PRM language.
Definition O3prm.h:375
std::vector< O3InterfaceElement > O3InterfaceElementList
Definition O3prm.h:377
O3Interface & operator=(const O3Interface &src)
Definition O3prm.cpp:665
std::unique_ptr< O3InterfaceElementList > _elts_
Definition O3prm.h:403
O3Position & position()
Definition O3prm.cpp:684
O3InterfaceElementList & elements()
Definition O3prm.cpp:696
The O3Label is part of the AST of the O3PRM language.
Definition O3prm.h:192
std::string _label_
Definition O3prm.h:211
O3Label & operator=(const O3Label &src)
Definition O3prm.cpp:267
std::string & label()
Definition O3prm.cpp:287
O3Position & position()
Definition O3prm.cpp:283
O3SystemList _systems_
Definition O3prm.h:958
O3ImportList _imports_
Definition O3prm.h:959
std::vector< std::unique_ptr< O3Type > > O3TypeList
Definition O3prm.h:915
std::vector< std::unique_ptr< O3Interface > > O3InterfaceList
Definition O3prm.h:918
std::vector< std::unique_ptr< O3IntType > > O3IntTypeList
Definition O3prm.h:916
O3PRM & operator=(const O3PRM &src)
Definition O3prm.cpp:525
O3ClassList _classes_
Definition O3prm.h:957
O3ImportList & imports()
Definition O3prm.cpp:587
O3TypeList & types()
Definition O3prm.cpp:563
O3RealTypeList _real_types_
Definition O3prm.h:955
O3InterfaceList _interfaces_
Definition O3prm.h:956
std::vector< std::unique_ptr< O3RealType > > O3RealTypeList
Definition O3prm.h:917
O3ClassList & classes()
Definition O3prm.cpp:579
O3InterfaceList & interfaces()
Definition O3prm.cpp:575
O3RealTypeList & real_types()
Definition O3prm.cpp:571
std::vector< std::unique_ptr< O3Class > > O3ClassList
Definition O3prm.h:919
std::vector< std::unique_ptr< O3System > > O3SystemList
Definition O3prm.h:920
O3IntTypeList _int_types_
Definition O3prm.h:954
O3TypeList _types_
Definition O3prm.h:953
std::vector< std::unique_ptr< O3Import > > O3ImportList
Definition O3prm.h:921
O3SystemList & systems()
Definition O3prm.cpp:583
O3IntTypeList & int_types()
Definition O3prm.cpp:567
O3Parameter & operator=(const O3Parameter &src)
Definition O3prm.cpp:1016
The O3Position is part of the AST of the O3PRM language.
Definition O3prm.h:72
std::string & file()
Definition O3prm.cpp:95
O3Position & operator=(const O3Position &src)
Definition O3prm.cpp:79
virtual O3FormulaList & values()
Definition O3prm.cpp:799
std::unique_ptr< O3FormulaList > _values_
Definition O3prm.h:549
std::vector< O3Formula > O3FormulaList
Definition O3prm.h:525
virtual O3RawCPT & operator=(const O3RawCPT &src)
Definition O3prm.cpp:784
virtual std::unique_ptr< O3Attribute > copy() const
Definition O3prm.cpp:803
The O3RealType is part of the AST of the O3PRM language.
Definition O3prm.h:306
std::vector< O3Float > _values_
Definition O3prm.h:331
O3Position & position()
Definition O3prm.cpp:456
O3RealType & operator=(const O3RealType &src)
Definition O3prm.cpp:436
std::vector< O3Float > & values()
Definition O3prm.cpp:464
O3ReferenceSlot & operator=(const O3ReferenceSlot &src)
Definition O3prm.cpp:1076
virtual O3RuleCPT & operator=(const O3RuleCPT &src)
Definition O3prm.cpp:835
virtual O3RuleList & rules()
Definition O3prm.cpp:851
std::vector< O3Rule > O3RuleList
Definition O3prm.h:564
virtual std::unique_ptr< O3Attribute > copy() const
Definition O3prm.cpp:855
std::unique_ptr< O3RuleList > _rules_
Definition O3prm.h:588
The O3System is part of the AST of the O3PRM language.
Definition O3prm.h:849
std::vector< O3Increment > O3IncrementList
Definition O3prm.h:853
O3AssignmentList & assignments()
Definition O3prm.cpp:1405
O3AssignmentList _assigments_
Definition O3prm.h:878
std::vector< O3Instance > O3InstanceList
Definition O3prm.h:851
O3InstanceList & instances()
Definition O3prm.cpp:1401
O3System & operator=(const O3System &src)
Definition O3prm.cpp:1377
O3IncrementList & increments()
Definition O3prm.cpp:1409
O3InstanceList _instances_
Definition O3prm.h:877
O3IncrementList _increments_
Definition O3prm.h:879
std::vector< O3Assignment > O3AssignmentList
Definition O3prm.h:852
The O3Type is part of the AST of the O3PRM language.
Definition O3prm.h:223
O3Label & superLabel()
Definition O3prm.cpp:336
O3Type & operator=(const O3Type &src)
Definition O3prm.cpp:312
O3Position & position()
Definition O3prm.cpp:344
std::pair< O3Label, O3Label > LabelPair
Definition O3prm.h:225
std::vector< LabelPair > LabelMap
Definition O3prm.h:226
bool & o3prm_deprecated()
Definition O3prm.cpp:348
LabelMap & labels()
Definition O3prm.cpp:340
std::ostream & operator<<(std::ostream &o, const O3Label &src)
Definition O3prm.cpp:1411
namespace for all probabilistic relational models entities
Definition agrum.h:68
gum is the global namespace for all aGrUM entities
Definition agrum.h:46
STL namespace.