37 template <
typename GUM_SCALAR >
44 __o3_prm(&o3_prm), __solver(&solver), __errors(&errors) {
48 template <
typename GUM_SCALAR >
56 template <
typename GUM_SCALAR >
65 template <
typename GUM_SCALAR >
70 template <
typename GUM_SCALAR >
73 if (
this == &src) {
return *
this; }
81 template <
typename GUM_SCALAR >
84 if (
this == &src) {
return *
this; }
85 __prm = std::move(src.__prm);
92 template <
typename GUM_SCALAR >
99 if (
__solver->resolveInterface(i->superLabel())) {
101 i->name().label(), i->superLabel().label(),
true);
108 template <
typename GUM_SCALAR >
113 template <
typename GUM_SCALAR >
125 O3PRM_INTERFACE_DUPLICATE(i->name(), *
__errors);
132 template <
typename GUM_SCALAR >
136 if (i->superLabel().label() !=
"") {
137 if (!
__solver->resolveInterface(i->superLabel())) {
return false; }
139 auto head =
__nameMap[i->superLabel().label()];
140 auto tail =
__nameMap[i->name().label()];
147 O3PRM_INTERFACE_CYCLIC_INHERITANCE(
148 i->name(), i->superLabel(), *
__errors);
156 template <
typename GUM_SCALAR >
160 for (
auto id = topo_order.rbegin();
id != topo_order.rend(); --id) {
165 template <
typename GUM_SCALAR >
170 __prm->getInterface(i->name().label()).inheritInterface();
174 for (
auto& elt : i->elements()) {
177 if (
__prm->isType(elt.type().label())) {
178 factory.
addAttribute(elt.type().label(), elt.name().label());
181 elt.type().label(), elt.name().label(), elt.isArray());
186 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
__errors);
194 template <
typename GUM_SCALAR >
197 if (!
__solver->resolveClassElement(elt.
type())) {
return false; }
215 template <
typename GUM_SCALAR >
219 const auto& real_elt = real_i.get(elt.
name().
label());
232 template <
typename GUM_SCALAR >
237 const auto& real_elt = real_i.get(elt.
name().
label());
240 const auto& super_type = real_elt.type();
242 if (!sub_type.isSubTypeOf(super_type)) {
243 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
__errors);
247 if (sub_type.name() == super_type.name()) {
248 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
__errors);
255 template <
typename GUM_SCALAR >
260 const auto& real_elt =
272 auto super_type = &(real_elt.slotType());
274 if (!sub_type->isSubTypeOf(*super_type)) {
275 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
__errors);
279 if (sub_type->name() == super_type->name()) {
280 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
__errors);
287 template <
typename GUM_SCALAR >
302 if (&real_i == ref_type) {
303 O3PRM_INTERFACE_SELF_REFERENCE(i, elt, *
__errors);
307 if (ref_type->isSubTypeOf(real_i)) {
308 O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(i, elt, *
__errors);
void __setO3InterfaceCreationOrder()
virtual void endInterface() override
Tells the factory that we finished an interface declaration.
bool __checkReferenceOverloadLegality(O3Interface &i, O3InterfaceElement &elt)
bool __checkAttributeOverloadLegality(O3Interface &i, O3InterfaceElement &elt)
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
virtual void continueInterface(const std::string &name) override
Continue the declaration of an interface.
Abstract class representing an element of PRM class.
virtual void startInterface(const std::string &i, const std::string &ext="", bool delayInheritance=false) override
Tells the factory that we start an interface declaration.
virtual void addReferenceSlot(const std::string &type, const std::string &name, bool isArray) override
Tells the factory that we started declaring a slot.
This class is used contain and manipulate gum::ParseError.
bool __checkOverloadLegality(O3Interface &i, O3InterfaceElement &elt)
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
O3InterfaceFactory< GUM_SCALAR > & operator=(const O3InterfaceFactory< GUM_SCALAR > &src)
HashTable< NodeId, O3Interface *> __nodeMap
virtual void addAttribute(const std::string &type, const std::string &name) override
Add an attribute to an interface.
virtual NodeId addNode()
insert a new node and return its id
A PRMReferenceSlot represent a relation between two PRMClassElementContainer.
O3NameSolver< GUM_SCALAR > * __solver
PRM< GUM_SCALAR > * __prm
Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
Resolves names for the different O3PRM factories.
bool __checkO3Interfaces()
bool __addInterface2Dag()
Factory which builds a PRM<GUM_SCALAR>.
ErrorsContainer * __errors
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
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...
O3InterfaceList & interfaces()
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
<agrum/PRM/classElementContainer.h>
HashTable< std::string, gum::NodeId > __nameMap
bool __checkCyclicReference(O3Interface &i, O3InterfaceElement &elt)
HashTable< std::string, O3Interface *> __interfaceMap
The O3InterfaceElement is part of the AST of the O3PRM language.
The O3PRM is part of the AST of the O3PRM language.
bool __checkInterfaceElement(O3Interface &i, O3InterfaceElement &elt)
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
The O3Interface is part of the AST of the O3PRM language.
std::vector< O3Interface *> __o3Interface