aGrUM  0.14.2
PRMInstance_tpl.h
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
28 
30 
31 namespace gum {
32  namespace prm {
33  template < typename GUM_SCALAR >
34  PRMInstance< GUM_SCALAR >::PRMInstance(const std::string& name,
35  PRMClass< GUM_SCALAR >& type) :
36  PRMObject(name),
37  __instantiated(false), __type(&type) {
38  GUM_CONSTRUCTOR(PRMInstance);
39 
40  // First we create attributes for each aggregate in type
41  for (const auto agg : __type->aggregates())
42  __copyAggregates(agg);
43 
44  // We add attributes in type by reference for inner ones and by copy for
45  // output ones
46  for (const auto attr : __type->attributes())
47  __copyAttribute(attr);
48  }
49 
50  template < typename GUM_SCALAR >
52  GUM_DESTRUCTOR(PRMInstance);
53 
54  for (const auto& elt : __nodeIdMap)
55  delete elt.second;
56 
57  for (const auto& elt : __referenceMap)
58  delete elt.second;
59 
60  for (const auto& elt : __referingAttr)
61  delete elt.second;
62  }
63 
64  template < typename GUM_SCALAR >
66  if (!__instantiated) {
67  __instantiated = true;
69  }
70  }
71 
72  template < typename GUM_SCALAR >
74  // First retrieving any referenced instance
75  for (const auto chain : type().slotChains()) {
77  }
78 
79  // Now we need to add referred instance to each input node
80  // For Attributes we first add parents, then we initialize CPF
81  for (const auto attr : type().attributes()) {
82  __copyAttributeCPF(__nodeIdMap[(*attr).id()]);
83  }
84 
85  // For PRMAggregate<GUM_SCALAR> we add parents
86  for (const auto agg : type().aggregates()) {
87  PRMAttribute< GUM_SCALAR >& attr = get(agg->safeName());
88 
89  for (const auto node : type().containerDag().parents(agg->id())) {
90  try {
91  attr.addParent(get(node));
92  } catch (NotFound&) {
93  auto elt = &(type().get(node));
94  auto sc = static_cast< PRMSlotChain< GUM_SCALAR >* >(elt);
95  const auto& instances = getInstances(sc->id());
96 
97  for (const auto inst : instances) {
98  attr.addParent(inst->get(sc->lastElt().safeName()));
99  }
100  }
101  }
102  }
103  }
104 
105  template < typename GUM_SCALAR >
108  auto first_id = sc->chain()[0]->id();
109  auto set =
110  new Set< PRMInstance< GUM_SCALAR >* >(*(__referenceMap[first_id]));
111  // We proceed with a width-first run of the slot chain
112  for (Size idx = 1; idx < sc->chain().size() - 1; ++idx) {
113  auto temp = new Set< PRMInstance< GUM_SCALAR >* >();
114  for (auto current : *set) {
115  auto& ref = current->type().get(sc->chain()[idx]->name());
116  for (auto next : *(current->__referenceMap[ref.id()])) {
117  temp->insert(next);
118  }
119  }
120  delete set;
121  set = temp;
122  }
123 
124  GUM_ASSERT(set->size() > 0);
125  // set contains all the instances references by sc
126  if (__referenceMap.exists(sc->id())) {
127  delete __referenceMap[sc->id()];
128  __referenceMap[sc->id()] = set;
129  } else {
130  __referenceMap.insert(sc->id(), set);
131  }
132 
133  // Add refering instances
134  for (auto i : *set) {
135  __addReferingInstance(sc, i);
136  }
137 
138  // If sc is not multiple so it can be added as a parent of an attribute
139  if (!sc->isMultiple()) {
140  // We should have only one instance
141  // Less ugly way to get the single instance in set
142  for (auto instance : *set) {
143  auto& attr = instance->get(sc->lastElt().safeName());
144  __bijection.insert(&(sc->type().variable()), &(attr.type().variable()));
145  }
146  }
147  }
148 
149  template < typename GUM_SCALAR >
151  PRMInstance< GUM_SCALAR >& instance) {
153 
154  try {
155  elt = &(type().get(id));
156  } catch (NotFound&) {
157  GUM_ERROR(NotFound, "no ClassElement<GUM_SCALAR> matches the given id");
158  }
159 
160  switch (elt->elt_type()) {
163  static_cast< PRMReferenceSlot< GUM_SCALAR >* >(elt);
164 
165  // Checking if instance's type is legal
166  if (!instance.type().isSubTypeOf(ref->slotType())) {
168  "given Instance type is not a proper "
169  "subclass of the ReferenceSlot<GUM_SCALAR> slot type");
170  }
171 
172  // Checking the reference's size limit
173  if (__referenceMap.exists(id)
174  && (!static_cast< PRMReferenceSlot< GUM_SCALAR >& >(type().get(id))
175  .isArray())
176  && (__referenceMap[id]->size() == 1)) {
178  "ReferenceSlot<GUM_SCALAR> size limit reached");
179  }
180 
181  break;
182  }
183 
186  static_cast< PRMSlotChain< GUM_SCALAR >& >(type().get(id));
187 
188  // Checking if instance's type is legal
189  if (!instance.type().isSubTypeOf(sc.end())) {
191  "given Instance type is not a proper "
192  "subclass of the ClassElementContainer pointed"
193  " by the SlotChain<GUM_SCALAR>");
194  }
195 
196  // Checking the reference's size limit
197  if (__referenceMap.exists(id)
198  && (!static_cast< PRMSlotChain< GUM_SCALAR >& >(type().get(id))
199  .isMultiple())
200  && (__referenceMap[id]->size() == 1)) {
201  GUM_ERROR(OutOfUpperBound, "SlotChain<GUM_SCALAR> size limit reached");
202  }
203 
204  break;
205  }
206 
207  default: {
208  if (!type().isOutputNode(*elt)) {
210  "given ClassElement<GUM_SCALAR> is not an output node");
211  }
212  }
213  }
214 
215  if (!__referenceMap.exists(id)) {
216  __referenceMap.insert(id, new Set< PRMInstance< GUM_SCALAR >* >());
217  }
218 
219  __referenceMap[id]->insert(&instance);
220  }
221 
222  template < typename GUM_SCALAR >
224  return __nodeIdMap.size();
225  }
226 
227  template < typename GUM_SCALAR >
229  PRMAggregate< GUM_SCALAR >* source) {
230  auto attr = new PRMScalarAttribute< GUM_SCALAR >(
231  source->name(), source->type(), source->buildImpl());
232  GUM_ASSERT(&(attr->type().variable()) != &(source->type().variable()));
233  attr->setId(source->id());
234  __nodeIdMap.insert(attr->id(), attr);
235  __bijection.insert(&(source->type().variable()), &(attr->type().variable()));
236  }
237 
238  template < typename GUM_SCALAR >
240  PRMAttribute< GUM_SCALAR >* source) {
241  auto attr =
242  new PRMScalarAttribute< GUM_SCALAR >(source->name(), source->type());
243  GUM_ASSERT(&(attr->type().variable()) != &(source->type().variable()));
244  // The potential is copied when instantiate() is called
245  attr->cpf().fill((GUM_SCALAR)0);
246  attr->setId(source->id());
247  __bijection.insert(&(source->type().variable()), &(attr->type().variable()));
248  __nodeIdMap.insert(attr->id(), attr);
249  }
250 
251  template < typename GUM_SCALAR >
253  const PRMInstance< GUM_SCALAR >& source) :
254  PRMObject(source),
255  __type(source.__type) {
256  GUM_CONS_CPY(PRMInstance);
257  GUM_ERROR(FatalError, "do not copy Instance");
258  }
259 
260  template < typename GUM_SCALAR >
263  GUM_ERROR(FatalError, "do not copy Instance");
264  }
265 
266  template < typename GUM_SCALAR >
269  }
270 
271  template < typename GUM_SCALAR >
273  return *__type;
274  }
275 
276  template < typename GUM_SCALAR >
278  return *__type;
279  }
280 
281  template < typename GUM_SCALAR >
283  return __nodeIdMap.exists(id);
284  }
285 
286  template < typename GUM_SCALAR >
287  INLINE bool PRMInstance< GUM_SCALAR >::exists(const std::string& name) const {
288  return __type->exists(name) && exists(__type->get(name).id());
289  }
290 
291  template < typename GUM_SCALAR >
293  try {
294  return *(__nodeIdMap[id]);
295  } catch (NotFound&) {
296  GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given NodeId");
297  }
298  }
299 
300  template < typename GUM_SCALAR >
301  INLINE const PRMAttribute< GUM_SCALAR >&
303  try {
304  return *(__nodeIdMap[id]);
305  } catch (NotFound&) {
306  GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given NodeId");
307  }
308  }
309 
310  template < typename GUM_SCALAR >
312  PRMInstance< GUM_SCALAR >::get(const std::string& name) {
313  try {
314  return *(__nodeIdMap[type().get(name).id()]);
315  } catch (NotFound&) {
316  GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given name");
317  }
318  }
319 
320  template < typename GUM_SCALAR >
321  INLINE const PRMAttribute< GUM_SCALAR >&
322  PRMInstance< GUM_SCALAR >::get(const std::string& name) const {
323  try {
324  return *(__nodeIdMap[type().get(name).id()]);
325  } catch (NotFound&) {
326  GUM_ERROR(NotFound, "no PRMAttribute<GUM_SCALAR> with the given name");
327  }
328  }
329 
330  template < typename GUM_SCALAR >
333  NodeId id = i->get(sc->lastElt().safeName()).id();
334  std::string name = sc->lastElt().safeName();
335 
336  try {
337  i->__referenceMap[id]->insert(this);
338  i->__referingAttr[id]->push_back(
339  std::make_pair(this, sc->lastElt().safeName()));
340  } catch (NotFound&) {
341  i->__referenceMap.insert(id, new Set< PRMInstance< GUM_SCALAR >* >());
342  i->__referenceMap[id]->insert(this);
343  i->__referingAttr.insert(id, new std::vector< pair >());
344  i->__referingAttr[id]->push_back(
345  std::make_pair(this, sc->lastElt().safeName()));
346  }
347  }
348 
349  template < typename GUM_SCALAR >
352  return __bijection;
353  }
354 
355  template < typename GUM_SCALAR >
356  INLINE const PRMInstance< GUM_SCALAR >&
358  try {
359  if (__referenceMap[id]->size() > 0) {
360  return **(__referenceMap[id]->begin());
361  } else {
363  "no Instance associated with the given NodeId");
364  }
365  } catch (NotFound&) {
367  "no ReferenceSlot<GUM_SCALAR> or SlotChain<GUM_SCALAR> "
368  "matches the given NodeId");
369  }
370  }
371 
372  template < typename GUM_SCALAR >
373  INLINE const Set< PRMInstance< GUM_SCALAR >* >&
375  try {
376  return *(__referenceMap[id]);
377  } catch (NotFound&) {
379  "no ReferenceSlot<GUM_SCALAR> or SlotChain<GUM_SCALAR> "
380  "matches the given NodeId");
381  }
382  }
383 
384  template < typename GUM_SCALAR >
387  return __nodeIdMap.begin();
388  }
389 
390  template < typename GUM_SCALAR >
391  INLINE const typename PRMInstance< GUM_SCALAR >::iterator&
393  return __nodeIdMap.end();
394  }
395 
396  template < typename GUM_SCALAR >
399  return __nodeIdMap.begin();
400  }
401 
402  template < typename GUM_SCALAR >
403  INLINE const typename PRMInstance< GUM_SCALAR >::const_iterator&
405  return __nodeIdMap.end();
406  }
407 
408  template < typename GUM_SCALAR >
411  try {
413  } catch (NotFound&) {
414  GUM_ERROR(NotFound, "no referred instances from this NodeId");
415  }
416  }
417 
418  template < typename GUM_SCALAR >
421  try {
423  } catch (NotFound&) {
424  GUM_ERROR(NotFound, "no referred instances from this NodeId");
425  }
426  }
427 
428  template < typename GUM_SCALAR >
430  Set< PRMInstance< GUM_SCALAR >* >& set) :
431  __set(set),
432  __iter(set.begin()) {
434  }
435 
436  template < typename GUM_SCALAR >
438  const RefIterator& from) :
439  __set(const_cast< Set< PRMInstance< GUM_SCALAR >* >& >(from.__set)),
440  __iter(from.__iter) {
442  }
443 
444  template < typename GUM_SCALAR >
447  }
448 
449  template < typename GUM_SCALAR >
452  __iter = from.__iter;
453  return *this;
454  }
455 
456  template < typename GUM_SCALAR >
459  ++__iter;
460  return *this;
461  }
462 
463  template < typename GUM_SCALAR >
465  return __iter == __set.end();
466  }
467 
468  template < typename GUM_SCALAR >
470  operator!=(const RefIterator& from) const {
471  return __iter != from.__iter;
472  }
473 
474  template < typename GUM_SCALAR >
476  operator==(const RefIterator& from) const {
477  return __iter == from.__iter;
478  }
479 
480  template < typename GUM_SCALAR >
482  operator*() const {
483  return **__iter;
484  }
485 
486  template < typename GUM_SCALAR >
488  operator->() const {
489  return *__iter;
490  }
491 
492  template < typename GUM_SCALAR >
494  const Set< PRMInstance< GUM_SCALAR >* >& set) :
495  __set(set),
496  __iter(set.begin()) {
498  }
499 
500  template < typename GUM_SCALAR >
502  const RefConstIterator& from) :
503  __set(from.__set),
504  __iter(from.__iter) {
506  }
507 
508  template < typename GUM_SCALAR >
511  }
512 
513  template < typename GUM_SCALAR >
517  __iter = from.__iter;
518  return *this;
519  }
520 
521  template < typename GUM_SCALAR >
524  ++__iter;
525  return *this;
526  }
527 
528  template < typename GUM_SCALAR >
530  return __iter == __set.end();
531  }
532 
533  template < typename GUM_SCALAR >
535  operator!=(const RefConstIterator& from) const {
536  return __iter != from.__iter;
537  }
538 
539  template < typename GUM_SCALAR >
541  operator==(const RefConstIterator& from) const {
542  return __iter == from.__iter;
543  }
544 
545  template < typename GUM_SCALAR >
546  INLINE const PRMInstance< GUM_SCALAR >&
548  return **__iter;
549  }
550 
551  template < typename GUM_SCALAR >
552  INLINE const PRMInstance< GUM_SCALAR >*
554  return *__iter;
555  }
556 
557  template < typename GUM_SCALAR >
560  return __referingAttr.begin();
561  }
562 
563  template < typename GUM_SCALAR >
564  INLINE const typename PRMInstance< GUM_SCALAR >::InvRefIterator&
566  return __referingAttr.end();
567  }
568 
569  template < typename GUM_SCALAR >
572  return __referingAttr.begin();
573  }
574 
575  template < typename GUM_SCALAR >
578  return __referingAttr.end();
579  }
580 
581  template < typename GUM_SCALAR >
582  INLINE std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
584  return *(__referingAttr[id]);
585  }
586 
587  template < typename GUM_SCALAR >
588  INLINE const
589  std::vector< std::pair< PRMInstance< GUM_SCALAR >*, std::string > >&
591  return *(__referingAttr[id]);
592  }
593 
594  template < typename GUM_SCALAR >
596  return __referingAttr.exists(id) && (!__referingAttr[id]->empty());
597  }
598 
599  template < typename GUM_SCALAR >
602  const auto& type_attr = static_cast< const PRMAttribute< GUM_SCALAR >& >(
603  type().get(attr->safeName()));
604  attr->copyCpf(bijection(), type_attr);
605  GUM_ASSERT(attr->cpf().contains(attr->type().variable()));
606  }
607 
608  } /* namespace prm */
609 } /* namespace gum */
const PRMInstance< GUM_SCALAR > & operator*() const
PRMClass< GUM_SCALAR > * __type
The type of this PRMInstance<GUM_SCALAR>.
Definition: PRMInstance.h:507
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)
Unsafe Const Iterators for hashtablesHashTableConstIterator provides a fast but unsafe way to parse H...
Definition: hashTable.h:2462
Set< PRMInstance< GUM_SCALAR > *>::const_iterator __iter
Definition: PRMInstance.h:416
virtual ~PRMInstance()
Destructor.
MultiDimImplementation< GUM_SCALAR > * buildImpl() const
Returns a pointer over an empty gum::MultiDimImplementation of the good type for this PRMAggregate...
void add(NodeId id, PRMInstance< GUM_SCALAR > &instance)
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node...
PRMInstance(const std::string &name, PRMClass< GUM_SCALAR > &type)
Default constructor of an PRMInstance<GUM_SCALAR>.
virtual void addParent(const PRMClassElement< GUM_SCALAR > &elt)=0
See gum::PRMClassElement::_addParent().
PRMAttribute< GUM_SCALAR > & get(NodeId id)
Getter on an PRMAttribute<GUM_SCALAR> of this PRMInstance<GUM_SCALAR>.
const std::string & name() const
Returns the name of this object.
Definition: PRMObject_inl.h:32
virtual PRMType & type()=0
See gum::PRMClassElement::type().
An PRMInstance is a Bayesian Network fragment defined by a Class and used in a PRMSystem.
Definition: PRMInstance.h:60
void instantiate()
Instantiate all nodes which requires it.
bool operator==(const RefIterator &from) const
void __addReferingInstance(PRMSlotChain< GUM_SCALAR > *sc, PRMInstance< GUM_SCALAR > *i)
Add this as a referring instance over the attribute pointed by sc in i.
Unsafe Iterators for hashtablesHashTableIterator provides a fast but unsafe way to parse HashTables...
Definition: hashTable.h:2747
Headers of MultiDimSparse.
PRMClass< GUM_SCALAR > & type()
Returns the type of this instance.
Bijection< const DiscreteVariable *, const DiscreteVariable *> __bijection
A bijection used for MultiDim handling.
Definition: PRMInstance.h:526
PRMInstance< GUM_SCALAR > * operator->() const
Abstract class representing an element of PRM class.
NodeProperty< std::vector< pair > *> __referingAttr
The set of pair (instance, attribute) referring an attribute of this instance.
Definition: PRMInstance.h:523
bool exists(NodeId id) const
Returns true if id matches an PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
void __doInstantiate()
Starts this instance instantiations.
virtual PRMType & type()
This is similar to the following call: this->lastElt().type()
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
A PRMReferenceSlot represent a relation between two PRMClassElementContainer.
Definition: PRMObject.h:220
PRMClassElementContainer< GUM_SCALAR > & slotType()
Returns the type of this slot, which is a PRMClassElementContainer (it is not the type of PRMObject)...
bool __instantiated
True if this instance has been instantiated.
Definition: PRMInstance.h:504
Size size() const
Returns the number of attributes in this PRMInstance<GUM_SCALAR>.
NodeProperty< Set< PRMInstance< GUM_SCALAR > *> *> __referenceMap
Mapping between the gum::prm::PRMReferenceSlot and gum::prm::PRMSlotChain<GUM_SCALAR> in __type / and...
Definition: PRMInstance.h:516
RefIterator(Set< PRMInstance< GUM_SCALAR > * > &set)
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations.
Definition: PRMInstance.h:393
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.
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.
Representation of a setA Set is a structure that contains arbitrary elements.
Definition: set.h:162
const std::string & safeName() const
Returns the safe name of this PRMClassElement, if any.
PRMInstance< GUM_SCALAR > & operator*() const
void __copyAttribute(PRMAttribute< GUM_SCALAR > *source)
Used at construction to instantiate attributes.
prm_type
Enumeration of the different types of objects handled by a PRM.
Definition: PRMObject.h:66
bool operator==(const RefConstIterator &from) const
bool isMultiple() const
Return true if this slot chain contains at least one multiple reference slot.
void __copyAggregates(PRMAggregate< GUM_SCALAR > *source)
Used at construction to instantiate aggregates.
virtual const Potential< GUM_SCALAR > & cpf() const =0
See gum::PRMClassElement::cpf().
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...
Set< PRMInstance< GUM_SCALAR > *> & __set
Definition: PRMInstance.h:364
PRMInstance< GUM_SCALAR > & operator=(const PRMClass< GUM_SCALAR > &from)
Copy operator. Don&#39;t use it.
PRMClassElementContainer< GUM_SCALAR > & end()
Returns the PRMClassElement<GUM_SCALAR>Container over which this slot chain ends. ...
Set of pairs of elements with fast search for both elements.
Definition: bijection.h:1803
virtual prm_type obj_type() const
Returns the PRM type of this object.
virtual ClassElementType elt_type() const =0
Return the type of class element this object is.
A PRMSlotChain represents a sequence of gum::prm::PRMClassElement<GUM_SCALAR> where the n-1 first gum...
Definition: PRMObject.h:218
Abstract base class for any element defined in a PRM.
Definition: PRMObject.h:53
bool operator!=(const RefConstIterator &from) const
virtual PRMType & type()
See gum::PRMClassElement::type().
Set< PRMInstance< GUM_SCALAR > *>::iterator __iter
Definition: PRMInstance.h:365
NodeId id() const
Returns the NodeId of this element in it&#39;s class DAG.
const iterator & end()
Returns a reference over the iterator at the end of the list of gum::prm::PRMAttribute<GUM_SCALAR> in...
Headers of gum::prm::PRMInstance<GUM_SCALAR>
A PRMClass is an object of a PRM representing a fragment of a Bayesian Network which can be instantia...
Definition: PRMClass.h:63
bool hasRefAttr(NodeId id) const
Returns true if id has at least one referring PRMAttribute<GUM_SCALAR>.
const PRMInstance< GUM_SCALAR > * operator->() const
RefConstIterator & operator=(const RefConstIterator &from)
virtual void copyCpf(const Bijection< const DiscreteVariable *, const DiscreteVariable * > &bif, const PRMAttribute< GUM_SCALAR > &source)=0
See gum::PRMClassElement::elt_type().
PRMAttribute is a member of a Class in a PRM.
Definition: PRMAttribute.h:58
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
RefIterator & operator=(const RefIterator &from)
PRMClassElement< GUM_SCALAR > & lastElt()
Returns the last element of the slot chain, typically this is an gum::PRMAttribute or a gum::PRMAggre...
iterator begin()
Returns an iterator at the begining of the list of gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInst...
Nested class to iterate over PRMReferenceSlot and PRMSlotChain<GUM_SCALAR> instantiations.
Definition: PRMInstance.h:342
const InvRefIterator & endInvRef()
Alias to iterate over the gum::prm::PRMAttribute<GUM_SCALAR> in this PRMInstance<GUM_SCALAR>.
<agrum/PRM/elements/scalarAttribute.h>
Size NodeId
Type for node ids.
Definition: graphElements.h:97
void insert(const Key &k)
Inserts a new element into the set.
Definition: set_tpl.h:610
bool operator!=(const RefIterator &from) const
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
NodeProperty< PRMAttribute< GUM_SCALAR > *> __nodeIdMap
The gum::prm::PRMAttribute<GUM_SCALAR> and gum::prm::PRMAggregate<GUM_SCALAR> of this PRMInstance<GUM...
Definition: PRMInstance.h:511
Sequence< PRMClassElement< GUM_SCALAR > *> & chain()
Return the sequence representing the chain of elements in this PRMSlotChain.
const Set< PRMInstance< GUM_SCALAR > *> & getInstances(NodeId id) const
Returns the Set of PRMInstance<GUM_SCALAR> referenced by id.
const Set< PRMInstance< GUM_SCALAR > *> & __set
Definition: PRMInstance.h:415