aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
PRMInstance.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4  * info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Headers of gum::prm::PRMInstance<GUM_SCALAR>
25  *
26  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27  */
28 
29 #ifndef GUM_INSTANCE_H
30 #define GUM_INSTANCE_H
31 
32 #include <set>
33 #include <utility>
34 
35 #include <agrum/tools/core/bijection.h>
36 
37 #include <agrum/PRM/elements/PRMClass.h>
38 #include <agrum/PRM/elements/PRMClassElementContainer.h>
39 
40 namespace gum {
41  namespace prm {
42 
43 
44  /**
45  * @class PRMInstance
46  * @headerfile instance.h <agrum/PRM/elements/instance.h>
47  *
48  * @brief An PRMInstance is a Bayesian network fragment defined by a Class
49  * and used in a PRMSystem.
50  *
51  * Before using an PRMInstance for inference YOU MUST call
52  * PRMInstance::instantiateSlotChains() and PRMInstance::instantiate() on
53  * it before, otherwise DiscreteVariable pointers will be inconsistent and
54  * inference will be erroneous. Of course, this must be done once you have
55  * set all reference in the current system.
56  *
57  * @see PRMClass PRM PRMClassElement
58  *
59  * @ingroup prm_group
60  */
61  template < typename GUM_SCALAR >
62  class PRMInstance: public PRMObject {
63  public:
64  // ========================================================================
65  /// @name Constructors & private operators.
66  // ========================================================================
67  /// @{
68 
69  /**
70  * @brief Default constructor of an PRMInstance<GUM_SCALAR>.
71  *
72  * When you create an PRMInstance<GUM_SCALAR> all
73  *gum::prm::PRMAttribute<GUM_SCALAR> in it's type are
74  * added, except for gum::prm::PRMAggregate<GUM_SCALAR> and parameters
75  *which
76  *are
77  * instantiated.
78  *
79  * However neither of their children or parents are updated (i.e.
80  * DiscreteVariable pointers are inconsistent).
81  */
82  PRMInstance< GUM_SCALAR >(const std::string& name,
83  PRMClass< GUM_SCALAR >& type);
84 
85  /// Destructor.
86  virtual ~PRMInstance< GUM_SCALAR >();
87 
88  /// @}
89  // ========================================================================
90  /// @name Getters & setters.
91  // ========================================================================
92  /// @{
93 
94  /**
95  * Returns the PRM type of this object.
96  */
97  virtual prm_type obj_type() const;
98 
99  /**
100  * Returns the type of this instance
101  */
102  PRMClass< GUM_SCALAR >& type();
103 
104  /**
105  * Returns the type of this instance
106  */
107  const PRMClass< GUM_SCALAR >& type() const;
108 
109  /**
110  * Returns true if id matches an PRMAttribute<GUM_SCALAR> in this
111  * PRMInstance<GUM_SCALAR>.
112  */
113  bool exists(NodeId id) const;
114 
115  /**
116  * Returns true if name matches an PRMAttribute<GUM_SCALAR> in this
117  * PRMInstance<GUM_SCALAR>.
118  */
119  bool exists(const std::string& name) const;
120 
121  /**
122  * @brief Getter on an PRMAttribute<GUM_SCALAR> of this
123  *PRMInstance<GUM_SCALAR>.
124  *
125  * Recall that PRMAggregate<GUM_SCALAR> are instantiated as
126  *PRMAttribute<GUM_SCALAR>
127  * when an PRMInstance<GUM_SCALAR> is created. Thus any random variable
128  *contained
129  * in this PRMInstance<GUM_SCALAR> is mapped to an
130  *PRMAttribute<GUM_SCALAR>.
131  *
132  * @param id The PRMAttribute<GUM_SCALAR> id.
133  * @return Returns a constant reference on an PRMAttribute<GUM_SCALAR>.
134  *
135  * @throw NotFound Raised if no PRMAttribute<GUM_SCALAR> matches name.
136  */
138 
139  /**
140  * @brief Given a name returns the related PRMAttribute<GUM_SCALAR>.
141  *
142  * @param name The PRMAttribute<GUM_SCALAR>'s name.
143  * @return Returns a reference over the PRMAttribute<GUM_SCALAR>.
144  *
145  * @throw NotFound Raised if there is no PRMAttribute<GUM_SCALAR> named n.
146  */
147  PRMAttribute< GUM_SCALAR >& get(const std::string& name);
148 
149  /**
150  * @brief Getter on an PRMAttribute<GUM_SCALAR> of this
151  *PRMInstance<GUM_SCALAR>.
152  *
153  * Recall that PRMAggregate<GUM_SCALAR> are instantiated has
154  *PRMAttribute<GUM_SCALAR>
155  * when an PRMInstance<GUM_SCALAR> is created. Thus any random variable
156  *contained
157  * in this PRMInstance<GUM_SCALAR> is mapped to an
158  *PRMAttribute<GUM_SCALAR>.
159  *
160  * @param id The PRMAttribute<GUM_SCALAR> id.
161  * @return Returns a constant reference on an PRMAttribute<GUM_SCALAR>.
162  *
163  * @throw NotFound Raised if no PRMAttribute<GUM_SCALAR> matches name.
164  */
165  const PRMAttribute< GUM_SCALAR >& get(NodeId id) const;
166 
167  /**
168  * @brief Given a name returns the related PRMClassElement.
169  *
170  * @param name The PRMClassElement's name.
171  * @return Returns a constant reference over the PRMClassElement.
172  *
173  * @throw NotFound Raised if there is no PRMClassElement named n.
174  */
175  const PRMAttribute< GUM_SCALAR >& get(const std::string& name) const;
176 
177  /**
178  * Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
179  * @return the number of attributes in this PRMInstance<GUM_SCALAR>.
180  */
181  Size size() const;
182 
183  /// @}
184  // ========================================================================
185  /// @name Instantiation methods.
186  // ========================================================================
187  /// @{
188 
189  /**
190  * @brief Instantiate all nodes which requires it.
191  *
192  * All attributes are now instantiated, which means they have
193  * a different DiscreteVariable pointer. This methods however still
194  * connects attributes of different instance together.
195  *
196  * @warning Be aware that this method will delete a large part of
197  * this instance attribute's CPF. Furthermore, the
198  * instantiated attribute's type will change (but will not be
199  * deleted).
200  */
201  void instantiate();
202 
203  /**
204  * @brief Returns a mapping between DiscreteVariable used in this and the
205  * ones used in this PRMInstance<GUM_SCALAR>'s Class<GUM_SCALAR>.
206  *
207  * MultiDims require distinctive DiscreteVariable pointers, thus
208  * interface attributes are always instantiated to prevent multiple
209  * insertion of the same DiscreteVariable pointer in a MultiDim.
210  *
211  * @return Returns a bijection in which first elements are
212  *DiscreteVariable
213  * in this->type() and the second are in this.
214  */
215  const Bijection< const DiscreteVariable*, const DiscreteVariable* >&
216  bijection() const;
217 
218  /// @}
219  // ========================================================================
220  /// @name Reference handling.
221  // ========================================================================
222  /// @{
223 
224  /**
225  * @brief Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot,
226  *PRMSlotChain<GUM_SCALAR> or
227  * output node.
228  *
229  * Three type of nodes can be associated with an PRMInstance<GUM_SCALAR>.
230  *When an PRMInstance<GUM_SCALAR>
231  * is associated with a PRMReferenceSlot, it represents an arc in the
232  * relational skeleton. For a PRMSlotChain<GUM_SCALAR>, it is a
233  *placeholder
234  *of referenced
235  * PRMClassElement by this PRMInstance<GUM_SCALAR>. Finally, for an output
236  *node
237  *it indicates
238  * that an PRMInstance<GUM_SCALAR> has an PRMClassElement referring it.
239  *
240  * @param id The NodeId of a PRMReferenceSlot of this
241  *PRMInstance<GUM_SCALAR>.
242  * @param instance The instance added as references by id in this
243  *PRMInstance<GUM_SCALAR>.
244  *
245  * @throw WrongClassElement Raised if id is not a valid PRMClassElement.
246  * @throw OutOfUpperBound Raised if no more PRMInstance<GUM_SCALAR> can be
247  *added to id.
248  * @throw PRMTypeError Raised if instance's type isn't compatible with the
249  * reference's type.
250  * @throw NotFound If there is no PRMClassElement given id.
251  */
252  void add(NodeId id, PRMInstance< GUM_SCALAR >& instance);
253 
254  /**
255  * @brief Fast access to the first instance in a PRMReferenceSlot or
256  *PRMSlotChain<GUM_SCALAR>.
257  *
258  * This is equivalent to **(this->getInstance(id).begin()) and should be
259  *use
260  * when dealing with non multiple PRMReferenceSlot or
261  *PRMSlotChain<GUM_SCALAR>.
262  *
263  * @param id The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>
264  *in
265  *this PRMInstance<GUM_SCALAR>.
266  *
267  * @throw NotFound Raised if there is no PRMClassElement given id.
268  * @throw UndefinedElement Raised if no PRMInstance<GUM_SCALAR> are
269  *referenced by id.
270  */
271  const PRMInstance< GUM_SCALAR >& getInstance(NodeId id) const;
272 
273  /**
274  * @brief Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
275  *
276  * @param id The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>
277  *in
278  *this.
279  * @return Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
280  *
281  * @throw NotFound If there is no PRMClassElement given id.
282  */
283  const Set< PRMInstance< GUM_SCALAR >* >& getInstances(NodeId id) const;
284 
285  /**
286  * Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
287  * @param id A NodeId.
288  * @return returns true if is has at least one referring
289  * PRMAttribute<GUM_SCALAR>.
290  */
291  bool hasRefAttr(NodeId id) const;
292 
293  /**
294  * @brief Returns a vector of pairs of refering attributes of id.
295  */
298 
299  /**
300  * @brief Returns a vector of pairs of refering attributes of id.
301  */
302  const std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
303  getRefAttr(NodeId id) const;
304 
305  /// @}
306  // ========================================================================
307  /// @name Iterators
308  // ========================================================================
309  /// @{
310 
311  /// Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this
312  /// PRMInstance<GUM_SCALAR>.
313  typedef
314  typename NodeProperty< PRMAttribute< GUM_SCALAR >* >::iterator iterator;
315 
316  /// Returns an iterator at the begining of the list of
317  /// gum::prm::PRMAttribute<GUM_SCALAR> in
318  /// this PRMInstance<GUM_SCALAR>.
319  iterator begin();
320 
321  /// Returns a reference over the iterator at the end of the list of
322  /// gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
323  const iterator& end();
324 
325  /// Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this
326  /// PRMInstance<GUM_SCALAR>.
327  typedef typename NodeProperty< PRMAttribute< GUM_SCALAR >* >::const_iterator
329 
330  /// Returns an iterator at the beginning of the list of
331  /// gum::prm::PRMAttribute<GUM_SCALAR> in
332  /// this PRMInstance<GUM_SCALAR>.
333  const_iterator begin() const;
334 
335  /// Returns a reference over the iterator at the end of the list of
336  /// gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
337  const const_iterator& end() const;
338 
339  /**
340  * Nested class to iterate over PRMReferenceSlot and
341  * PRMSlotChain<GUM_SCALAR>
342  * instantiations.
343  */
344  class RefIterator {
345  public:
346  explicit RefIterator(Set< PRMInstance< GUM_SCALAR >* >& set);
347 
348  RefIterator(const RefIterator& from);
349 
350  ~RefIterator();
351 
352  RefIterator& operator=(const RefIterator& from);
353 
354  RefIterator& operator++();
355 
356  bool isEnd() const;
357 
358  bool operator!=(const RefIterator& from) const;
359 
360  bool operator==(const RefIterator& from) const;
361 
362  PRMInstance< GUM_SCALAR >& operator*() const;
363  PRMInstance< GUM_SCALAR >* operator->() const;
364 
365  private:
367  typename Set< PRMInstance< GUM_SCALAR >* >::iterator iter__;
368  };
369 
370  /**
371  * Returns an iterator at the beginning of the set of
372  *PRMInstance<GUM_SCALAR>
373  *associated
374  * to a given gum::prm::PRMReferenceSlot or
375  *gum::prm::PRMSlotChain<GUM_SCALAR>.
376  *
377  * @param id A gum::prm::PRMReferenceSlot or
378  *gum::prm::PRMSlotChain<GUM_SCALAR>
379  *in this
380  * PRMInstance<GUM_SCALAR> type.
381  *
382  * @throw NotFound Raised if no gum::prm::PRMClassElement in this
383  *PRMInstance<GUM_SCALAR>
384  * type matches id.
385  * @throw WrongClassElement Raised if id is neither a PRMReferenceSlot or
386  * PRMSlotChain<GUM_SCALAR>.
387  */
388  RefIterator begin(NodeId id);
389 
390  /**
391  * Nested class to iterate over PRMReferenceSlot and
392  * PRMSlotChain<GUM_SCALAR>
393  * instantiations.
394  */
396  public:
397  explicit RefConstIterator(const Set< PRMInstance< GUM_SCALAR >* >& set);
398 
399  RefConstIterator(const RefConstIterator& from);
400 
401  ~RefConstIterator();
402 
404 
406 
407  bool isEnd() const;
408 
409  bool operator!=(const RefConstIterator& from) const;
410 
411  bool operator==(const RefConstIterator& from) const;
412 
413  const PRMInstance< GUM_SCALAR >& operator*() const;
414  const PRMInstance< GUM_SCALAR >* operator->() const;
415 
416  private:
419  };
420 
421  /**
422  * Returns an iterator at the beginning of the set of
423  *PRMInstance<GUM_SCALAR>
424  *associated
425  * to a given gum::prm::PRMReferenceSlot or
426  *gum::prm::PRMSlotChain<GUM_SCALAR>.
427  *
428  * @param id A gum::prm::PRMReferenceSlot or
429  *gum::prm::PRMSlotChain<GUM_SCALAR>
430  *in this
431  * PRMInstance<GUM_SCALAR> type.
432  *
433  * @throw NotFound Raised if no gum::prm::PRMClassElement in this
434  *PRMInstance<GUM_SCALAR>
435  * type matches id.
436  * @throw WrongClassElement Raised if id is neither a PRMReferenceSlot or
437  * PRMSlotChain<GUM_SCALAR>.
438  */
439  RefConstIterator begin(NodeId id) const;
440 
441  typedef typename NodeProperty< std::vector<
444  typedef typename NodeProperty< std::vector<
447 
449  const InvRefIterator& endInvRef();
450 
452  const InvRefConstIterator& endInvRef() const;
453 
454  /// @}
455  private:
456  /// Copy constructor.
457  PRMInstance(const PRMInstance< GUM_SCALAR >& source);
458 
459  /// Copy operator. Don't use it.
460  PRMInstance< GUM_SCALAR >& operator=(const PRMClass< GUM_SCALAR >& from);
461 
462  // ========================================================================
463  /// @name Private instantiation methods.
464  // ========================================================================
465  /// @{
466 
467  /// Used at construction to instantiate aggregates.
468  void copyAggregates__(PRMAggregate< GUM_SCALAR >* source);
469 
470  /// Used at construction to instantiate attributes.
471  /// @param source An attribute in type__.
472  void copyAttribute__(PRMAttribute< GUM_SCALAR >* source);
473 
474  /**
475  * @brief Starts this instance instantiations.
476  */
477  void doInstantiate__();
478 
479  /// @brief Retrieve all instances referred by sc.
480  /// @param sc A slot chain of this instance's type.
481  /// @throw NotFound Raised if a reference in sc is not instantiated.
482  void instantiateSlotChain__(PRMSlotChain< GUM_SCALAR >* sc);
483 
484  /// @brief Copy the content of an PRMAttribute<GUM_SCALAR> from its
485  /// Class<GUM_SCALAR> counterpart.
486  /// @param attr An PRMAttribute<GUM_SCALAR> of this
487  /// PRMInstance<GUM_SCALAR>.
488  /// @throw OperationNotAllowed If the MultiDimImplementation is of an
489  /// unknown type.
490  void copyAttributeCPF__(PRMAttribute< GUM_SCALAR >* attr);
491 
492  /// @brief Add this as a referring instance over the attribute pointed by
493  /// sc in i.
494  /// @param sc A slot chain pointing over an attribute in i.
495  /// @param i An instance holding an attribute pointed by sc.
496  void addReferingInstance__(PRMSlotChain< GUM_SCALAR >* sc,
497  PRMInstance< GUM_SCALAR >* i);
498 
499  /// @}
500  // ========================================================================
501  /// @name Private members.
502  // ========================================================================
503  /// @{
504 
505  /// True if this instance has been instantiated
507 
508  /// The type of this PRMInstance<GUM_SCALAR>.
510 
511  /// The gum::prm::PRMAttribute<GUM_SCALAR> and
512  /// gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
514 
515  /// Mapping between the gum::prm::PRMReferenceSlot and
516  /// gum::prm::PRMSlotChain<GUM_SCALAR> in
517  /// type__ / and the PRMInstance<GUM_SCALAR> associated with it.
519 
520  /// Code alias.
522 
523  /// The set of pair (instance, attribute) referring an attribute of
524  /// this instance.
526 
527  /// A bijection used for MultiDim handling.
529 
530  /// @}
531  };
532 
533 
534 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
535  extern template class PRMInstance< double >;
536 #endif
537 
538 
539  } /* namespace prm */
540 } /* namespace gum */
541 
542 #include <agrum/PRM/elements/PRMInstance_tpl.h>
543 
544 #endif /* GUM_INSTANCE_H */
const PRMInstance< GUM_SCALAR > & operator*() const
void copyAggregates__(PRMAggregate< GUM_SCALAR > *source)
Used at construction to instantiate aggregates.
NodeProperty< std::vector< pair > *> referingAttr__
The set of pair (instance, attribute) referring an attribute of this instance.
Definition: PRMInstance.h:525
RefConstIterator begin(NodeId id) const
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum:...
const PRMInstance< GUM_SCALAR > & getInstance(NodeId id) const
Fast access to the first instance in a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>.
RefConstIterator(const Set< PRMInstance< GUM_SCALAR > * > &set)
void doInstantiate__()
Starts this instance instantiations.
const InvRefConstIterator & endInvRef() const
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
void add(NodeId id, PRMInstance< GUM_SCALAR > &instance)
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node...
PRMAttribute< GUM_SCALAR > & get(NodeId id)
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
const_iterator begin() const
Returns an iterator at the beginning of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMIns...
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669
void instantiate()
Instantiate all nodes which requires it.
bool operator==(const RefIterator &from) const
void instantiateSlotChain__(PRMSlotChain< GUM_SCALAR > *sc)
Retrieve all instances referred by sc.
const PRMClass< GUM_SCALAR > & type() const
Returns the type of this instance.
PRMClass< GUM_SCALAR > & type()
Returns the type of this instance.
std::pair< PRMInstance< GUM_SCALAR > *, std::string > pair
Code alias.
Definition: PRMInstance.h:521
PRMInstance< GUM_SCALAR > * operator->() const
bool exists(NodeId id) const
Returns true if id matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
const const_iterator & end() const
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in...
PRMInstance(const PRMInstance< GUM_SCALAR > &source)
Copy constructor.
const PRMAttribute< GUM_SCALAR > & get(NodeId id) const
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
Size size() const
Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
RefIterator(Set< PRMInstance< GUM_SCALAR > * > &set)
InvRefIterator beginInvRef()
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & getRefAttr(NodeId id)
Returns a vector of pairs of refering attributes of id.
PRMInstance< GUM_SCALAR > & operator*() const
Set< PRMInstance< GUM_SCALAR > *> & set__
Definition: PRMInstance.h:366
void copyAttributeCPF__(PRMAttribute< GUM_SCALAR > *attr)
Copy the content of an PRMAttribute<GUM_SCALAR> from its Class<GUM_SCALAR> counterpart.
RefConstIterator(const RefConstIterator &from)
bool operator==(const RefConstIterator &from) const
bool exists(const std::string &name) const
Returns true if name matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
const Set< PRMInstance< GUM_SCALAR > *> & set__
Definition: PRMInstance.h:417
const Bijection< const DiscreteVariable *, const DiscreteVariable *> & bijection() const
Returns a mapping between DiscreteVariable used in this and the ones used in this PRMInstance<GUM_SCA...
PRMInstance< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &from)
Copy operator. Don&#39;t use it.
bool instantiated__
True if this instance has been instantiated.
Definition: PRMInstance.h:506
InvRefConstIterator beginInvRef() const
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
ParamScopeData(const std::string &s, const PRMReferenceSlot< GUM_SCALAR > &ref, Idx d)
const std::vector< std::pair< PRMInstance< GUM_SCALAR > *, std::string > > & getRefAttr(NodeId id) const
Returns a vector of pairs of refering attributes of id.
virtual prm_type obj_type() const
Returns the PRM type of this object.
Set< PRMInstance< GUM_SCALAR > *>::iterator iter__
Definition: PRMInstance.h:367
RefIterator(const RefIterator &from)
bool operator!=(const RefConstIterator &from) const
RefIterator begin(NodeId id)
Returns an iterator at the beginning of the set of PRMInstance<GUM_SCALAR> associated to a given gum:...
const PRMAttribute< GUM_SCALAR > & get(const std::string &name) const
Given a name returns the related PRMClassElement.
Bijection< const DiscreteVariable *, const DiscreteVariable *> bijection__
A bijection used for MultiDim handling.
Definition: PRMInstance.h:528
const iterator & end()
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in...
Set< PRMInstance< GUM_SCALAR > *>::const_iterator iter__
Definition: PRMInstance.h:418
PRMClass< GUM_SCALAR > * type__
The type of this PRMInstance<GUM_SCALAR>.
Definition: PRMInstance.h:509
void addReferingInstance__(PRMSlotChain< GUM_SCALAR > *sc, PRMInstance< GUM_SCALAR > *i)
Add this as a referring instance over the attribute pointed by sc in i.
bool hasRefAttr(NodeId id) const
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
const PRMInstance< GUM_SCALAR > * operator->() const
void copyAttribute__(PRMAttribute< GUM_SCALAR > *source)
Used at construction to instantiate attributes.
RefConstIterator & operator=(const RefConstIterator &from)
RefIterator & operator=(const RefIterator &from)
iterator begin()
Returns an iterator at the begining of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInst...
const InvRefIterator & endInvRef()
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
PRMAttribute< GUM_SCALAR > & get(const std::string &name)
Given a name returns the related PRMAttribute<GUM_SCALAR>.
bool operator!=(const RefIterator &from) const
const Set< PRMInstance< GUM_SCALAR > *> & getInstances(NodeId id) const
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.