Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
More...
#include <agrum/PRM/o3prm/O3InterfaceFactory.h>
template<typename GUM_SCALAR>
class gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >
Bulds gum::prm:PRMInterface from gum::prm::o3prm::O3Interface.
- Template Parameters
-
Definition at line 58 of file O3InterfaceFactory.h.
◆ O3InterfaceFactory() [1/3]
template<typename GUM_SCALAR >
Definition at line 37 of file O3InterfaceFactory_tpl.h.
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ O3InterfaceFactory() [2/3]
template<typename GUM_SCALAR >
Definition at line 48 of file O3InterfaceFactory_tpl.h.
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ O3InterfaceFactory() [3/3]
template<typename GUM_SCALAR >
Definition at line 56 of file O3InterfaceFactory_tpl.h.
58 prm__(std::move(src.prm__)),
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ ~O3InterfaceFactory()
template<typename GUM_SCALAR >
Definition at line 65 of file O3InterfaceFactory_tpl.h.
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
◆ addArcs2Dag__()
template<typename GUM_SCALAR >
Definition at line 135 of file O3InterfaceFactory_tpl.h.
138 if (i->superLabel().label() !=
"") {
139 if (!
solver__->resolveInterface(i->superLabel())) {
return false; }
141 auto head =
nameMap__[i->superLabel().label()];
142 auto tail =
nameMap__[i->name().label()];
147 }
catch (InvalidDirectedCycle&) {
149 O3PRM_INTERFACE_CYCLIC_INHERITANCE(i->name(),
HashTable< std::string, gum::NodeId > nameMap__
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
O3NameSolver< GUM_SCALAR > * solver__
O3InterfaceList & interfaces()
ErrorsContainer * errors__
◆ addInterface2Dag__()
template<typename GUM_SCALAR >
Definition at line 116 of file O3InterfaceFactory_tpl.h.
125 }
catch (DuplicateElement&) {
127 O3PRM_INTERFACE_DUPLICATE(i->name(), *
errors__);
HashTable< std::string, gum::NodeId > nameMap__
virtual NodeId addNode()
insert a new node and return its id
O3InterfaceList & interfaces()
ErrorsContainer * errors__
HashTable< std::string, O3Interface *> interfaceMap__
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
HashTable< NodeId, O3Interface *> nodeMap__
◆ buildElements()
template<typename GUM_SCALAR >
Definition at line 169 of file O3InterfaceFactory_tpl.h.
170 PRMFactory< GUM_SCALAR > factory(
prm__);
173 prm__->getInterface(i->name().label()).inheritInterface();
175 factory.continueInterface(i->name().label());
177 for (
auto& elt: i->elements()) {
180 if (
prm__->isType(elt.type().label())) {
181 factory.addAttribute(elt.type().label(), elt.name().label());
183 factory.addReferenceSlot(elt.type().label(),
188 }
catch (OperationNotAllowed&) {
190 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
errors__);
194 factory.endInterface();
PRM< GUM_SCALAR > * prm__
bool checkInterfaceElement__(O3Interface &i, O3InterfaceElement &elt)
ErrorsContainer * errors__
std::vector< O3Interface *> o3Interface__
◆ buildInterfaces()
template<typename GUM_SCALAR >
Definition at line 94 of file O3InterfaceFactory_tpl.h.
95 PRMFactory< GUM_SCALAR > factory(
prm__);
100 if (
solver__->resolveInterface(i->superLabel())) {
101 factory.startInterface(i->name().label(),
102 i->superLabel().label(),
104 factory.endInterface();
bool checkO3Interfaces__()
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
std::vector< O3Interface *> o3Interface__
void setO3InterfaceCreationOrder__()
◆ checkAttributeOverloadLegality__()
template<typename GUM_SCALAR >
Definition at line 240 of file O3InterfaceFactory_tpl.h.
243 const auto& real_i =
prm__->getInterface(i.name().label());
244 const auto& real_elt = real_i.get(elt.name().label());
246 const auto& sub_type =
prm__->type(elt.type().label());
247 const auto& super_type = real_elt.type();
249 if (!sub_type.isSubTypeOf(super_type)) {
250 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
errors__);
254 if (sub_type.name() == super_type.name()) {
255 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
errors__);
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ checkCyclicReference__()
template<typename GUM_SCALAR >
Definition at line 296 of file O3InterfaceFactory_tpl.h.
299 if (
prm__->isInterface(elt.type().label())
300 ||
prm__->isClass(elt.type().label())) {
301 auto ref_type = (
const PRMClassElementContainer< GUM_SCALAR >*)
nullptr;
303 if (
prm__->isInterface(elt.type().label())) {
304 ref_type = &(
prm__->getInterface(elt.type().label()));
306 ref_type = &(
prm__->getClass(elt.type().label()));
309 const auto& real_i =
prm__->getInterface(i.name().label());
311 if (&real_i == ref_type) {
312 O3PRM_INTERFACE_SELF_REFERENCE(i, elt, *
errors__);
316 if (ref_type->isSubTypeOf(real_i)) {
317 O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(i, elt, *
errors__);
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ checkInterfaceElement__()
template<typename GUM_SCALAR >
Definition at line 199 of file O3InterfaceFactory_tpl.h.
202 if (!
solver__->resolveClassElement(elt.type())) {
return false; }
204 if (
prm__->isType(elt.type().label()) && elt.isArray()) {
205 O3PRM_INTERFACE_ILLEGAL_ARRAY(elt.name(), *
errors__);
209 const auto& real_i =
prm__->getInterface(i.name().label());
211 if (real_i.exists(elt.name().label())) {
bool checkOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
bool checkCyclicReference__(O3Interface &i, O3InterfaceElement &elt)
ErrorsContainer * errors__
◆ checkO3Interfaces__()
template<typename GUM_SCALAR >
◆ checkOverloadLegality__()
template<typename GUM_SCALAR >
Definition at line 221 of file O3InterfaceFactory_tpl.h.
224 const auto& real_i =
prm__->getInterface(i.name().label());
225 const auto& real_elt = real_i.get(elt.name().label());
bool checkReferenceOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
static INLINE bool isAttribute(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMAttribute.
PRM< GUM_SCALAR > * prm__
static INLINE bool isReferenceSlot(const PRMClassElement< GUM_SCALAR > &elt)
Returns true if obj_ptr is of type PRMReferenceSlot.
bool checkAttributeOverloadLegality__(O3Interface &i, O3InterfaceElement &elt)
◆ checkReferenceOverloadLegality__()
template<typename GUM_SCALAR >
Definition at line 264 of file O3InterfaceFactory_tpl.h.
267 const auto& real_i =
prm__->getInterface(i.name().label());
269 =
static_cast< const PRMReferenceSlot< GUM_SCALAR >&
>(
270 real_i.get(elt.name().label()));
272 auto sub_type = (
const PRMClassElementContainer< GUM_SCALAR >*)
nullptr;
274 if (
prm__->isClass(elt.type().label())) {
275 sub_type = &(
prm__->getClass(elt.type().label()));
277 sub_type = &(
prm__->getInterface(elt.type().label()));
280 auto super_type = &(real_elt.slotType());
282 if (!sub_type->isSubTypeOf(*super_type)) {
283 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
errors__);
287 if (sub_type->name() == super_type->name()) {
288 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
errors__);
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ operator=() [1/2]
template<typename GUM_SCALAR >
Definition at line 71 of file O3InterfaceFactory_tpl.h.
73 if (
this == &src) {
return *
this; }
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ operator=() [2/2]
template<typename GUM_SCALAR >
Definition at line 83 of file O3InterfaceFactory_tpl.h.
85 if (
this == &src) {
return *
this; }
86 prm__ = std::move(src.prm__);
O3NameSolver< GUM_SCALAR > * solver__
PRM< GUM_SCALAR > * prm__
ErrorsContainer * errors__
◆ setO3InterfaceCreationOrder__()
template<typename GUM_SCALAR >
Definition at line 161 of file O3InterfaceFactory_tpl.h.
163 for (
auto id = topo_order.rbegin();
id != topo_order.rend(); --id) {
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...
std::vector< O3Interface *> o3Interface__
HashTable< NodeId, O3Interface *> nodeMap__
◆ dag__
template<typename GUM_SCALAR >
◆ eltName__
template<typename GUM_SCALAR >
◆ errors__
template<typename GUM_SCALAR >
◆ interfaceMap__
template<typename GUM_SCALAR >
◆ nameMap__
template<typename GUM_SCALAR >
◆ nodeMap__
template<typename GUM_SCALAR >
◆ o3_prm__
template<typename GUM_SCALAR >
◆ o3Interface__
template<typename GUM_SCALAR >
◆ prm__
template<typename GUM_SCALAR >
◆ solver__
template<typename GUM_SCALAR >
The documentation for this class was generated from the following files: