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 38 of file O3InterfaceFactory_tpl.h.
ErrorsContainer * _errors_
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ O3InterfaceFactory() [2/3]
template<typename GUM_SCALAR >
Definition at line 48 of file O3InterfaceFactory_tpl.h.
ErrorsContainer * _errors_
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ O3InterfaceFactory() [3/3]
template<typename GUM_SCALAR >
Definition at line 56 of file O3InterfaceFactory_tpl.h.
58 _prm_(std::move(src._prm_)),
ErrorsContainer * _errors_
O3InterfaceFactory(PRM< GUM_SCALAR > &prm, O3PRM &o3_prm, O3NameSolver< GUM_SCALAR > &solver, ErrorsContainer &errors)
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ ~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 131 of file O3InterfaceFactory_tpl.h.
134 if (i->superLabel().label() !=
"") {
135 if (!
_solver_->resolveInterface(i->superLabel())) {
return false; }
137 auto head =
_nameMap_[i->superLabel().label()];
138 auto tail =
_nameMap_[i->name().label()];
143 }
catch (InvalidDirectedCycle&) {
145 O3PRM_INTERFACE_CYCLIC_INHERITANCE(i->name(), i->superLabel(), *
_errors_);
ErrorsContainer * _errors_
void addArc(NodeId tail, NodeId head) final
insert a new arc into the directed graph
HashTable< std::string, gum::NodeId > _nameMap_
O3NameSolver< GUM_SCALAR > * _solver_
O3InterfaceList & interfaces()
◆ _addInterface2Dag_()
template<typename GUM_SCALAR >
Definition at line 112 of file O3InterfaceFactory_tpl.h.
121 }
catch (DuplicateElement&) {
123 O3PRM_INTERFACE_DUPLICATE(i->name(), *
_errors_);
HashTable< std::string, O3Interface *> _interfaceMap_
ErrorsContainer * _errors_
HashTable< std::string, gum::NodeId > _nameMap_
virtual NodeId addNode()
insert a new node and return its id
HashTable< NodeId, O3Interface *> _nodeMap_
O3InterfaceList & interfaces()
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
◆ _checkAttributeOverloadLegality_()
template<typename GUM_SCALAR >
Definition at line 230 of file O3InterfaceFactory_tpl.h.
233 const auto& real_i =
_prm_->getInterface(i.name().label());
234 const auto& real_elt = real_i.get(elt.name().label());
236 const auto& sub_type =
_prm_->type(elt.type().label());
237 const auto& super_type = real_elt.type();
239 if (!sub_type.isSubTypeOf(super_type)) {
240 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
_errors_);
244 if (sub_type.name() == super_type.name()) {
245 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
_errors_);
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
◆ _checkCyclicReference_()
template<typename GUM_SCALAR >
Definition at line 285 of file O3InterfaceFactory_tpl.h.
287 if (
_prm_->isInterface(elt.type().label()) ||
_prm_->isClass(elt.type().label())) {
288 auto ref_type = (
const PRMClassElementContainer< GUM_SCALAR >*)
nullptr;
290 if (
_prm_->isInterface(elt.type().label())) {
291 ref_type = &(
_prm_->getInterface(elt.type().label()));
293 ref_type = &(
_prm_->getClass(elt.type().label()));
296 const auto& real_i =
_prm_->getInterface(i.name().label());
298 if (&real_i == ref_type) {
299 O3PRM_INTERFACE_SELF_REFERENCE(i, elt, *
_errors_);
303 if (ref_type->isSubTypeOf(real_i)) {
304 O3PRM_INTERFACE_ILLEGAL_SUB_REFERENCE(i, elt, *
_errors_);
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
◆ _checkInterfaceElement_()
template<typename GUM_SCALAR >
Definition at line 191 of file O3InterfaceFactory_tpl.h.
193 if (!
_solver_->resolveClassElement(elt.type())) {
return false; }
195 if (
_prm_->isType(elt.type().label()) && elt.isArray()) {
196 O3PRM_INTERFACE_ILLEGAL_ARRAY(elt.name(), *
_errors_);
200 const auto& real_i =
_prm_->getInterface(i.name().label());
202 if (real_i.exists(elt.name().label())) {
bool _checkCyclicReference_(O3Interface &i, O3InterfaceElement &elt)
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
bool _checkOverloadLegality_(O3Interface &i, O3InterfaceElement &elt)
◆ _checkO3Interfaces_()
template<typename GUM_SCALAR >
◆ _checkOverloadLegality_()
template<typename GUM_SCALAR >
Definition at line 213 of file O3InterfaceFactory_tpl.h.
215 const auto& real_i =
_prm_->getInterface(i.name().label());
216 const auto& real_elt = real_i.get(elt.name().label());
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)
bool _checkReferenceOverloadLegality_(O3Interface &i, O3InterfaceElement &elt)
◆ _checkReferenceOverloadLegality_()
template<typename GUM_SCALAR >
Definition at line 253 of file O3InterfaceFactory_tpl.h.
256 const auto& real_i =
_prm_->getInterface(i.name().label());
258 =
static_cast< const PRMReferenceSlot< GUM_SCALAR >&
>(real_i.get(elt.name().label()));
260 auto sub_type = (
const PRMClassElementContainer< GUM_SCALAR >*)
nullptr;
262 if (
_prm_->isClass(elt.type().label())) {
263 sub_type = &(
_prm_->getClass(elt.type().label()));
265 sub_type = &(
_prm_->getInterface(elt.type().label()));
268 auto super_type = &(real_elt.slotType());
270 if (!sub_type->isSubTypeOf(*super_type)) {
271 O3PRM_INTERFACE_ILLEGAL_OVERLOAD(elt, *
_errors_);
275 if (sub_type->name() == super_type->name()) {
276 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
_errors_);
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
◆ _setO3InterfaceCreationOrder_()
template<typename GUM_SCALAR >
Definition at line 154 of file O3InterfaceFactory_tpl.h.
156 for (
auto id = topo_order.rbegin();
id != topo_order.rend(); --id) {
std::vector< O3Interface *> _o3Interface_
HashTable< NodeId, O3Interface *> _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...
◆ buildElements()
template<typename GUM_SCALAR >
Definition at line 162 of file O3InterfaceFactory_tpl.h.
163 PRMFactory< GUM_SCALAR > factory(
_prm_);
166 _prm_->getInterface(i->name().label()).inheritInterface();
168 factory.continueInterface(i->name().label());
170 for (
auto& elt: i->elements()) {
173 if (
_prm_->isType(elt.type().label())) {
174 factory.addAttribute(elt.type().label(), elt.name().label());
176 factory.addReferenceSlot(elt.type().label(), elt.name().label(), elt.isArray());
179 }
catch (OperationNotAllowed&) {
181 O3PRM_INTERFACE_DUPLICATE_ELEMENT(elt, *
_errors_);
185 factory.endInterface();
std::vector< O3Interface *> _o3Interface_
ErrorsContainer * _errors_
bool _checkInterfaceElement_(O3Interface &i, O3InterfaceElement &elt)
PRM< GUM_SCALAR > * _prm_
◆ buildInterfaces()
template<typename GUM_SCALAR >
Definition at line 92 of file O3InterfaceFactory_tpl.h.
93 PRMFactory< GUM_SCALAR > factory(
_prm_);
98 if (
_solver_->resolveInterface(i->superLabel())) {
99 factory.startInterface(i->name().label(), i->superLabel().label(),
true);
100 factory.endInterface();
std::vector< O3Interface *> _o3Interface_
bool _checkO3Interfaces_()
void _setO3InterfaceCreationOrder_()
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ operator=() [1/2]
template<typename GUM_SCALAR >
Definition at line 71 of file O3InterfaceFactory_tpl.h.
72 if (
this == &src) {
return *
this; }
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ operator=() [2/2]
template<typename GUM_SCALAR >
Definition at line 82 of file O3InterfaceFactory_tpl.h.
83 if (
this == &src) {
return *
this; }
84 _prm_ = std::move(src._prm_);
ErrorsContainer * _errors_
PRM< GUM_SCALAR > * _prm_
O3NameSolver< GUM_SCALAR > * _solver_
◆ _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: