aGrUM  0.16.0
PRMClassElementContainer.h
Go to the documentation of this file.
1 
30 #ifndef GUM_CLASS_ELEMENT_CONTAINER_H
31 #define GUM_CLASS_ELEMENT_CONTAINER_H
32 
33 #include <agrum/core/hashTable.h>
34 #include <agrum/core/set.h>
35 
36 #include <agrum/graphs/DAG.h>
38 
39 #include <agrum/PRM/utils_prm.h>
40 
42 
43 namespace gum {
44  namespace prm {
45 
46  template < typename GUM_SCALAR >
47  class PRMClass;
48  template < typename GUM_SCALAR >
49  class PRMInterface;
50  class PRMClassElementContainterIterator;
51  class PRMClassElementContainterConstIterator;
52 
66  template < typename GUM_SCALAR >
70 
71  public:
72  // ========================================================================
74  // ========================================================================
76 
78  PRMClassElementContainer(const std::string& name);
79 
81  virtual ~PRMClassElementContainer();
82 
84  // ========================================================================
86  // ========================================================================
88 
94  virtual bool belongsTo(const PRMClassElement< GUM_SCALAR >& elt) const;
95 
101  virtual bool exists(const std::string& name) const;
102 
109  virtual PRMClassElement< GUM_SCALAR >& get(const std::string& name) = 0;
110 
117  virtual const PRMClassElement< GUM_SCALAR >&
118  get(const std::string& name) const = 0;
119 
144  virtual NodeId add(PRMClassElement< GUM_SCALAR >* elt) = 0;
145 
181 
185  virtual void addArc(const std::string& tail, const std::string& head) = 0;
186 
198  virtual bool isInputNode(const PRMClassElement< GUM_SCALAR >& elt) const;
199 
219  virtual void setInputNode(const PRMClassElement< GUM_SCALAR >& elt, bool b);
220 
232  virtual bool
233  isOutputNode(const PRMClassElement< GUM_SCALAR >& elt) const = 0;
234 
254  virtual void setOutputNode(const PRMClassElement< GUM_SCALAR >& elt, bool b);
255 
274  virtual bool isInnerNode(const PRMClassElement< GUM_SCALAR >& elt) const;
276  // ========================================================================
278  // ========================================================================
280 
293  virtual const DAG& containerDag() const;
294 
302  virtual bool exists(NodeId id) const;
303 
310  virtual PRMClassElement< GUM_SCALAR >& get(NodeId id) = 0;
311 
318  virtual const PRMClassElement< GUM_SCALAR >& get(NodeId id) const = 0;
319 
321  // ========================================================================
323  // ========================================================================
325 
333 
340  virtual const PRMClassElement< GUM_SCALAR >& operator[](NodeId id) const = 0;
341 
349  operator[](const std::string& name) = 0;
350 
357  virtual const PRMClassElement< GUM_SCALAR >&
358  operator[](const std::string& name) const = 0;
359 
361  // ========================================================================
363  // ========================================================================
365 
373  virtual bool
375 
385  virtual bool
387 
389 
390  protected:
394 
398 
399  virtual const DAG& _dag() const = 0;
400 
403  virtual DAG& _dag() = 0;
404 
408  virtual void
410 
415  virtual std::pair< bool, bool >&
417 
422  virtual const std::pair< bool, bool >&
423  _getIOFlag(const PRMClassElement< GUM_SCALAR >& elt) const;
424 
430  virtual void _setIOFlag(const PRMClassElement< GUM_SCALAR >& elt,
431  const std::pair< bool, bool >& flags);
432 
436 
444  virtual void
446 
447  private:
450  };
451 
452 
453 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
454  extern template class PRMClassElementContainer< double >;
455 #endif
456 
457 
458  } /* namespace prm */
459 
460 } // namespace gum
461 
464 template < typename GUM_SCALAR >
465 std::ostream&
466  operator<<(std::ostream& output,
468 
470 
471 #endif /* GUM_CLASS_ELEMENT_CONTAINER_H */
PRMClassElementContainer< GUM_SCALAR > & operator=(const PRMClassElementContainer< GUM_SCALAR > &source)
Copy operator. Don&#39;t use it.
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
std::ostream & operator<<(std::ostream &out, PRMObject::prm_type obj_type)
For printing PRMType easily.
Definition: PRMObject.cpp:78
PRMClassElementContainer(const std::string &name)
Default constructor.
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
virtual PRMClassElement< GUM_SCALAR > & operator[](NodeId id)=0
Getter on a member of this PRMClassElementContainer.
virtual bool isInnerNode(const PRMClassElement< GUM_SCALAR > &elt) const
Returns true if the node is an inner node.
virtual void setInputNode(const PRMClassElement< GUM_SCALAR > &elt, bool b)
Set the input flag value of id at b.
Abstract class representing an element of PRM class.
virtual bool exists(const std::string &name) const
Returns true if a member with the given name exists in this PRMClassElementContainer or in the PRMCla...
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
The class for generic Hash Tables.
Definition: hashTable.h:679
virtual void _copyIOFlags(const PRMClassElementContainer< GUM_SCALAR > &c)
Copy the IO Flags of c in this PRMClassElementContainer.
virtual bool isSubTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const =0
Test if this PRMClassElementContainer is a subtype of cec.
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:165
HashTable< std::string, std::pair< bool, bool > > __IOFlags
input / output flags, useful when inheriting or copying.
virtual const DAG & _dag() const =0
virtual bool belongsTo(const PRMClassElement< GUM_SCALAR > &elt) const
Returns true if elt belongs to this PRMClassElementContainer.
virtual std::pair< bool, bool > & _getIOFlag(const PRMClassElement< GUM_SCALAR > &elt)
Returns the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual bool isInputNode(const PRMClassElement< GUM_SCALAR > &elt) const
Returns true if the node is an input node.
virtual void _findAllSubtypes(Set< PRMClassElementContainer< GUM_SCALAR > * > &set)=0
Fills set with all the subtypes of this PRMInterface, this includes extensions and implementations...
virtual bool isOutputNode(const PRMClassElement< GUM_SCALAR > &elt) const =0
Returns true if the node is an output node.
virtual bool isSuperTypeOf(const PRMClassElementContainer< GUM_SCALAR > &cec) const
Test if this PRMClassElementContainer is a super type of cec.
virtual NodeId add(PRMClassElement< GUM_SCALAR > *elt)=0
Add a PRMClassElement<GUM_SCALAR> to this PRMClassElementContainer.
Abstract base class for any element defined in a PRM.
Definition: PRMObject.h:56
virtual NodeId overload(PRMClassElement< GUM_SCALAR > *elt)=0
Add a PRMClassElement<GUM_SCALAR> which overload an inherited PRMClassElement<GUM_SCALAR>.
virtual void setOutputNode(const PRMClassElement< GUM_SCALAR > &elt, bool b)
Set the output flag value of id at b.
<agrum/PRM/classElementContainer.h>
virtual void _setIOFlag(const PRMClassElement< GUM_SCALAR > &elt, const std::pair< bool, bool > &flags)
Defines the IO flags of a PRMClassElement<GUM_SCALAR>.
virtual void _updateDescendants(const PRMClassElement< GUM_SCALAR > &elt)=0
When a PRMClassElement<GUM_SCALAR> becomes an Output node we must update any the IO flags of every de...
virtual void addArc(const std::string &tail, const std::string &head)=0
Add an arc between two PRMClassElement<GUM_SCALAR>.
virtual const DAG & containerDag() const
Returns the gum::DAG of this PRMClassElementContainer.
Base class for dag.
Definition: DAG.h:102
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.
Size NodeId
Type for node ids.
Definition: graphElements.h:98
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.