aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
gum::prm::o3prm::O3ClassFactory< GUM_SCALAR > Class Template Reference

Builds gum::prm::Class from gum::prm::o3prm::O3Class. More...

#include <agrum/PRM/o3prm/O3ClassFactory.h>

+ Collaboration diagram for gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >:

Public Member Functions

 O3ClassFactory (PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
 
 O3ClassFactory (const O3ClassFactory< GUM_SCALAR > &src)
 
 O3ClassFactory (O3ClassFactory< GUM_SCALAR > &&src)
 
 ~O3ClassFactory ()
 
O3ClassFactory< GUM_SCALAR > & operator= (const O3ClassFactory< GUM_SCALAR > &src)
 
O3ClassFactory< GUM_SCALAR > & operator= (O3ClassFactory< GUM_SCALAR > &&src)
 
void buildClasses ()
 
void buildImplementations ()
 
void buildParameters ()
 
void buildReferenceSlots ()
 
void declareAggregates ()
 
void completeAggregates ()
 
void declareAttributes ()
 
void completeAttributes ()
 

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >

Builds gum::prm::Class from gum::prm::o3prm::O3Class.

Template Parameters
GUM_SCALARThe scalar type used by the gum::prm:PRM.

Definition at line 58 of file O3ClassFactory.h.

Constructor & Destructor Documentation

◆ O3ClassFactory() [1/3]

template<typename GUM_SCALAR >
INLINE gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::O3ClassFactory ( PRM< GUM_SCALAR > &  prm,
O3PRM o3_prm,
O3NameSolver< GUM_SCALAR > &  solver,
ErrorsContainer errors 
)

Definition at line 37 of file O3ClassFactory_tpl.h.

40  :
41  _prm_(&prm),
42  _o3_prm_(&o3_prm), _solver_(&solver), _errors_(&errors) {
43  GUM_CONSTRUCTOR(O3ClassFactory);
44  }
O3NameSolver< GUM_SCALAR > * _solver_
O3ClassFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)

◆ O3ClassFactory() [2/3]

template<typename GUM_SCALAR >
INLINE gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::O3ClassFactory ( const O3ClassFactory< GUM_SCALAR > &  src)

Definition at line 47 of file O3ClassFactory_tpl.h.

47  :
48  _prm_(src._prm_), _o3_prm_(src._o3_prm_), _solver_(src._solver_), _errors_(src._errors_),
49  _nameMap_(src._nameMap_), _classMap_(src._classMap_), _nodeMap_(src._nodeMap_),
50  _dag_(src._dag_), _o3Classes_(src._o3Classes_) {
51  GUM_CONS_CPY(O3ClassFactory);
52  }
std::vector< O3Class *> _o3Classes_
HashTable< NodeId, O3Class *> _nodeMap_
O3NameSolver< GUM_SCALAR > * _solver_
O3ClassFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
HashTable< std::string, gum::NodeId > _nameMap_
HashTable< std::string, O3Class *> _classMap_

◆ O3ClassFactory() [3/3]

template<typename GUM_SCALAR >
INLINE gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::O3ClassFactory ( O3ClassFactory< GUM_SCALAR > &&  src)

Definition at line 55 of file O3ClassFactory_tpl.h.

55  :
56  _prm_(std::move(src._prm_)), _o3_prm_(std::move(src._o3_prm_)),
57  _solver_(std::move(src._solver_)), _errors_(std::move(src._errors_)),
58  _nameMap_(std::move(src._nameMap_)), _classMap_(std::move(src._classMap_)),
59  _nodeMap_(std::move(src._nodeMap_)), _dag_(std::move(src._dag_)),
60  _o3Classes_(std::move(src._o3Classes_)) {
61  GUM_CONS_MOV(O3ClassFactory);
62  }
std::vector< O3Class *> _o3Classes_
HashTable< NodeId, O3Class *> _nodeMap_
O3NameSolver< GUM_SCALAR > * _solver_
O3ClassFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
HashTable< std::string, gum::NodeId > _nameMap_
HashTable< std::string, O3Class *> _classMap_

◆ ~O3ClassFactory()

template<typename GUM_SCALAR >
INLINE gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::~O3ClassFactory ( )

Definition at line 65 of file O3ClassFactory_tpl.h.

65  {
66  GUM_DESTRUCTOR(O3ClassFactory);
67  }
O3ClassFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)

Member Function Documentation

◆ _addParameters_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_addParameters_ ( PRMFactory< GUM_SCALAR > &  factory,
O3Class c 
)
private

Definition at line 307 of file O3ClassFactory_tpl.h.

308  {
309  for (auto& p: c.parameters()) {
310  switch (p.type()) {
312  factory.addParameter("int", p.name().label(), p.value().value());
313  break;
314  }
315 
317  factory.addParameter("real", p.name().label(), p.value().value());
318  break;
319  }
320 
321  default: {
322  GUM_ERROR(FatalError, "unknown O3Parameter type")
323  }
324  }
325  }
326  }
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51

◆ _addParamsToForms_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_addParamsToForms_ ( const HashTable< std::string, const PRMParameter< GUM_SCALAR > * > &  scope,
O3RuleCPT::O3Rule rule 
)
private

Definition at line 693 of file O3ClassFactory_tpl.h.

695  {
696  // Add parameters to formulas
697  for (auto& f: rule.second) {
698  f.formula().variables().clear();
699  for (const auto& values: scope) {
700  f.formula().variables().insert(values.first, values.second->value());
701  }
702  }
703  }

◆ _addReferenceSlots_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_addReferenceSlots_ ( O3Class c)
private

Definition at line 338 of file O3ClassFactory_tpl.h.

338  {
339  PRMFactory< GUM_SCALAR > factory(_prm_);
340 
341  factory.continueClass(c.name().label());
342 
343  // References
344  for (auto& ref: c.referenceSlots()) {
345  if (_checkReferenceSlot_(c, ref)) {
346  factory.addReferenceSlot(ref.type().label(), ref.name().label(), ref.isArray());
347  }
348  }
349 
350  factory.endClass(false);
351  }
bool _checkReferenceSlot_(O3Class &c, O3ReferenceSlot &ref)

◆ _checkAggParameters_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAggParameters_ ( O3Class o3class,
O3Aggregate agg,
const PRMType t 
)
private

Definition at line 960 of file O3ClassFactory_tpl.h.

962  {
963  bool ok = false;
964 
965  switch (gum::prm::PRMAggregate< GUM_SCALAR >::str2enum(agg.aggregateType().label())) {
973  ok = _checkParametersNumber_(agg, 0);
974  break;
975  }
976 
980  ok = _checkParametersNumber_(agg, 1);
981  break;
982  }
983 
984  default: {
985  GUM_ERROR(FatalError, "unknown aggregate type")
986  }
987  }
988 
989  if (!ok) { return false; }
990 
991  // Checking parameters type
992  switch (gum::prm::PRMAggregate< GUM_SCALAR >::str2enum(agg.aggregateType().label())) {
996  ok = _checkParameterValue_(agg, *t);
997  break;
998  }
999 
1000  default: { /* Nothing to do */
1001  }
1002  }
1003 
1004  return ok;
1005  }
bool _checkParametersNumber_(O3Aggregate &agg, Size n)
bool _checkParameterValue_(O3Aggregate &agg, const gum::prm::PRMType &t)
#define GUM_ERROR(type, msg)
Definition: exceptions.h:51

◆ _checkAggParents_()

template<typename GUM_SCALAR >
INLINE const PRMType * gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAggParents_ ( O3Class o3class,
O3Aggregate agg 
)
private

Definition at line 910 of file O3ClassFactory_tpl.h.

911  {
912  const auto& c = _prm_->getClass(o3class.name().label());
913  auto t = (const PRMType*)nullptr;
914 
915  for (const auto& prnt: agg.parents()) {
916  auto elt = _resolveSlotChain_(c, prnt);
917 
918  if (elt == nullptr) {
919  O3PRM_CLASS_PARENT_NOT_FOUND(prnt, *_errors_);
920  return nullptr;
921 
922  } else {
923  if (t == nullptr) {
924  try {
925  t = &(elt->type());
926 
927  } catch (OperationNotAllowed&) {
928  O3PRM_CLASS_WRONG_PARENT(prnt, *_errors_);
929  return nullptr;
930  }
931 
932  } else if ((*t) != elt->type()) {
933  // Wront type in chain
934  O3PRM_CLASS_WRONG_PARENT_TYPE(prnt, t->name(), elt->type().name(), *_errors_);
935  return nullptr;
936  }
937  }
938  }
939  return t;
940  }
const PRMClassElement< GUM_SCALAR > * _resolveSlotChain_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &chain)

◆ _checkAggregateForCompletion_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAggregateForCompletion_ ( O3Class o3class,
O3Aggregate agg 
)
private

Definition at line 542 of file O3ClassFactory_tpl.h.

543  {
544  // Checking parents
545  auto t = _checkAggParents_(c, agg);
546  if (t == nullptr) { return false; }
547 
548  // Checking parameters numbers
549  if (!_checkAggParameters_(c, agg, t)) { return false; }
550 
551  return true;
552  }
const PRMType * _checkAggParents_(O3Class &o3class, O3Aggregate &agg)
bool _checkAggParameters_(O3Class &o3class, O3Aggregate &agg, const PRMType *t)

◆ _checkAggregateForDeclaration_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAggregateForDeclaration_ ( O3Class o3class,
O3Aggregate agg 
)
private

Definition at line 899 of file O3ClassFactory_tpl.h.

900  {
901  if (!_solver_->resolveType(agg.variableType())) { return false; }
902 
903  // Checking type legality if overload
904  if (!_checkAggTypeLegality_(o3class, agg)) { return false; }
905 
906  return true;
907  }
O3NameSolver< GUM_SCALAR > * _solver_
bool _checkAggTypeLegality_(O3Class &o3class, O3Aggregate &agg)

◆ _checkAggTypeLegality_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAggTypeLegality_ ( O3Class o3class,
O3Aggregate agg 
)
private

Definition at line 943 of file O3ClassFactory_tpl.h.

944  {
945  if (_prm_->isClass(o3class.superLabel().label())) {
946  const auto& super = _prm_->getClass(o3class.superLabel().label());
947  const auto& agg_type = _prm_->type(agg.variableType().label());
948 
949  if (super.exists(agg.name().label())
950  && !agg_type.isSubTypeOf(super.get(agg.name().label()).type())) {
951  O3PRM_CLASS_ILLEGAL_OVERLOAD(agg.name(), o3class.superLabel(), *_errors_);
952  return false;
953  }
954  }
955 
956  return true;
957  }

◆ _checkAndAddArcsToDag_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAndAddArcsToDag_ ( )
private

Definition at line 159 of file O3ClassFactory_tpl.h.

159  {
160  for (auto& c: _o3_prm_->classes()) {
161  if (c->superLabel().label() != "") {
162  if (!_solver_->resolveClass(c->superLabel())) { return false; }
163 
164  auto head = _nameMap_[c->superLabel().label()];
165  auto tail = _nameMap_[c->name().label()];
166 
167  try {
168  _dag_.addArc(tail, head);
169  } catch (InvalidDirectedCycle&) {
170  // Cyclic inheritance
171  O3PRM_CLASS_CYLIC_INHERITANCE(c->name(), c->superLabel(), *_errors_);
172  return false;
173  }
174  }
175  }
176 
177  return true;
178  }
O3ClassList & classes()
Definition: O3prm.cpp:530
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
Definition: DAG_inl.h:42
O3NameSolver< GUM_SCALAR > * _solver_
HashTable< std::string, gum::NodeId > _nameMap_

◆ _checkAndAddNodesToDag_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAndAddNodesToDag_ ( )
private

Definition at line 140 of file O3ClassFactory_tpl.h.

140  {
141  for (auto& c: _o3_prm_->classes()) {
142  auto id = _dag_.addNode();
143 
144  try {
145  _nameMap_.insert(c->name().label(), id);
146  _classMap_.insert(c->name().label(), c.get());
147  _nodeMap_.insert(id, c.get());
148 
149  } catch (DuplicateElement&) {
150  O3PRM_CLASS_DUPLICATE(c->name(), *_errors_);
151  return false;
152  }
153  }
154 
155  return true;
156  }
O3ClassList & classes()
Definition: O3prm.cpp:530
HashTable< NodeId, O3Class *> _nodeMap_
virtual NodeId addNode()
insert a new node and return its id
HashTable< std::string, gum::NodeId > _nameMap_
HashTable< std::string, O3Class *> _classMap_
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.

◆ _checkAttributeForCompletion_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAttributeForCompletion_ ( const O3Class o3_c,
O3Attribute attr 
)
private

Definition at line 601 of file O3ClassFactory_tpl.h.

602  {
603  // Check for parents existence
604  const auto& c = _prm_->getClass(o3_c.name().label());
605  for (auto& prnt: attr.parents()) {
606  if (!_checkParent_(c, prnt)) { return false; }
607  }
608 
609  // Check that CPT sums to 1
610  auto raw = dynamic_cast< O3RawCPT* >(&attr);
611  if (raw) { return _checkRawCPT_(c, *raw); }
612 
613  auto rule = dynamic_cast< O3RuleCPT* >(&attr);
614  if (rule) { return _checkRuleCPT_(c, *rule); }
615 
616  return true;
617  }
bool _checkRuleCPT_(const PRMClass< GUM_SCALAR > &c, O3RuleCPT &attr)
bool _checkParent_(const PRMClass< GUM_SCALAR > &c, const O3Label &prnt)
bool _checkRawCPT_(const PRMClass< GUM_SCALAR > &c, O3RawCPT &attr)

◆ _checkAttributeForDeclaration_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkAttributeForDeclaration_ ( O3Class o3_c,
O3Attribute attr 
)
private

Definition at line 445 of file O3ClassFactory_tpl.h.

446  {
447  // Check type
448  if (!_solver_->resolveType(attr.type())) { return false; }
449 
450  // Checking type legality if overload
451  if (c.superLabel().label() != "") {
452  const auto& super = _prm_->getClass(c.superLabel().label());
453 
454  if (!super.exists(attr.name().label())) { return true; }
455 
456  const auto& super_type = super.get(attr.name().label()).type();
457  const auto& type = _prm_->type(attr.type().label());
458 
459  if (!type.isSubTypeOf(super_type)) {
460  O3PRM_CLASS_ILLEGAL_OVERLOAD(attr.name(), c.superLabel(), *_errors_);
461  return false;
462  }
463  }
464  return true;
465  }
O3NameSolver< GUM_SCALAR > * _solver_

◆ _checkImplementation_() [1/4]

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkImplementation_ ( O3Class c)
private

Definition at line 194 of file O3ClassFactory_tpl.h.

194  {
195  // Saving attributes names for fast lookup
196  auto attr_map = AttrMap();
197  for (auto& a: c.attributes()) {
198  attr_map.insert(a->name().label(), a.get());
199  }
200 
201  // Saving aggregates names for fast lookup
202  auto agg_map = AggMap();
203  for (auto& agg: c.aggregates()) {
204  agg_map.insert(agg.name().label(), &agg);
205  }
206 
207  auto ref_map = RefMap();
208  for (auto& ref: c.referenceSlots()) {
209  ref_map.insert(ref.name().label(), &ref);
210  }
211 
212  // Cheking interface implementation
213  for (auto& i: c.interfaces()) {
214  if (_solver_->resolveInterface(i)) {
215  if (!_checkImplementation_(c, i, attr_map, agg_map, ref_map)) { return false; }
216  }
217  }
218 
219  return true;
220  }
HashTable< std::string, O3Attribute *> AttrMap
HashTable< std::string, O3Aggregate *> AggMap
O3NameSolver< GUM_SCALAR > * _solver_
HashTable< std::string, O3ReferenceSlot *> RefMap

◆ _checkImplementation_() [2/4]

template<typename GUM_SCALAR >
bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkImplementation_ ( O3Class c,
O3Label i,
HashTable< std::string, O3Attribute * > &  attrMap,
HashTable< std::string, O3Aggregate * > &  aggMap,
HashTable< std::string, O3ReferenceSlot * > &  refMap 
)
private

◆ _checkImplementation_() [3/4]

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkImplementation_ ( O3Label o3_type,
const PRMType type 
)
private

Definition at line 271 of file O3ClassFactory_tpl.h.

272  {
273  if (!_solver_->resolveType(o3_type)) { return false; }
274 
275  return _prm_->type(o3_type.label()).isSubTypeOf(type);
276  }
O3NameSolver< GUM_SCALAR > * _solver_

◆ _checkImplementation_() [4/4]

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkImplementation_ ( O3Label o3_type,
const PRMClassElementContainer< GUM_SCALAR > &  type 
)
private

Definition at line 279 of file O3ClassFactory_tpl.h.

281  {
282  if (!_solver_->resolveSlotType(o3_type)) { return false; }
283 
284  if (_prm_->isInterface(o3_type.label())) {
285  return _prm_->getInterface(o3_type.label()).isSubTypeOf(type);
286  } else {
287  return _prm_->getClass(o3_type.label()).isSubTypeOf(type);
288  }
289  }
O3NameSolver< GUM_SCALAR > * _solver_

◆ _checkLabelsNumber_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkLabelsNumber_ ( const O3RuleCPT attr,
const O3RuleCPT::O3Rule rule 
)
private

Definition at line 658 of file O3ClassFactory_tpl.h.

659  {
660  // Check that the number of labels is correct
661  if (rule.first.size() != attr.parents().size()) {
662  O3PRM_CLASS_ILLEGAL_RULE_SIZE(rule, rule.first.size(), attr.parents().size(), *_errors_);
663  return false;
664  }
665  return true;
666  }

◆ _checkLabelsValues_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkLabelsValues_ ( const PRMClass< GUM_SCALAR > &  c,
const O3RuleCPT attr,
const O3RuleCPT::O3Rule rule 
)
private

Definition at line 669 of file O3ClassFactory_tpl.h.

671  {
672  bool errors = false;
673  for (std::size_t i = 0; i < attr.parents().size(); ++i) {
674  auto label = rule.first[i];
675  auto prnt = attr.parents()[i];
676  try {
677  auto real_labels = _resolveSlotChain_(c, prnt)->type()->labels();
678  // c.get(prnt.label()).type()->labels();
679  if (label.label() != "*"
680  && std::find(real_labels.begin(), real_labels.end(), label.label())
681  == real_labels.end()) {
682  O3PRM_CLASS_ILLEGAL_RULE_LABEL(rule, label, prnt, *_errors_);
683  errors = true;
684  }
685  } catch (Exception&) {
686  // parent does not exists and is already reported
687  }
688  }
689  return errors == false;
690  }
const PRMClassElement< GUM_SCALAR > * _resolveSlotChain_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &chain)

◆ _checkLocalParent_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkLocalParent_ ( const PRMClass< GUM_SCALAR > &  c,
const O3Label prnt 
)
private

Definition at line 631 of file O3ClassFactory_tpl.h.

632  {
633  if (!c.exists(prnt.label())) {
634  O3PRM_CLASS_PARENT_NOT_FOUND(prnt, *_errors_);
635  return false;
636  }
637 
638  const auto& elt = c.get(prnt.label());
642  O3PRM_CLASS_ILLEGAL_PARENT(prnt, *_errors_);
643  return false;
644  }
645 
646  return true;
647  }
Abstract class representing an element of PRM class.

◆ _checkO3Classes_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkO3Classes_ ( )
private

Definition at line 135 of file O3ClassFactory_tpl.h.

◆ _checkParametersNumber_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkParametersNumber_ ( O3Aggregate agg,
Size  n 
)
private

Definition at line 1008 of file O3ClassFactory_tpl.h.

1008  {
1009  if (agg.parameters().size() != n) {
1010  O3PRM_CLASS_AGG_PARAMETERS(agg.name(), Size(n), Size(agg.parameters().size()), *_errors_);
1011  return false;
1012  }
1013 
1014  return true;
1015  }
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47

◆ _checkParameterValue_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkParameterValue_ ( O3Aggregate agg,
const gum::prm::PRMType t 
)
private

Definition at line 1018 of file O3ClassFactory_tpl.h.

1019  {
1020  const auto& param = agg.parameters().front();
1021  bool found = false;
1022  for (Size idx = 0; idx < t.variable().domainSize(); ++idx) {
1023  if (t.variable().label(idx) == param.label()) {
1024  found = true;
1025  break;
1026  }
1027  }
1028 
1029  if (!found) {
1030  O3PRM_CLASS_AGG_PARAMETER_NOT_FOUND(agg.name(), param, *_errors_);
1031  return false;
1032  }
1033 
1034  return true;
1035  }
DiscreteVariable & variable()
Return a reference on the DiscreteVariable contained in this.
Definition: PRMType_inl.h:44
virtual Size domainSize() const =0
virtual std::string label(Idx i) const =0
get the indice-th label. This method is pure virtual.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47

◆ _checkParent_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkParent_ ( const PRMClass< GUM_SCALAR > &  c,
const O3Label prnt 
)
private

Definition at line 620 of file O3ClassFactory_tpl.h.

621  {
622  if (prnt.label().find('.') == std::string::npos) {
623  return _checkLocalParent_(c, prnt);
624 
625  } else {
626  return _checkRemoteParent_(c, prnt);
627  }
628  }
bool _checkRemoteParent_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &prnt)
bool _checkLocalParent_(const PRMClass< GUM_SCALAR > &c, const O3Label &prnt)

◆ _checkRawCPT_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRawCPT_ ( const PRMClass< GUM_SCALAR > &  c,
O3RawCPT attr 
)
private

Definition at line 759 of file O3ClassFactory_tpl.h.

760  {
761  const auto& type = _prm_->type(attr.type().label());
762 
763  auto domainSize = type->domainSize();
764  for (auto& prnt: attr.parents()) {
765  try {
766  domainSize *= c.get(prnt.label()).type()->domainSize();
767  } catch (NotFound&) {
768  // If we are here, all parents have been check so _resolveSlotChain_
769  // will not raise an error and not return a nullptr
770  domainSize *= _resolveSlotChain_(c, prnt)->type()->domainSize();
771  }
772  }
773 
774  // Check for CPT size
775  if (domainSize != attr.values().size()) {
776  O3PRM_CLASS_ILLEGAL_CPT_SIZE(c.name(),
777  attr.name(),
778  Size(attr.values().size()),
779  domainSize,
780  *_errors_);
781  return false;
782  }
783 
784  // Add parameters to formulas
785  const auto& scope = c.scope();
786  for (auto& f: attr.values()) {
787  f.formula().variables().clear();
788 
789  for (const auto& values: scope) {
790  f.formula().variables().insert(values.first, values.second->value());
791  }
792  }
793 
794  // Check that CPT sums to 1
795  Size parent_size = domainSize / type->domainSize();
796  auto values = std::vector< GUM_SCALAR >(parent_size, 0.0f);
797 
798  for (std::size_t i = 0; i < attr.values().size(); ++i) {
799  try {
800  auto idx = i % parent_size;
801  auto val = (GUM_SCALAR)attr.values()[i].formula().result();
802  values[idx] += val;
803 
804  if (val < 0.0 || 1.0 < val) {
805  O3PRM_CLASS_ILLEGAL_CPT_VALUE(c.name(), attr.name(), attr.values()[i], *_errors_);
806  return false;
807  }
808  } catch (Exception&) {
809  O3PRM_CLASS_ILLEGAL_CPT_VALUE(c.name(), attr.name(), attr.values()[i], *_errors_);
810  return false;
811  }
812  }
813 
814  for (auto f: values) {
815  if (std::abs(f - GUM_SCALAR(1.0)) > 1.0e-3) {
816  O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(c.name(), attr.name(), float(f), *_errors_);
817  return false;
818  } else if (std::abs(f - GUM_SCALAR(1.0)) > 1.0e-6) {
819  O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(c.name(), attr.name(), float(f), *_errors_);
820  }
821  }
822  return true;
823  }
Potential< GUM_SCALAR > abs(const Potential< GUM_SCALAR > &arg)
Definition: potential.h:595
const PRMClassElement< GUM_SCALAR > * _resolveSlotChain_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &chain)
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:47

◆ _checkReferenceSlot_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkReferenceSlot_ ( O3Class c,
O3ReferenceSlot ref 
)
private

Definition at line 354 of file O3ClassFactory_tpl.h.

355  {
356  if (!_solver_->resolveSlotType(ref.type())) { return false; }
357 
358  const auto& real_c = _prm_->getClass(c.name().label());
359 
360  // Check for dupplicates
361  if (real_c.exists(ref.name().label())) {
362  const auto& elt = real_c.get(ref.name().label());
363 
365  auto slot_type = (PRMClassElementContainer< GUM_SCALAR >*)nullptr;
366 
367  if (_prm_->isInterface(ref.type().label())) {
368  slot_type = &(_prm_->getInterface(ref.type().label()));
369 
370  } else {
371  slot_type = &(_prm_->getClass(ref.type().label()));
372  }
373 
374  auto real_ref = static_cast< const PRMReferenceSlot< GUM_SCALAR >* >(&elt);
375 
376  if (slot_type->name() == real_ref->slotType().name()) {
377  O3PRM_CLASS_DUPLICATE_REFERENCE(ref.name(), *_errors_);
378  return false;
379 
380  } else if (!slot_type->isSubTypeOf(real_ref->slotType())) {
381  O3PRM_CLASS_ILLEGAL_OVERLOAD(ref.name(), c.name(), *_errors_);
382  return false;
383  }
384 
385  } else {
386  O3PRM_CLASS_DUPLICATE_REFERENCE(ref.name(), *_errors_);
387  return false;
388  }
389  }
390 
391  // If class we need to check for illegal references
392  if (_prm_->isClass(ref.type().label())) {
393  const auto& ref_type = _prm_->getClass(ref.type().label());
394 
395  // No recursive reference
396  if ((&ref_type) == (&real_c)) {
397  O3PRM_CLASS_SELF_REFERENCE(c.name(), ref.name(), *_errors_);
398  return false;
399  }
400 
401  // No reference to subclasses
402  if (ref_type.isSubTypeOf(real_c)) {
403  O3PRM_CLASS_ILLEGAL_SUB_REFERENCE(c.name(), ref.type(), *_errors_);
404  return false;
405  }
406  }
407 
408  return true;
409  }
O3NameSolver< GUM_SCALAR > * _solver_
static INLINE bool isReferenceSlot(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMReferenceSlot.

◆ _checkRemoteParent_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRemoteParent_ ( const PRMClassElementContainer< GUM_SCALAR > &  c,
const O3Label prnt 
)
private

Definition at line 650 of file O3ClassFactory_tpl.h.

652  {
653  if (_resolveSlotChain_(c, prnt) == nullptr) { return false; }
654  return true;
655  }
const PRMClassElement< GUM_SCALAR > * _resolveSlotChain_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &chain)

◆ _checkRuleCPT_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRuleCPT_ ( const PRMClass< GUM_SCALAR > &  c,
O3RuleCPT attr 
)
private

Definition at line 739 of file O3ClassFactory_tpl.h.

740  {
741  const auto& scope = c.scope();
742  bool errors = false;
743  for (auto& rule: attr.rules()) {
744  try {
745  if (!_checkLabelsNumber_(attr, rule)) { errors = true; }
746  if (!_checkLabelsValues_(c, attr, rule)) { errors = true; }
747  _addParamsToForms_(scope, rule);
748  if (!_checkRuleCPTSumsTo1_(c, attr, rule)) { errors = true; }
749  } catch (Exception& e) {
750  GUM_SHOWERROR(e);
751  errors = true;
752  }
753  }
754 
755  return errors == false;
756  }
bool _checkLabelsValues_(const PRMClass< GUM_SCALAR > &c, const O3RuleCPT &attr, const O3RuleCPT::O3Rule &rule)
bool _checkLabelsNumber_(const O3RuleCPT &attr, const O3RuleCPT::O3Rule &rule)
void _addParamsToForms_(const HashTable< std::string, const PRMParameter< GUM_SCALAR > * > &scope, O3RuleCPT::O3Rule &rule)
#define GUM_SHOWERROR(e)
Definition: exceptions.h:57
bool _checkRuleCPTSumsTo1_(const PRMClass< GUM_SCALAR > &c, const O3RuleCPT &attr, const O3RuleCPT::O3Rule &rule)

◆ _checkRuleCPTSumsTo1_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRuleCPTSumsTo1_ ( const PRMClass< GUM_SCALAR > &  c,
const O3RuleCPT attr,
const O3RuleCPT::O3Rule rule 
)
private

Definition at line 708 of file O3ClassFactory_tpl.h.

710  {
711  bool errors = false;
712  // Check that formulas are valid and sums to 1
713  GUM_SCALAR sum = 0.0;
714  for (const auto& f: rule.second) {
715  try {
716  auto value = GUM_SCALAR(f.formula().result());
717  sum += value;
718  if (value < 0.0 || 1.0 < value) {
719  O3PRM_CLASS_ILLEGAL_CPT_VALUE(c.name(), attr.name(), f, *_errors_);
720  errors = true;
721  }
722  } catch (OperationNotAllowed&) {
723  O3PRM_CLASS_ILLEGAL_CPT_VALUE(c.name(), attr.name(), f, *_errors_);
724  errors = true;
725  }
726  }
727 
728  // Check that CPT sums to 1
729  if (std::abs(sum - 1.0) > 1e-3) {
730  O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1(c.name(), attr.name(), float(sum), *_errors_);
731  errors = true;
732  } else if (std::abs(sum - 1.0f) > 1e-6) {
733  O3PRM_CLASS_CPT_DOES_NOT_SUM_TO_1_WARNING(c.name(), attr.name(), float(sum), *_errors_);
734  }
735  return errors == false;
736  }
Potential< GUM_SCALAR > abs(const Potential< GUM_SCALAR > &arg)
Definition: potential.h:595

◆ _checkSlotChainLink_()

template<typename GUM_SCALAR >
INLINE bool gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkSlotChainLink_ ( const PRMClassElementContainer< GUM_SCALAR > &  c,
const O3Label chain,
const std::string &  s 
)
private

Definition at line 864 of file O3ClassFactory_tpl.h.

867  {
868  if (!c.exists(s)) {
869  O3PRM_CLASS_LINK_NOT_FOUND(chain, s, *_errors_);
870  return false;
871  }
872  return true;
873  }

◆ _completeAggregates_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_completeAggregates_ ( PRMFactory< GUM_SCALAR > &  factory,
O3Class c 
)
private

Definition at line 525 of file O3ClassFactory_tpl.h.

526  {
527  // Attributes
528  for (auto& agg: c.aggregates()) {
529  if (_checkAggregateForCompletion_(c, agg)) {
530  factory.continueAggregator(agg.name().label());
531 
532  for (const auto& parent: agg.parents()) {
533  factory.addParent(parent.label());
534  }
535 
536  factory.endAggregator();
537  }
538  }
539  }
bool _checkAggregateForCompletion_(O3Class &o3class, O3Aggregate &agg)

◆ _completeAttribute_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_completeAttribute_ ( PRMFactory< GUM_SCALAR > &  factory,
O3Class c 
)
private

Definition at line 556 of file O3ClassFactory_tpl.h.

557  {
558  // Attributes
559  for (auto& attr: c.attributes()) {
560  if (_checkAttributeForCompletion_(c, *attr)) {
561  factory.continueAttribute(attr->name().label());
562 
563  for (const auto& parent: attr->parents()) {
564  factory.addParent(parent.label());
565  }
566 
567  auto raw = dynamic_cast< const O3RawCPT* >(attr.get());
568 
569  if (raw) {
570  auto values = std::vector< std::string >();
571  for (const auto& val: raw->values()) {
572  values.push_back(val.formula().formula());
573  }
574  factory.setRawCPFByColumns(values);
575  }
576 
577  auto rule_cpt = dynamic_cast< const O3RuleCPT* >(attr.get());
578  if (rule_cpt) {
579  for (const auto& rule: rule_cpt->rules()) {
580  auto labels = std::vector< std::string >();
581  auto values = std::vector< std::string >();
582 
583  for (const auto& lbl: rule.first) {
584  labels.push_back(lbl.label());
585  }
586 
587  for (const auto& form: rule.second) {
588  values.push_back(form.formula().formula());
589  }
590 
591  factory.setCPFByRule(labels, values);
592  }
593  }
594 
595  factory.endAttribute();
596  }
597  }
598  }
bool _checkAttributeForCompletion_(const O3Class &o3_c, O3Attribute &attr)

◆ _declareAggregates_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_declareAggregates_ ( O3Class c)
private

Definition at line 876 of file O3ClassFactory_tpl.h.

876  {
877  PRMFactory< GUM_SCALAR > factory(_prm_);
878  factory.continueClass(c.name().label());
879 
880  for (auto& agg: c.aggregates()) {
881  if (_checkAggregateForDeclaration_(c, agg)) {
882  auto params = std::vector< std::string >();
883  for (auto& p: agg.parameters()) {
884  params.push_back(p.label());
885  }
886 
887  factory.startAggregator(agg.name().label(),
888  agg.aggregateType().label(),
889  agg.variableType().label(),
890  params);
891  factory.endAggregator();
892  }
893  }
894 
895  factory.endClass(false);
896  }
bool _checkAggregateForDeclaration_(O3Class &o3class, O3Aggregate &agg)

◆ _declareAttribute_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_declareAttribute_ ( O3Class c)
private

Definition at line 430 of file O3ClassFactory_tpl.h.

430  {
431  PRMFactory< GUM_SCALAR > factory(_prm_);
432  factory.continueClass(c.name().label());
433 
434  for (auto& attr: c.attributes()) {
435  if (_checkAttributeForDeclaration_(c, *attr)) {
436  factory.startAttribute(attr->type().label(), attr->name().label());
437  factory.endAttribute();
438  }
439  }
440 
441  factory.endClass(false);
442  }
bool _checkAttributeForDeclaration_(O3Class &o3_c, O3Attribute &attr)

◆ _resolveSlotChain_()

template<typename GUM_SCALAR >
INLINE const PRMClassElement< GUM_SCALAR > * gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_resolveSlotChain_ ( const PRMClassElementContainer< GUM_SCALAR > &  c,
const O3Label chain 
)
private

Definition at line 826 of file O3ClassFactory_tpl.h.

828  {
829  auto s = chain.label();
830  auto current = &c;
831  std::vector< std::string > v;
832 
833  decomposePath(chain.label(), v);
834 
835  for (size_t i = 0; i < v.size(); ++i) {
836  auto link = v[i];
837 
838  if (!_checkSlotChainLink_(*current, chain, link)) { return nullptr; }
839 
840  auto elt = &(current->get(link));
841 
842  if (i == v.size() - 1) {
843  // last link, should be an attribute or aggregate
844  return elt;
845 
846  } else {
847  // should be a reference slot
848 
849  auto ref = dynamic_cast< const PRMReferenceSlot< GUM_SCALAR >* >(elt);
850  if (ref) {
851  current = &(ref->slotType());
852  } else {
853  return nullptr; // failsafe to prevent infinite loop
854  }
855  }
856  }
857 
858  // Encountered only reference slots
859 
860  return nullptr;
861  }
bool _checkSlotChainLink_(const PRMClassElementContainer< GUM_SCALAR > &c, const O3Label &chain, const std::string &s)
void decomposePath(const std::string &path, std::vector< std::string > &v)
Decompose a string in a vector of strings using "." as separators.
Definition: utils_prm.cpp:28

◆ _setO3ClassCreationOrder_()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_setO3ClassCreationOrder_ ( )
private

Definition at line 126 of file O3ClassFactory_tpl.h.

126  {
127  auto topo_order = _dag_.topologicalOrder();
128 
129  for (auto id = topo_order.rbegin(); id != topo_order.rend(); --id) {
130  _o3Classes_.push_back(_nodeMap_[*id]);
131  }
132  }
std::vector< O3Class *> _o3Classes_
HashTable< NodeId, O3Class *> _nodeMap_
const Sequence< NodeId > & topologicalOrder(bool clear=true) const
The topological order stays the same as long as no variable or arcs are added or erased src the topol...
Definition: diGraph.cpp:88

◆ buildClasses()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildClasses ( )

Definition at line 102 of file O3ClassFactory_tpl.h.

102  {
103  PRMFactory< GUM_SCALAR > factory(_prm_);
104 
105  // Class with a super class must be declared after
106  if (_checkO3Classes_()) {
108 
109  for (auto c: _o3Classes_) {
110  // Soving interfaces
111  auto implements = Set< std::string >();
112  for (auto& i: c->interfaces()) {
113  if (_solver_->resolveInterface(i)) { implements.insert(i.label()); }
114  }
115 
116  // Adding the class
117  if (_solver_->resolveClass(c->superLabel())) {
118  factory.startClass(c->name().label(), c->superLabel().label(), &implements, true);
119  factory.endClass(false);
120  }
121  }
122  }
123  }
std::vector< O3Class *> _o3Classes_
O3NameSolver< GUM_SCALAR > * _solver_
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:606

◆ buildImplementations()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildImplementations ( )

Definition at line 181 of file O3ClassFactory_tpl.h.

181  {
182  for (auto& c: _o3_prm_->classes()) {
183  if (_checkImplementation_(*c)) {
184  _prm_->getClass(c->name().label()).initializeInheritance();
185  }
186  }
187  }
O3ClassList & classes()
Definition: O3prm.cpp:530

◆ buildParameters()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildParameters ( )

Definition at line 292 of file O3ClassFactory_tpl.h.

292  {
293  PRMFactory< GUM_SCALAR > factory(_prm_);
294  // Class with a super class must be declared after
295  for (auto c: _o3Classes_) {
296  _prm_->getClass(c->name().label()).inheritParameters();
297 
298  factory.continueClass(c->name().label());
299 
300  _addParameters_(factory, *c);
301 
302  factory.endClass(false);
303  }
304  }
std::vector< O3Class *> _o3Classes_
void _addParameters_(PRMFactory< GUM_SCALAR > &factory, O3Class &c)

◆ buildReferenceSlots()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildReferenceSlots ( )

Definition at line 329 of file O3ClassFactory_tpl.h.

329  {
330  // Class with a super class must be declared after
331  for (auto c: _o3Classes_) {
332  _prm_->getClass(c->name().label()).inheritReferenceSlots();
334  }
335  }
std::vector< O3Class *> _o3Classes_

◆ completeAggregates()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAggregates ( )

Definition at line 510 of file O3ClassFactory_tpl.h.

510  {
511  PRMFactory< GUM_SCALAR > factory(_prm_);
512 
513  // Class with a super class must be declared in order
514  for (auto c: _o3Classes_) {
515  factory.continueClass(c->name().label());
516 
517  _completeAggregates_(factory, *c);
518 
519  factory.endClass(false);
520  }
521  }
std::vector< O3Class *> _o3Classes_
void _completeAggregates_(PRMFactory< GUM_SCALAR > &factory, O3Class &c)

◆ completeAttributes()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAttributes ( )

Definition at line 468 of file O3ClassFactory_tpl.h.

468  {
469  PRMFactory< GUM_SCALAR > factory(_prm_);
470 
471  // Class with a super class must be declared in order
472  for (auto c: _o3Classes_) {
473  _prm_->getClass(c->name().label()).inheritSlotChains();
474  factory.continueClass(c->name().label());
475 
476  _completeAttribute_(factory, *c);
477 
478  if (c->superLabel().label() != "") {
479  auto& super = _prm_->getClass(c->superLabel().label());
480  auto to_complete = Set< std::string >();
481 
482  for (auto a: super.attributes()) {
483  to_complete.insert(a->safeName());
484  }
485 
486  for (auto a: super.aggregates()) {
487  to_complete.insert(a->safeName());
488  }
489 
490  for (auto& a: c->attributes()) {
491  to_complete.erase(
492  _prm_->getClass(c->name().label()).get(a->name().label()).safeName());
493  }
494 
495  for (auto& a: c->aggregates()) {
496  to_complete.erase(
497  _prm_->getClass(c->name().label()).get(a.name().label()).safeName());
498  }
499 
500  for (auto a: to_complete) {
501  _prm_->getClass(c->name().label()).completeInheritance(a);
502  }
503  }
504 
505  factory.endClass(true);
506  }
507  }
void _completeAttribute_(PRMFactory< GUM_SCALAR > &factory, O3Class &c)
std::vector< O3Class *> _o3Classes_
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:606

◆ declareAggregates()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::declareAggregates ( )

Definition at line 421 of file O3ClassFactory_tpl.h.

421  {
422  // Class with a super class must be declared after
423  for (auto c: _o3Classes_) {
424  _prm_->getClass(c->name().label()).inheritAggregates();
426  }
427  }
std::vector< O3Class *> _o3Classes_

◆ declareAttributes()

template<typename GUM_SCALAR >
INLINE void gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::declareAttributes ( )

Definition at line 412 of file O3ClassFactory_tpl.h.

412  {
413  // Class with a super class must be declared after
414  for (auto c: _o3Classes_) {
415  _prm_->getClass(c->name().label()).inheritAttributes();
416  _declareAttribute_(*c);
417  }
418  }
std::vector< O3Class *> _o3Classes_

◆ operator=() [1/2]

template<typename GUM_SCALAR >
INLINE O3ClassFactory< GUM_SCALAR > & gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::operator= ( const O3ClassFactory< GUM_SCALAR > &  src)

Definition at line 71 of file O3ClassFactory_tpl.h.

71  {
72  if (this == &src) { return *this; }
73  _prm_ = src._prm_;
74  _o3_prm_ = src._o3_prm_;
75  _solver_ = src._solver_;
76  _errors_ = src._errors_;
77  _nameMap_ = src._nameMap_;
78  _classMap_ = src._classMap_;
79  _nodeMap_ = src._nodeMap_;
80  _dag_ = src._dag_;
81  _o3Classes_ = src._o3Classes_;
82  return *this;
83  }
std::vector< O3Class *> _o3Classes_
HashTable< NodeId, O3Class *> _nodeMap_
O3NameSolver< GUM_SCALAR > * _solver_
HashTable< std::string, gum::NodeId > _nameMap_
HashTable< std::string, O3Class *> _classMap_

◆ operator=() [2/2]

template<typename GUM_SCALAR >
INLINE O3ClassFactory< GUM_SCALAR > & gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::operator= ( O3ClassFactory< GUM_SCALAR > &&  src)

Definition at line 87 of file O3ClassFactory_tpl.h.

87  {
88  if (this == &src) { return *this; }
89  _prm_ = std::move(src._prm_);
90  _o3_prm_ = std::move(src._o3_prm_);
91  _solver_ = std::move(src._solver_);
92  _errors_ = std::move(src._errors_);
93  _nameMap_ = std::move(src._nameMap_);
94  _classMap_ = std::move(src._classMap_);
95  _nodeMap_ = std::move(src._nodeMap_);
96  _dag_ = std::move(src._dag_);
97  _o3Classes_ = std::move(src._o3Classes_);
98  return *this;
99  }
std::vector< O3Class *> _o3Classes_
HashTable< NodeId, O3Class *> _nodeMap_
O3NameSolver< GUM_SCALAR > * _solver_
HashTable< std::string, gum::NodeId > _nameMap_
HashTable< std::string, O3Class *> _classMap_

Member Data Documentation

◆ _classMap_

template<typename GUM_SCALAR >
HashTable< std::string, O3Class* > gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_classMap_
private

Definition at line 94 of file O3ClassFactory.h.

◆ _dag_

template<typename GUM_SCALAR >
DAG gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_dag_
private

Definition at line 96 of file O3ClassFactory.h.

◆ _errors_

template<typename GUM_SCALAR >
ErrorsContainer* gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_errors_
private

Definition at line 91 of file O3ClassFactory.h.

◆ _nameMap_

template<typename GUM_SCALAR >
HashTable< std::string, gum::NodeId > gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_nameMap_
private

Definition at line 93 of file O3ClassFactory.h.

◆ _nodeMap_

template<typename GUM_SCALAR >
HashTable< NodeId, O3Class* > gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_nodeMap_
private

Definition at line 95 of file O3ClassFactory.h.

◆ _o3_prm_

template<typename GUM_SCALAR >
O3PRM* gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_o3_prm_
private

Definition at line 89 of file O3ClassFactory.h.

◆ _o3Classes_

template<typename GUM_SCALAR >
std::vector< O3Class* > gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_o3Classes_
private

Definition at line 97 of file O3ClassFactory.h.

◆ _prm_

template<typename GUM_SCALAR >
PRM< GUM_SCALAR >* gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_prm_
private

Definition at line 88 of file O3ClassFactory.h.

◆ _solver_

template<typename GUM_SCALAR >
O3NameSolver< GUM_SCALAR >* gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_solver_
private

Definition at line 90 of file O3ClassFactory.h.


The documentation for this class was generated from the following files: