34 #include <agrum/agrum.h> 35 #include <agrum/tools/core/hashFunc.h> 36 #include <agrum/tools/core/bijection.h> 37 #include <agrum/tools/core/sequence.h> 38 #include <agrum/tools/core/set.h> 39 #include <agrum/tools/multidim/implementations/multiDimImplementation.h> 40 #include <agrum/tools/multidim/implementations/multiDimSparse.h> 41 #include <agrum/PRM/elements/PRMAggregate.h> 42 #include <agrum/PRM/elements/PRMAttribute.h> 43 #include <agrum/PRM/elements/PRMClassElementContainer.h> 44 #include <agrum/PRM/elements/PRMParameter.h> 45 #include <agrum/PRM/elements/PRMReferenceSlot.h> 46 #include <agrum/PRM/elements/PRMSlotChain.h> 52 template <
typename GUM_SCALAR >
64 template <
typename GUM_SCALAR >
76 explicit PRMClass(
const std::string& name);
86 bool delayInheritance =
false);
97 const Set< PRMInterface< GUM_SCALAR >* >& set,
98 bool delayInheritance =
false);
110 const Set< PRMInterface< GUM_SCALAR >* >& set,
111 bool delayInheritance =
false);
153 virtual bool isOutputNode(
const PRMClassElement< GUM_SCALAR >& elt)
const;
184 virtual void addArc(
const std::string& tail,
const std::string& head);
253 virtual bool isSubTypeOf(
const PRMClassElementContainer< GUM_SCALAR >& cec)
const;
313 virtual const DAG&
dag_()
const;
437 const PRMClassElement< GUM_SCALAR >* overloader);
441 PRMAttribute< GUM_SCALAR >* overloaded);
445 PRMClassElement< GUM_SCALAR >* overloaded);
449 PRMReferenceSlot< GUM_SCALAR >* overloaded);
453 PRMParameter< GUM_SCALAR >* overloaded);
459 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 460 extern template class PRMClass<
double >;
468 #include <agrum/PRM/elements/PRMClass_tpl.h> virtual NodeId add(PRMClassElement< GUM_SCALAR > *elt)
See gum::prm::add(PRMClassElement<GUM_SCALAR>*).
void _addCastDescendants_(PRMClassElement< GUM_SCALAR > *attr)
Recursively adds cast descendant of attr in this Class<GUM_SCALAR>.
const Set< PRMInterface< GUM_SCALAR > *> & implements() const
Returns the Set of PRMInterface<GUM_SCALAR> implemented by this Class<GUM_SCALAR>.
const PRMClassElement< GUM_SCALAR > & get(const std::string &name) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
virtual DAG & dag_()
Returns a non constant reference over this PRMInterface<GUM_SCALAR>'s DAG.
virtual const DAG & dag_() const
returns a constant reference over this interface's dag.
void _checkRefInterface_(PRMReferenceSlot< GUM_SCALAR > *elt, PRMInterface< GUM_SCALAR > *i)
Check that a given element respects a specific interface.
PRMClass< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &&source)=delete
Move operator. Don't use it.
void _inheritClass_(const PRMClass< GUM_SCALAR > &c)
Proceed with the copy when this inherits c.
INLINE void emplace(Args &&... args)
void _addCastDescendants_(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
Recursively adds cast descendant from start to end in this Class<GUM_SCALAR>.
PRMClass(const PRMClass< GUM_SCALAR > &&source)=delete
Move constructor.
const Set< PRMSlotChain< GUM_SCALAR > *> & slotChains() const
Returns the set of PRMSlotChain<GUM_SCALAR> of this Class<GUM_SCALAR>.
PRMClassElement< GUM_SCALAR > & operator[](NodeId id)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).
bool isCastDescendant(const std::string &safe_name) const
Return true if the attribute named safe_name is a cast descendant.
PRMClass(const PRMClass< GUM_SCALAR > &source)=delete
Copy constructor.
void completeInheritance(const std::string &attr)
PRMClass(const std::string &name, PRMClass< GUM_SCALAR > &super, const Set< PRMInterface< GUM_SCALAR > * > &set, bool delayInheritance=false)
Constructor for building a subclass of super and implementing each interface in set.
const Set< PRMClass< GUM_SCALAR > *> & extensions() const
Returns the set of Class<GUM_SCALAR> which are direct sub-Class<GUM_SCALAR> of this Class<GUM_SCALAR>...
void _checkInterfaces_(PRMClassElement< GUM_SCALAR > *elt)
Check that a given element respects all the class interfaces.
void _overloadParameter_(PRMParameter< GUM_SCALAR > *overloader, PRMParameter< GUM_SCALAR > *overloaded)
Overloads a parameter.
const PRMClassElement< GUM_SCALAR > & operator[](const std::string &name) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).
void _implementInterfaces_(bool delayInheritance)
Proceed with the implementation of interfaces.
bool _checkOverloadLegality_(const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
Return true of overloaded can be overload by overloader.
void _addIOInterfaceFlags_(PRMClassElement< GUM_SCALAR > *elt)
Check if elt is present in an implementation. If it is, its IO flags are updated. ...
void _addExtension_(PRMClass< GUM_SCALAR > *c)
This method is called when a sub-Class<GUM_SCALAR> of this Class<GUM_SCALAR> is created.
void _checkRefInterfaces_(PRMReferenceSlot< GUM_SCALAR > *elt)
Check that a given element respects all the class interfaces.
void initializeInheritance()
Set< PRMInterface< GUM_SCALAR > *> * _implements_
The Set of implemented interface of this.
void updateDescendants_(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>(const PRMClassElement<GUM_SCALAR>&).
PRMClass(const std::string &name)
Default constructor.
PRMClassElement< GUM_SCALAR > & get(NodeId id)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).
virtual void addArc(const std::string &tail, const std::string &head)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::addArc().
Bijection< const DiscreteVariable *, const DiscreteVariable *> * _bijection_
The bijection between variables in super and variables in this The bijection's firsts are attributes ...
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
virtual NodeId overload(PRMClassElement< GUM_SCALAR > *elt)
See gum::prm::overload(PRMClassElement<GUM_SCALAR>*).
const PRMClassElement< GUM_SCALAR > & operator[](NodeId id) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).
virtual bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const
Test if this Class<GUM_SCALAR> is a subclass of cec.
const Set< PRMReferenceSlot< GUM_SCALAR > *> & referenceSlots() const
Returns the set of PRMAggregate of this Class<GUM_SCALAR>.
virtual PRMObject::prm_type obj_type() const
Implementation of pure virtual method of PRMObject.
virtual bool isOutputNode(const PRMClassElement< GUM_SCALAR > &elt) const
Returns true if elt is an output node.
const PRMClassElement< GUM_SCALAR > & get(NodeId id) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(NodeId).
Set< PRMClass< GUM_SCALAR > *> _extensions_
The set of Class<GUM_SCALAR> which are extension of this Class<GUM_SCALAR> (i.e. direct subtypes)...
void _checkInterface_(PRMClassElement< GUM_SCALAR > *elt, PRMInterface< GUM_SCALAR > *i)
Check that a given element respects a specific interface.
void _overloadAggregate_(PRMAggregate< GUM_SCALAR > *overloader, PRMClassElement< GUM_SCALAR > *overloaded)
Overloads an aggregate.
PRMClassElement< GUM_SCALAR > & get(const std::string &name)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
void _overloadReference_(PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
Overloads a reference slot.
void inheritReferenceSlots()
void _overloadAttribute_(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
Overloads an attribute.
PRMClass(const std::string &name, const Set< PRMInterface< GUM_SCALAR > * > &set, bool delayInheritance=false)
Constructor for building a Class<GUM_SCALAR> implementing several each interface in set...
PRMClass< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &source)=delete
Copy operator. Don't use it.
virtual ~PRMClass()
Destructor.
const PRMClass< GUM_SCALAR > & super() const
Returns the super Class<GUM_SCALAR> of this Class<GUM_SCALAR>.
PRMClassElement< GUM_SCALAR > & operator[](const std::string &name)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).
DAG _dag_
The dag representing dependencies between formal attributes and slots.
void findAllSubtypes_(Set< PRMClassElementContainer< GUM_SCALAR > * > &set)
Fills set with all the subtypes of this Class<GUM_SCALAR>.
PRMClass< GUM_SCALAR > * _superClass_
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
PRMClass(const std::string &name, PRMClass< GUM_SCALAR > &super, bool delayInheritance=false)
Constructor for building a subclass of super.