aGrUM  0.16.0
PRMInterface.h
Go to the documentation of this file.
1 
30 #ifndef GUM_INTERFACE_H
31 #define GUM_INTERFACE_H
32 
33 #include <set>
34 #include <utility>
35 #include <string>
36 
37 #include <agrum/agrum.h>
38 #include <agrum/core/sequence.h>
39 #include <agrum/core/set.h>
40 
46 
47 
48 namespace gum {
49  namespace prm {
50 
51  template < typename GUM_SCALAR >
52  class PRMClass;
53 
66  template < typename GUM_SCALAR >
67  class PRMInterface : public PRMClassElementContainer< GUM_SCALAR > {
68  // ========================================================================
69  friend class PRMClass< GUM_SCALAR >;
70  // ========================================================================
71  public:
72  // ========================================================================
74  // ========================================================================
76 
81  explicit PRMInterface(const std::string& name);
82 
89  PRMInterface(const std::string& name,
91  bool delayInheritance = false);
92 
95 
97  virtual ~PRMInterface();
98 
100  // ========================================================================
102  // ========================================================================
104 
106  virtual typename PRMObject::prm_type obj_type() const;
107 
109  virtual PRMClassElement< GUM_SCALAR >& get(NodeId id);
110 
112  virtual const PRMClassElement< GUM_SCALAR >& get(NodeId id) const;
113 
123  void addArc(const std::string& tail, const std::string& head);
124 
126  // ========================================================================
128  // ========================================================================
130 
131  virtual bool isOutputNode(const PRMClassElement< GUM_SCALAR >& elt) const;
132 
135  virtual PRMClassElement< GUM_SCALAR >& get(const std::string& name);
136 
139  virtual const PRMClassElement< GUM_SCALAR >&
140  get(const std::string& name) const;
141 
148 
154 
158 
190 
192  // ========================================================================
194  // ========================================================================
196 
222  virtual bool
224 
231 
237  const PRMInterface< GUM_SCALAR >& super() const;
238 
243 
248 
253  void inheritInterface();
254 
256  // ========================================================================
258  // ========================================================================
260 
264 
268 
271  PRMClassElement< GUM_SCALAR >& operator[](const std::string& name);
272 
276  operator[](const std::string& name) const;
277 
279  // ========================================================================
281  // ========================================================================
283 
284  typedef typename NodeProperty< PRMClassElement< GUM_SCALAR >* >::iterator
287  const ClassEltIterator& end();
288 
289  typedef
290  typename NodeProperty< PRMClassElement< GUM_SCALAR >* >::const_iterator
293  const const_ClassEltIterator& end() const;
294 
296  protected:
298  const DAG& _dag() const;
299 
301  DAG& _dag();
302 
307 
311 
312  private:
315  operator=(const PRMInterface< GUM_SCALAR >& source);
316 
319 
320  // ========================================================================
322  // ========================================================================
324 
328 
332 
334  // ========================================================================
336  // ========================================================================
338 
342 
345 
348 
350  // ========================================================================
352  // ========================================================================
354 
360 
363 
368 
371 
376 
377  bool
379  const PRMClassElement< GUM_SCALAR >* overloader);
380 
382  PRMAttribute< GUM_SCALAR >* overloaded);
383 
385  PRMReferenceSlot< GUM_SCALAR >* overloaded);
386 
389 
391  };
392 
393 
394 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
395  extern template class PRMInterface< double >;
396 #endif
397 
398 
399  } /* namespace prm */
400 } // namespace gum
401 
403 
404 #endif /* GUM_INTERFACE_H */
NodeProperty< PRMClassElement< GUM_SCALAR > *>::iterator ClassEltIterator
Definition: PRMInterface.h:285
virtual PRMObject::prm_type obj_type() const
Implementation of pure virtual method of PRMObject.
const Set< PRMAttribute< GUM_SCALAR > *> & attributes() const
Returns the set of PRMAttribute<GUM_SCALAR> of this Class<GUM_SCALAR>.
virtual bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const
Test if this PRMInterface is a sub PRMInterface of cec.
Unsafe Const Iterators for hashtablesHashTableConstIterator provides a fast but unsafe way to parse H...
Definition: hashTable.h:2465
Set< PRMClass< GUM_SCALAR > *> & implementations()
Returns the set of Class<GUM_SCALAR> implementing this PRMInterface.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __addCastDescendants(PRMAttribute< GUM_SCALAR > *start, PRMAttribute< GUM_SCALAR > *end)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
ClassEltIterator begin()
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:35
NodeId add(PRMClassElement< GUM_SCALAR > *elt)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::add(PRMClassElement<GUM_SCALAR>*).
Set< PRMClass< GUM_SCALAR > *> __implementations
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:362
const DAG & _dag() const
Returns a constant reference over this PRMInterface&#39;s DAG.
Unsafe Iterators for hashtablesHashTableIterator provides a fast but unsafe way to parse HashTables...
Definition: hashTable.h:2750
NodeId overload(PRMClassElement< GUM_SCALAR > *elt)
Add a new PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.
Abstract class representing an element of PRM class.
void _findAllSubtypes(Set< PRMClassElementContainer< GUM_SCALAR > * > &set)
Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations...
void _updateDescendants(const PRMClassElement< GUM_SCALAR > &elt)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>(const PRMClassElement<GUM_SCALAR>&).
virtual ~PRMInterface()
Destructor.
Set< PRMInterface< GUM_SCALAR > *> __extensions
The set of Class<GUM_SCALAR> which implements this PRMInterface.
Definition: PRMInterface.h:370
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
A PRMReferenceSlot represent a relation between two PRMClassElementContainer.
Definition: PRMObject.h:223
DAG __dag
The dag representing dependencies between formal attributes and slots.
Definition: PRMInterface.h:327
The class for generic Hash Tables.
Definition: hashTable.h:679
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
void __inheritInterface(const PRMInterface< GUM_SCALAR > &i)
Proceed with the copy of i in this.
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:165
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:69
HashTable< std::string, PRMClassElement< GUM_SCALAR > *> __nameMap
Mapping between a member&#39;s name and itself. Used for fast access to a member given it&#39;s name...
Definition: PRMInterface.h:341
void __addExtension(PRMInterface< GUM_SCALAR > *c)
Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.
virtual bool isOutputNode(const PRMClassElement< GUM_SCALAR > &elt) const
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::get(const std::string&).
void addArc(const std::string &tail, const std::string &head)
An Interfance doesn&#39;t have any arc, this will raise an OperationNotAllowed exception.
void __overloadAttribute(PRMAttribute< GUM_SCALAR > *overloader, PRMAttribute< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
PRMInterface(const std::string &name)
Default constructor.
const Set< PRMReferenceSlot< GUM_SCALAR > *> & referenceSlots() const
Returns the set of PRMAggregate of this Class<GUM_SCALAR>.
An PRMInterface is implemented by a Class<GUM_SCALAR> and defines a set of PRMReferenceSlot<GUM_SCALA...
Definition: PRMClass.h:54
void __overloadReferenceSlot(PRMReferenceSlot< GUM_SCALAR > *overloader, PRMReferenceSlot< GUM_SCALAR > *overloaded)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
PRMInterface< GUM_SCALAR > & super()
Returns the superInterface of this PRMInterface.
void __addImplementation(PRMClass< GUM_SCALAR > *c)
Add an Class<GUM_SCALAR> to the set of Class<GUM_SCALAR> which implements this PRMInterface.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
PRMInterface< GUM_SCALAR > & operator=(const PRMInterface< GUM_SCALAR > &source)
Copy operator. Don&#39;t use it.
void inheritInterface()
Inherits from this interface super interface, this should only be done when this inteface inheritance...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
<agrum/PRM/classElementContainer.h>
Set< PRMAttribute< GUM_SCALAR > *> __attributes
The sequence of PRMAttribute<GUM_SCALAR>s.
Definition: PRMInterface.h:344
A PRMClass is an object of a PRM representing a fragment of a Bayesian Network which can be instantia...
Definition: PRMClass.h:66
bool __checkOverloadLegality(const PRMClassElement< GUM_SCALAR > *overloaded, const PRMClassElement< GUM_SCALAR > *overloader)
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
const ClassEltIterator & end()
PRMInterface< GUM_SCALAR > * __superInterface
The alternate PRMClassElementContainer<GUM_SCALAR> searched for elements defined in this...
Definition: PRMInterface.h:359
Set< PRMReferenceSlot< GUM_SCALAR > *> __referenceSlots
The sequence of PRMReferenceSlot<GUM_SCALAR>.
Definition: PRMInterface.h:347
NodeProperty< PRMClassElement< GUM_SCALAR > *> __nodeIdMap
Mapping between node&#39;s id and their name (being an attribute or a slot). Used for fast access to a me...
Definition: PRMInterface.h:331
PRMAttribute is a member of a Class in a PRM.
Definition: PRMAttribute.h:61
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Base class for dag.
Definition: DAG.h:102
Size NodeId
Type for node ids.
Definition: graphElements.h:98
PRMClassElement< GUM_SCALAR > & operator[](NodeId id)
See gum::prm::PRMClassElementContainer<GUM_SCALAR>::operator[](NodeId).
NodeProperty< PRMClassElement< GUM_SCALAR > *>::const_iterator const_ClassEltIterator
Definition: PRMInterface.h:291
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.