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);
155 virtual bool isOutputNode(
const PRMClassElement< GUM_SCALAR >& elt)
const;
186 virtual void addArc(
const std::string& tail,
const std::string& head);
256 isSubTypeOf(
const PRMClassElementContainer< GUM_SCALAR >& cec)
const;
317 virtual const DAG&
dag_()
const;
378 PRMAttribute< GUM_SCALAR >* end);
445 const PRMClassElement< GUM_SCALAR >* overloader);
449 PRMAttribute< GUM_SCALAR >* overloaded);
453 PRMClassElement< GUM_SCALAR >* overloaded);
457 PRMReferenceSlot< GUM_SCALAR >* overloaded);
461 PRMParameter< GUM_SCALAR >* overloaded);
467 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS 468 extern template class PRMClass<
double >;
476 #include <agrum/PRM/elements/PRMClass_tpl.h> void checkInterface__(PRMClassElement< GUM_SCALAR > *elt, PRMInterface< GUM_SCALAR > *i)
Check that a given element respects a specific interface.
virtual NodeId add(PRMClassElement< GUM_SCALAR > *elt)
See gum::prm::add(PRMClassElement<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.
void addIOInterfaceFlags__(PRMClassElement< GUM_SCALAR > *elt)
Check if elt is present in an implementation. If it is, its IO flags are updated. ...
void overloadParameter__(PRMParameter< GUM_SCALAR > *overloader, PRMParameter< GUM_SCALAR > *overloaded)
Overloads a parameter.
virtual const DAG & dag_() const
returns a constant reference over this interface's dag.
PRMClass< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &&source)=delete
Move operator. Don't use it.
void checkRefInterface__(PRMReferenceSlot< GUM_SCALAR > *elt, PRMInterface< GUM_SCALAR > *i)
Check that a given element respects a specific interface.
INLINE void emplace(Args &&... args)
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)
bool checkOverloadLegality__(const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
Return true of overloaded can be overload by overloader.
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.
DAG dag__
The dag representing dependencies between formal attributes and slots.
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 addCastDescendants__(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
Recursively adds cast descendant from start to end in this Class<GUM_SCALAR>.
void inheritClass__(const PRMClass< GUM_SCALAR > &c)
Proceed with the copy when this inherits c.
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.
void checkRefInterfaces__(PRMReferenceSlot< GUM_SCALAR > *elt)
Check that a given element respects all the class interfaces.
void initializeInheritance()
void overloadReference__(PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
Overloads a reference slot.
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().
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>*).
void addExtension__(PRMClass< GUM_SCALAR > *c)
This method is called when a sub-Class<GUM_SCALAR> of this Class<GUM_SCALAR> is created.
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).
void addCastDescendants__(PRMClassElement< GUM_SCALAR > *attr)
Recursively adds cast descendant of attr in this Class<GUM_SCALAR>.
PRMClassElement< GUM_SCALAR > & get(const std::string &name)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
void inheritReferenceSlots()
Bijection< const DiscreteVariable *, const DiscreteVariable *> * bijection__
The bijection between variables in super and variables in this The bijection's firsts are attributes ...
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>.
void overloadAggregate__(PRMAggregate< GUM_SCALAR > *overloader, PRMClassElement< GUM_SCALAR > *overloaded)
Overloads an aggregate.
PRMClassElement< GUM_SCALAR > & operator[](const std::string &name)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](const std::string&).
void findAllSubtypes_(Set< PRMClassElementContainer< GUM_SCALAR > * > &set)
Fills set with all the subtypes of this Class<GUM_SCALAR>.
Set< PRMClass< GUM_SCALAR > *> extensions__
The set of Class<GUM_SCALAR> which are extension of this Class<GUM_SCALAR> (i.e. direct subtypes)...
void overloadAttribute__(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
Overloads an attribute.
Set< PRMInterface< GUM_SCALAR > *> * implements__
The Set of implemented interface of this.
PRMClass(const std::string &name, PRMClass< GUM_SCALAR > &super, bool delayInheritance=false)
Constructor for building a subclass of super.
PRMClass< GUM_SCALAR > * superClass__
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...