aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
PRMInstance.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by 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, PRMClass< GUM_SCALAR >& type);
83 
84  /// Destructor.
85  virtual ~PRMInstance< GUM_SCALAR >();
86 
87  /// @}
88  // ========================================================================
89  /// @name Getters & setters.
90  // ========================================================================
91  /// @{
92 
93  /**
94  * Returns the PRM type of this object.
95  */
96  virtual prm_type obj_type() const;
97 
98  /**
99  * Returns the type of this instance
100  */
101  PRMClass< GUM_SCALAR >& type();
102 
103  /**
104  * Returns the type of this instance
105  */
106  const PRMClass< GUM_SCALAR >& type() const;
107 
108  /**
109  * Returns true if id matches an PRMAttribute<GUM_SCALAR> in this
110  * PRMInstance<GUM_SCALAR>.
111  */
112  bool exists(NodeId id) const;
113 
114  /**
115  * Returns true if name matches an PRMAttribute<GUM_SCALAR> in this
116  * PRMInstance<GUM_SCALAR>.
117  */
118  bool exists(const std::string& name) const;
119 
120  /**
121  * @brief Getter on an PRMAttribute<GUM_SCALAR> of this
122  *PRMInstance<GUM_SCALAR>.
123  *
124  * Recall that PRMAggregate<GUM_SCALAR> are instantiated as
125  *PRMAttribute<GUM_SCALAR>
126  * when an PRMInstance<GUM_SCALAR> is created. Thus any random variable
127  *contained
128  * in this PRMInstance<GUM_SCALAR> is mapped to an
129  *PRMAttribute<GUM_SCALAR>.
130  *
131  * @param id The PRMAttribute<GUM_SCALAR> id.
132  * @return Returns a constant reference on an PRMAttribute<GUM_SCALAR>.
133  *
134  * @throw NotFound Raised if no PRMAttribute<GUM_SCALAR> matches name.
135  */
137 
138  /**
139  * @brief Given a name returns the related PRMAttribute<GUM_SCALAR>.
140  *
141  * @param name The PRMAttribute<GUM_SCALAR>'s name.
142  * @return Returns a reference over the PRMAttribute<GUM_SCALAR>.
143  *
144  * @throw NotFound Raised if there is no PRMAttribute<GUM_SCALAR> named n.
145  */
146  PRMAttribute< GUM_SCALAR >& get(const std::string& name);
147 
148  /**
149  * @brief Getter on an PRMAttribute<GUM_SCALAR> of this
150  *PRMInstance<GUM_SCALAR>.
151  *
152  * Recall that PRMAggregate<GUM_SCALAR> are instantiated has
153  *PRMAttribute<GUM_SCALAR>
154  * when an PRMInstance<GUM_SCALAR> is created. Thus any random variable
155  *contained
156  * in this PRMInstance<GUM_SCALAR> is mapped to an
157  *PRMAttribute<GUM_SCALAR>.
158  *
159  * @param id The PRMAttribute<GUM_SCALAR> id.
160  * @return Returns a constant reference on an PRMAttribute<GUM_SCALAR>.
161  *
162  * @throw NotFound Raised if no PRMAttribute<GUM_SCALAR> matches name.
163  */
164  const PRMAttribute< GUM_SCALAR >& get(NodeId id) const;
165 
166  /**
167  * @brief Given a name returns the related PRMClassElement.
168  *
169  * @param name The PRMClassElement's name.
170  * @return Returns a constant reference over the PRMClassElement.
171  *
172  * @throw NotFound Raised if there is no PRMClassElement named n.
173  */
174  const PRMAttribute< GUM_SCALAR >& get(const std::string& name) const;
175 
176  /**
177  * Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
178  * @return the number of attributes in this PRMInstance<GUM_SCALAR>.
179  */
180  Size size() const;
181 
182  /// @}
183  // ========================================================================
184  /// @name Instantiation methods.
185  // ========================================================================
186  /// @{
187 
188  /**
189  * @brief Instantiate all nodes which requires it.
190  *
191  * All attributes are now instantiated, which means they have
192  * a different DiscreteVariable pointer. This methods however still
193  * connects attributes of different instance together.
194  *
195  * @warning Be aware that this method will delete a large part of
196  * this instance attribute's CPF. Furthermore, the
197  * instantiated attribute's type will change (but will not be
198  * deleted).
199  */
200  void instantiate();
201 
202  /**
203  * @brief Returns a mapping between DiscreteVariable used in this and the
204  * ones used in this PRMInstance<GUM_SCALAR>'s Class<GUM_SCALAR>.
205  *
206  * MultiDims require distinctive DiscreteVariable pointers, thus
207  * interface attributes are always instantiated to prevent multiple
208  * insertion of the same DiscreteVariable pointer in a MultiDim.
209  *
210  * @return Returns a bijection in which first elements are
211  *DiscreteVariable
212  * in this->type() and the second are in this.
213  */
214  const Bijection< const DiscreteVariable*, const DiscreteVariable* >& bijection() const;
215 
216  /// @}
217  // ========================================================================
218  /// @name Reference handling.
219  // ========================================================================
220  /// @{
221 
222  /**
223  * @brief Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot,
224  *PRMSlotChain<GUM_SCALAR> or
225  * output node.
226  *
227  * Three type of nodes can be associated with an PRMInstance<GUM_SCALAR>.
228  *When an PRMInstance<GUM_SCALAR>
229  * is associated with a PRMReferenceSlot, it represents an arc in the
230  * relational skeleton. For a PRMSlotChain<GUM_SCALAR>, it is a
231  *placeholder
232  *of referenced
233  * PRMClassElement by this PRMInstance<GUM_SCALAR>. Finally, for an output
234  *node
235  *it indicates
236  * that an PRMInstance<GUM_SCALAR> has an PRMClassElement referring it.
237  *
238  * @param id The NodeId of a PRMReferenceSlot of this
239  *PRMInstance<GUM_SCALAR>.
240  * @param instance The instance added as references by id in this
241  *PRMInstance<GUM_SCALAR>.
242  *
243  * @throw WrongClassElement Raised if id is not a valid PRMClassElement.
244  * @throw OutOfUpperBound Raised if no more PRMInstance<GUM_SCALAR> can be
245  *added to id.
246  * @throw PRMTypeError Raised if instance's type isn't compatible with the
247  * reference's type.
248  * @throw NotFound If there is no PRMClassElement given id.
249  */
250  void add(NodeId id, PRMInstance< GUM_SCALAR >& instance);
251 
252  /**
253  * @brief Fast access to the first instance in a PRMReferenceSlot or
254  *PRMSlotChain<GUM_SCALAR>.
255  *
256  * This is equivalent to **(this->getInstance(id).begin()) and should be
257  *use
258  * when dealing with non multiple PRMReferenceSlot or
259  *PRMSlotChain<GUM_SCALAR>.
260  *
261  * @param id The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>
262  *in
263  *this PRMInstance<GUM_SCALAR>.
264  *
265  * @throw NotFound Raised if there is no PRMClassElement given id.
266  * @throw UndefinedElement Raised if no PRMInstance<GUM_SCALAR> are
267  *referenced by id.
268  */
269  const PRMInstance< GUM_SCALAR >& getInstance(NodeId id) const;
270 
271  /**
272  * @brief Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
273  *
274  * @param id The NodeId of a PRMReferenceSlot or PRMSlotChain<GUM_SCALAR>
275  *in
276  *this.
277  * @return Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
278  *
279  * @throw NotFound If there is no PRMClassElement given id.
280  */
281  const Set< PRMInstance< GUM_SCALAR >* >& getInstances(NodeId id) const;
282 
283  /**
284  * Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
285  * @param id A NodeId.
286  * @return returns true if is has at least one referring
287  * PRMAttribute<GUM_SCALAR>.
288  */
289  bool hasRefAttr(NodeId id) const;
290 
291  /**
292  * @brief Returns a vector of pairs of refering attributes of id.
293  */
295 
296  /**
297  * @brief Returns a vector of pairs of refering attributes of id.
298  */
299  const std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
300  getRefAttr(NodeId id) const;
301 
302  /// @}
303  // ========================================================================
304  /// @name Iterators
305  // ========================================================================
306  /// @{
307 
308  /// Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this
309  /// PRMInstance<GUM_SCALAR>.
310  typedef typename NodeProperty< PRMAttribute< GUM_SCALAR >* >::iterator iterator;
311 
312  /// Returns an iterator at the begining of the list of
313  /// gum::prm::PRMAttribute<GUM_SCALAR> in
314  /// this PRMInstance<GUM_SCALAR>.
315  iterator begin();
316 
317  /// Returns a reference over the iterator at the end of the list of
318  /// gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
319  const iterator& end();
320 
321  /// Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this
322  /// PRMInstance<GUM_SCALAR>.
324 
325  /// Returns an iterator at the beginning of the list of
326  /// gum::prm::PRMAttribute<GUM_SCALAR> in
327  /// this PRMInstance<GUM_SCALAR>.
328  const_iterator begin() const;
329 
330  /// Returns a reference over the iterator at the end of the list of
331  /// gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
332  const const_iterator& end() const;
333 
334  /**
335  * Nested class to iterate over PRMReferenceSlot and
336  * PRMSlotChain<GUM_SCALAR>
337  * instantiations.
338  */
339  class RefIterator {
340  public:
341  explicit RefIterator(Set< PRMInstance< GUM_SCALAR >* >& set);
342 
343  RefIterator(const RefIterator& from);
344 
345  ~RefIterator();
346 
347  RefIterator& operator=(const RefIterator& from);
348 
349  RefIterator& operator++();
350 
351  bool isEnd() const;
352 
353  bool operator!=(const RefIterator& from) const;
354 
355  bool operator==(const RefIterator& from) const;
356 
357  PRMInstance< GUM_SCALAR >& operator*() const;
358  PRMInstance< GUM_SCALAR >* operator->() const;
359 
360  private:
362  typename Set< PRMInstance< GUM_SCALAR >* >::iterator _iter_;
363  };
364 
365  /**
366  * Returns an iterator at the beginning of the set of
367  *PRMInstance<GUM_SCALAR>
368  *associated
369  * to a given gum::prm::PRMReferenceSlot or
370  *gum::prm::PRMSlotChain<GUM_SCALAR>.
371  *
372  * @param id A gum::prm::PRMReferenceSlot or
373  *gum::prm::PRMSlotChain<GUM_SCALAR>
374  *in this
375  * PRMInstance<GUM_SCALAR> type.
376  *
377  * @throw NotFound Raised if no gum::prm::PRMClassElement in this
378  *PRMInstance<GUM_SCALAR>
379  * type matches id.
380  * @throw WrongClassElement Raised if id is neither a PRMReferenceSlot or
381  * PRMSlotChain<GUM_SCALAR>.
382  */
383  RefIterator begin(NodeId id);
384 
385  /**
386  * Nested class to iterate over PRMReferenceSlot and
387  * PRMSlotChain<GUM_SCALAR>
388  * instantiations.
389  */
391  public:
392  explicit RefConstIterator(const Set< PRMInstance< GUM_SCALAR >* >& set);
393 
394  RefConstIterator(const RefConstIterator& from);
395 
396  ~RefConstIterator();
397 
399 
401 
402  bool isEnd() const;
403 
404  bool operator!=(const RefConstIterator& from) const;
405 
406  bool operator==(const RefConstIterator& from) const;
407 
408  const PRMInstance< GUM_SCALAR >& operator*() const;
409  const PRMInstance< GUM_SCALAR >* operator->() const;
410 
411  private:
414  };
415 
416  /**
417  * Returns an iterator at the beginning of the set of
418  *PRMInstance<GUM_SCALAR>
419  *associated
420  * to a given gum::prm::PRMReferenceSlot or
421  *gum::prm::PRMSlotChain<GUM_SCALAR>.
422  *
423  * @param id A gum::prm::PRMReferenceSlot or
424  *gum::prm::PRMSlotChain<GUM_SCALAR>
425  *in this
426  * PRMInstance<GUM_SCALAR> type.
427  *
428  * @throw NotFound Raised if no gum::prm::PRMClassElement in this
429  *PRMInstance<GUM_SCALAR>
430  * type matches id.
431  * @throw WrongClassElement Raised if id is neither a PRMReferenceSlot or
432  * PRMSlotChain<GUM_SCALAR>.
433  */
434  RefConstIterator begin(NodeId id) const;
435 
436  typedef typename NodeProperty<
439  typedef typename NodeProperty<
442 
444  const InvRefIterator& endInvRef();
445 
447  const InvRefConstIterator& endInvRef() const;
448 
449  /// @}
450  private:
451  /// Copy constructor.
452  PRMInstance(const PRMInstance< GUM_SCALAR >& source);
453 
454  /// Copy operator. Don't use it.
455  PRMInstance< GUM_SCALAR >& operator=(const PRMClass< GUM_SCALAR >& from);
456 
457  // ========================================================================
458  /// @name Private instantiation methods.
459  // ========================================================================
460  /// @{
461 
462  /// Used at construction to instantiate aggregates.
463  void _copyAggregates_(PRMAggregate< GUM_SCALAR >* source);
464 
465  /// Used at construction to instantiate attributes.
466  /// @param source An attribute in _type_.
467  void _copyAttribute_(PRMAttribute< GUM_SCALAR >* source);
468 
469  /**
470  * @brief Starts this instance instantiations.
471  */
472  void _doInstantiate_();
473 
474  /// @brief Retrieve all instances referred by sc.
475  /// @param sc A slot chain of this instance's type.
476  /// @throw NotFound Raised if a reference in sc is not instantiated.
477  void _instantiateSlotChain_(PRMSlotChain< GUM_SCALAR >* sc);
478 
479  /// @brief Copy the content of an PRMAttribute<GUM_SCALAR> from its
480  /// Class<GUM_SCALAR> counterpart.
481  /// @param attr An PRMAttribute<GUM_SCALAR> of this
482  /// PRMInstance<GUM_SCALAR>.
483  /// @throw OperationNotAllowed If the MultiDimImplementation is of an
484  /// unknown type.
485  void _copyAttributeCPF_(PRMAttribute< GUM_SCALAR >* attr);
486 
487  /// @brief Add this as a referring instance over the attribute pointed by
488  /// sc in i.
489  /// @param sc A slot chain pointing over an attribute in i.
490  /// @param i An instance holding an attribute pointed by sc.
491  void _addReferingInstance_(PRMSlotChain< GUM_SCALAR >* sc, PRMInstance< GUM_SCALAR >* i);
492 
493  /// @}
494  // ========================================================================
495  /// @name Private members.
496  // ========================================================================
497  /// @{
498 
499  /// True if this instance has been instantiated
501 
502  /// The type of this PRMInstance<GUM_SCALAR>.
504 
505  /// The gum::prm::PRMAttribute<GUM_SCALAR> and
506  /// gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
508 
509  /// Mapping between the gum::prm::PRMReferenceSlot and
510  /// gum::prm::PRMSlotChain<GUM_SCALAR> in
511  /// _type_ / and the PRMInstance<GUM_SCALAR> associated with it.
513 
514  /// Code alias.
516 
517  /// The set of pair (instance, attribute) referring an attribute of
518  /// this instance.
520 
521  /// A bijection used for MultiDim handling.
523 
524  /// @}
525  };
526 
527 
528 #ifndef GUM_NO_EXTERN_TEMPLATE_CLASS
529  extern template class PRMInstance< double >;
530 #endif
531 
532 
533  } /* namespace prm */
534 } /* namespace gum */
535 
536 #include <agrum/PRM/elements/PRMInstance_tpl.h>
537 
538 #endif /* GUM_INSTANCE_H */
const PRMInstance< GUM_SCALAR > & operator*() const
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)
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>.
void _doInstantiate_()
Starts this instance instantiations.
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:643
void instantiate()
Instantiate all nodes which requires it.
bool operator==(const RefIterator &from) const
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:515
PRMInstance< GUM_SCALAR > * operator->() const
PRMClass< GUM_SCALAR > * _type_
The type of this PRMInstance<GUM_SCALAR>.
Definition: PRMInstance.h:503
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...
bool _instantiated_
True if this instance has been instantiated.
Definition: PRMInstance.h:500
void _copyAttributeCPF_(PRMAttribute< GUM_SCALAR > *attr)
Copy the content of an PRMAttribute<GUM_SCALAR> from its Class<GUM_SCALAR> counterpart.
void _instantiateSlotChain_(PRMSlotChain< GUM_SCALAR > *sc)
Retrieve all instances referred by sc.
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
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 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.
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.
RefIterator(const RefIterator &from)
Set< PRMInstance< GUM_SCALAR > *>::const_iterator _iter_
Definition: PRMInstance.h:413
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:522
const iterator & end()
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in...
void _copyAttribute_(PRMAttribute< GUM_SCALAR > *source)
Used at construction to instantiate attributes.
bool hasRefAttr(NodeId id) const
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
NodeProperty< std::vector< pair > *> _referingAttr_
The set of pair (instance, attribute) referring an attribute of this instance.
Definition: PRMInstance.h:519
void _addReferingInstance_(PRMSlotChain< GUM_SCALAR > *sc, PRMInstance< GUM_SCALAR > *i)
Add this as a referring instance over the attribute pointed by sc in i.
const PRMInstance< GUM_SCALAR > * operator->() const
Set< PRMInstance< GUM_SCALAR > *> & _set_
Definition: PRMInstance.h:361
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>.
const Set< PRMInstance< GUM_SCALAR > *> & _set_
Definition: PRMInstance.h:412
bool operator!=(const RefIterator &from) const
void _copyAggregates_(PRMAggregate< GUM_SCALAR > *source)
Used at construction to instantiate aggregates.
const Set< PRMInstance< GUM_SCALAR > *> & getInstances(NodeId id) const
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
Set< PRMInstance< GUM_SCALAR > *>::iterator _iter_
Definition: PRMInstance.h:362