aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::prm::PRMSystem< GUM_SCALAR > Class Template Reference

A PRMSystem is a container of PRMInstance and describe a relational skeleton. More...

#include <PRMSystem.h>

Inheritance diagram for gum::prm::PRMSystem< GUM_SCALAR >:
Collaboration diagram for gum::prm::PRMSystem< GUM_SCALAR >:

Public Member Functions

Constructors & destructor.
 PRMSystem (const std::string &name)
 Default constructor.
virtual ~PRMSystem ()
 Destructor.
Getters & setters over the relational skeleton.
const DiGraphskeleton () const
 Returns the relation skeleton of this PRMSystem.
PRMInstance< GUM_SCALAR > & get (NodeId id)
 Returns an PRMInstance given it's NodeId in the relational skeleton.
const PRMInstance< GUM_SCALAR > & get (NodeId id) const
 Returns an PRMInstance given it's NodeId in the relational skeleton.
NodeId get (const PRMInstance< GUM_SCALAR > &i) const
 Returns the relation skeleton of this PRMSystem.
Getters & setters over PRMInstance and array of PRMInstance.
virtual PRMObject::prm_type obj_type () const
 Returns the PRM type of this object.
Size size () const
 Returns the number of PRMInstance in this PRMSystem.
bool exists (const std::string &name) const
 Retruns true either if name is an instance or an array in this PRMSystem.
bool isInstantiated (const PRMClass< GUM_SCALAR > &c) const
 Returns true if the given Class<GUM_SCALAR> has at least one PRMInstance in this PRMSystem.
bool isInstance (const std::string &name) const
 Returns true if an PRMInstance with the given name exists.
bool isArray (const std::string &name) const
 Returns true if an array with the given name exists.
void groundedBN (BayesNetFactory< GUM_SCALAR > &factory) const
 Returns the grounded Bayesian network of this system.
void instantiate ()
 Instantiate all the PRMInstance in this PRMSystem.
PRMInstance handling.
PRMInstance< GUM_SCALAR > & get (const std::string &name)
 Returns a reference over an PRMInstance given it's name.
const PRMInstance< GUM_SCALAR > & get (const std::string &name) const
 Returns a constant reference over an PRMInstance given it's name.
const Set< PRMInstance< GUM_SCALAR > * > & get (const PRMClass< GUM_SCALAR > &type) const
 Returns the sequence of all instances of the given type.
NodeId add (PRMInstance< GUM_SCALAR > *i)
 Add an PRMInstance to this system.
Array handling.
const Sequence< PRMInstance< GUM_SCALAR > * > & getArray (const std::string &name) const
 Returns the sequence of instances of a given array.
PRMClassElementContainer< GUM_SCALAR > & getArrayType (const std::string &name)
 Returns the type of the given array.
const PRMClassElementContainer< GUM_SCALAR > & getArrayType (const std::string &name) const
 Returns the type of the given array.
NodeId add (const std::string &array, PRMInstance< GUM_SCALAR > *i)
 Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
NodeId add (const std::string &array, PRMInstance< GUM_SCALAR > &i)
 Add an PRMInstance to an array in this system. If the array doesn't exists it is created.
void addArray (const std::string &array, PRMClassElementContainer< GUM_SCALAR > &type)
 Add an array of instances in this system. If the array doesn't exists it is created.
Getters & setters.
const std::string & name () const
 Returns the name of this object.
void name (const std::string &name)
 Change the name of the PRM Object.
Operators
bool operator== (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).
bool operator!= (const PRMObject &obj) const
 To PRMObject are equal if they have the same name (which is unique).

Protected Member Functions

 PRMSystem (const PRMSystem< GUM_SCALAR > &from)
 Copy constructor. Don't use it.
PRMSystem< GUM_SCALAR > & operator= (const PRMSystem< GUM_SCALAR > &from)=delete
 Copy operator. Don't use it.
Ground BN private methods.
void _groundRef_ (const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
 Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet.
void _groundAttr_ (const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
 Method which ground Atttributes and Aggregators of an PRMInstance.
void _groundTensor_ (const PRMInstance< GUM_SCALAR > &instance, const PRMAttribute< GUM_SCALAR > &attr, BayesNetFactory< GUM_SCALAR > &factory) const
 Method which copy node's Tensor of an PRMInstance to the grounded Bayesian network.
void _groundAgg_ (const PRMClassElement< GUM_SCALAR > &elt, const std::string &name, BayesNetFactory< GUM_SCALAR > &factory) const
 Ground an aggregator with the given name in the grounded IBayesNet.

Private Attributes

Private members.
std::string _name_

Iterators.

using iterator = typename NodeProperty< PRMInstance< GUM_SCALAR >* >::iterator
 Iterator over the PRMInstance of this PRMSystem.
using const_iterator = typename NodeProperty< PRMInstance< GUM_SCALAR >* >::const_iterator
 Constant Iterator over the PRMInstance of this PRMSystem.
using array_iterator = typename Sequence< PRMInstance< GUM_SCALAR >* >::iterator
 Iterator over the PRMInstance in an array in this PRMSystem.
using const_array_iterator = typename Sequence< PRMInstance< GUM_SCALAR >* >::const_iterator
 Iterator over the PRMInstance in an array in this PRMSystem.
iterator begin ()
 Returns an iterator over the instances in this system.
const iteratorend ()
 Returns a iterator at the end of the set of PRMInstance in this PRMSystem.
const_iterator begin () const
 Returns a constant iterator over the instances in this system.
const const_iteratorend () const
 Returns a constant iterator at the end of the set of PRMInstance in this PRMSystem.
array_iterator begin (const std::string &a)
 Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
const array_iteratorend (const std::string &a)
 Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
const_array_iterator begin (const std::string &a) const
 Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
const const_array_iteratorend (const std::string &a) const
 Returns an iterator at the end of the Sequence of PRMInstance in the array named a.

Built-in types.

enum class  prm_type : char {
  ALL , CLASS , PRM_INTERFACE , CLASS_ELT ,
  TYPE , SYSTEM , INSTANCE
}
 Enumeration of the different types of objects handled by a PRM. More...
static std::string LEFT_CAST ()
 Enumeration of the different types of objects handled by a PRM.
static std::string RIGHT_CAST ()
 Enumeration of the different types of objects handled by a PRM.
static std::string enum2str (prm_type type)
 Returns the string representation of a PRMObject.
static INLINE bool isClass (const PRMObject &obj)
 Returns true if obj_ptr is of type Class.
static INLINE bool isInterface (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInterface.
static INLINE bool isInstance (const PRMObject &obj)
 Returns true if obj_ptr is of type PRMInstance.

Private PRMInstance handling methods and members.

using model_pair
 Type for the pair of a Class<GUM_SCALAR> and the sequence of it's instantiation.
DiGraph skeleton_
 The relational skeleton of this PRMSystem.
NodeProperty< PRMInstance< GUM_SCALAR > * > nodeIdMap_
 The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem.
HashTable< std::string, PRMInstance< GUM_SCALAR > * > nameMap_
 The mapping between PRMInstance and their names.
HashTable< PRMClass< GUM_SCALAR > *, Set< PRMInstance< GUM_SCALAR > * > * > instanceMap_
 Mapping between a class and all it's PRMInstance in this system.
HashTable< std::string, model_pairarrayMap_
 Mapping between arrays and their name. The first element of the pair is the type of the array.

Detailed Description

template<typename GUM_SCALAR>
class gum::prm::PRMSystem< GUM_SCALAR >

A PRMSystem is a container of PRMInstance and describe a relational skeleton.

Definition at line 70 of file PRMSystem.h.

Member Typedef Documentation

◆ array_iterator

template<typename GUM_SCALAR>
using gum::prm::PRMSystem< GUM_SCALAR >::array_iterator = typename Sequence< PRMInstance< GUM_SCALAR >* >::iterator

Iterator over the PRMInstance in an array in this PRMSystem.

Definition at line 234 of file PRMSystem.h.

◆ const_array_iterator

template<typename GUM_SCALAR>
using gum::prm::PRMSystem< GUM_SCALAR >::const_array_iterator = typename Sequence< PRMInstance< GUM_SCALAR >* >::const_iterator

Iterator over the PRMInstance in an array in this PRMSystem.

Definition at line 247 of file PRMSystem.h.

◆ const_iterator

template<typename GUM_SCALAR>
using gum::prm::PRMSystem< GUM_SCALAR >::const_iterator = typename NodeProperty< PRMInstance< GUM_SCALAR >* >::const_iterator

Constant Iterator over the PRMInstance of this PRMSystem.

Definition at line 224 of file PRMSystem.h.

◆ iterator

template<typename GUM_SCALAR>
using gum::prm::PRMSystem< GUM_SCALAR >::iterator = typename NodeProperty< PRMInstance< GUM_SCALAR >* >::iterator

Iterator over the PRMInstance of this PRMSystem.

Definition at line 214 of file PRMSystem.h.

◆ model_pair

template<typename GUM_SCALAR>
using gum::prm::PRMSystem< GUM_SCALAR >::model_pair
protected
Initial value:
std::pair< PRMClassElementContainer< GUM_SCALAR >*,
The generic class for storing (ordered) sequences of objects.
Definition sequence.h:972

Type for the pair of a Class<GUM_SCALAR> and the sequence of it's instantiation.

Definition at line 288 of file PRMSystem.h.

Member Enumeration Documentation

◆ prm_type

enum class gum::prm::PRMObject::prm_type : char
stronginherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Enumerator
ALL 
CLASS 
PRM_INTERFACE 
CLASS_ELT 
TYPE 
SYSTEM 
INSTANCE 

Definition at line 88 of file PRMObject.h.

88: char { ALL, CLASS, PRM_INTERFACE, CLASS_ELT, TYPE, SYSTEM, INSTANCE };

Constructor & Destructor Documentation

◆ PRMSystem() [1/2]

template<typename GUM_SCALAR>
gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem ( const std::string & name)
explicit

Default constructor.

Definition at line 60 of file PRMSystem_tpl.h.

60 : PRMObject(name) {
62 }
const std::string & name() const
Returns the name of this object.
PRMObject(const std::string &name)
Constructor.
Definition PRMObject.cpp:62
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition PRMSystem.h:70
PRMSystem(const std::string &name)
Default constructor.

References gum::prm::PRMObject::PRMObject(), PRMSystem(), and gum::prm::PRMObject::name().

Referenced by PRMSystem(), PRMSystem(), ~PRMSystem(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~PRMSystem()

template<typename GUM_SCALAR>
gum::prm::PRMSystem< GUM_SCALAR >::~PRMSystem ( )
virtual

Destructor.

Definition at line 65 of file PRMSystem_tpl.h.

65 {
67
68 for (const auto& elt: *this)
69 delete elt.second;
70
71 for (const auto& elt: instanceMap_)
72 delete elt.second;
73
74 for (const auto& elt: arrayMap_)
75 delete elt.second.second;
76 }
HashTable< PRMClass< GUM_SCALAR > *, Set< PRMInstance< GUM_SCALAR > * > * > instanceMap_
Mapping between a class and all it's PRMInstance in this system.
Definition PRMSystem.h:284
HashTable< std::string, model_pair > arrayMap_
Mapping between arrays and their name. The first element of the pair is the type of the array.
Definition PRMSystem.h:293

References PRMSystem(), arrayMap_, and instanceMap_.

Here is the call graph for this function:

◆ PRMSystem() [2/2]

template<typename GUM_SCALAR>
INLINE gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem ( const PRMSystem< GUM_SCALAR > & from)
protected

Copy constructor. Don't use it.

Definition at line 79 of file PRMSystem_tpl.h.

79 :
83 }
DiGraph skeleton_
The relational skeleton of this PRMSystem.
Definition PRMSystem.h:274
HashTable< std::string, PRMInstance< GUM_SCALAR > * > nameMap_
The mapping between PRMInstance and their names.
Definition PRMSystem.h:281
NodeProperty< PRMInstance< GUM_SCALAR > * > nodeIdMap_
The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem.
Definition PRMSystem.h:278

References gum::prm::PRMObject::PRMObject(), PRMSystem(), nodeIdMap_, and skeleton_.

Here is the call graph for this function:

Member Function Documentation

◆ _groundAgg_()

template<typename GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_ ( const PRMClassElement< GUM_SCALAR > & elt,
const std::string & name,
BayesNetFactory< GUM_SCALAR > & factory ) const
protected

Ground an aggregator with the given name in the grounded IBayesNet.

Parameters
eltThe aggregator grounded.
nameThe aggregator's name in the grounded IBayesNet.
factoryThe factory used to build the grounded IBayesNet.

Definition at line 159 of file PRMSystem_tpl.h.

161 {
162 factory.startVariableDeclaration();
163 factory.variableName(name);
164
165 const DiscreteVariable& agg_var = elt.type().variable();
166
167 VarType var_type = agg_var.varType();
168
169 factory.variableType(var_type);
170
171 switch (var_type) {
172 case VarType::LABELIZED : {
173 const auto l = static_cast< const LabelizedVariable& >(agg_var);
174 for (Idx i = 0; i < l.domainSize(); ++i) {
175 factory.addModality(l.label(i));
176 }
177 break;
178 }
179 case VarType::INTEGER : {
180 const auto l = static_cast< const IntegerVariable& >(agg_var);
181 for (Idx i = 0; i < l.domainSize(); ++i) {
182 factory.addModality(l.label(i));
183 }
184 break;
185 }
186 case VarType::NUMERICAL : {
187 const auto l = static_cast< const NumericalDiscreteVariable& >(agg_var);
188 for (Idx i = 0; i < l.domainSize(); ++i) {
189 factory.addModality(l.label(i));
190 }
191 break;
192 }
193 case VarType::DISCRETIZED : {
194 const auto d = static_cast< const DiscretizedVariable< double >& >(agg_var);
195 for (Idx i = 0; i < d.domainSize(); ++i) {
196 factory.addTick(d.tick(i));
197 }
198 break;
199 }
200 case VarType::RANGE : {
201 const auto r = static_cast< const RangeVariable& >(agg_var);
202 factory.addMin(r.minVal());
203 factory.addMax(r.maxVal());
204 break;
205 }
206 case VarType::CONTINUOUS : {
208 "PRM aggregator grounding does not support yet continuous variables");
209 }
210 }
211
212 switch (auto& agg = static_cast< const PRMAggregate< GUM_SCALAR >& >(elt); agg.agg_type()) {
214 factory.setVariableCPTImplementation(new aggregator::Min< GUM_SCALAR >());
215 break;
216 }
217
219 factory.setVariableCPTImplementation(new aggregator::Max< GUM_SCALAR >());
220 break;
221 }
222
224 factory.setVariableCPTImplementation(new aggregator::Exists< GUM_SCALAR >(agg.label()));
225 break;
226 }
227
229 factory.setVariableCPTImplementation(new aggregator::Forall< GUM_SCALAR >(agg.label()));
230 break;
231 }
232
234 factory.setVariableCPTImplementation(new aggregator::Count< GUM_SCALAR >(agg.label()));
235 break;
236 }
237
239 factory.setVariableCPTImplementation(new aggregator::Median< GUM_SCALAR >());
240 break;
241 }
242
244 factory.setVariableCPTImplementation(new aggregator::Amplitude< GUM_SCALAR >());
245 break;
246 }
247
249 factory.setVariableCPTImplementation(new aggregator::Or< GUM_SCALAR >());
250 break;
251 }
252
254 factory.setVariableCPTImplementation(new aggregator::And< GUM_SCALAR >());
255 break;
256 }
257
259 factory.setVariableCPTImplementation(new aggregator::Sum< GUM_SCALAR >());
260 break;
261 }
262
263 default : GUM_ERROR(OperationNotAllowed, "Aggregator not handled yet for " << agg.name())
264 }
265
266 factory.endVariableDeclaration();
267 }
#define GUM_ERROR(type, msg)
Definition exceptions.h:72

References gum::prm::PRMObject::name(), gum::BayesNetFactory< GUM_SCALAR >::startVariableDeclaration(), and gum::BayesNetFactory< GUM_SCALAR >::variableName().

Here is the call graph for this function:

◆ _groundAttr_()

template<typename GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::_groundAttr_ ( const PRMInstance< GUM_SCALAR > & instance,
BayesNetFactory< GUM_SCALAR > & factory ) const
protected

Method which ground Atttributes and Aggregators of an PRMInstance.

Parameters
instanceThe PRMInstance grounded by this method.
factoryThe factory used to build the grounded IBayesNet.

Definition at line 124 of file PRMSystem_tpl.h.

125 {
126 for (const auto node: instance.type().containerDag()) {
127 // Working a Class<GUM_SCALAR> level because PRMAggregate<GUM_SCALAR>
128 // are
129 // instantiated as PRMAttribute<GUM_SCALAR> in an
130 // PRMInstance<GUM_SCALAR>
131 switch (instance.type().get(node).elt_type()) {
133 // TODO: make a special case for noisy-or
135 elt_name << instance.name() << "." << instance.type().get(node).safeName();
136 DiscreteVariable* var = instance.get(node).type().variable().clone();
137 var->setName(elt_name.str());
138 factory.setVariable(*var); // var is copied by the factory
139 delete var;
140 break;
141 }
142
145 elt_name << instance.name() << "." << instance.type().get(node).safeName();
146 _groundAgg_(instance.type().get(node), elt_name.str(), factory);
147 break;
148 }
149
150 default :
151 break;
152 /* Do nothing */
153 ;
154 }
155 }
156 }
PRMInstance< GUM_SCALAR > & get(NodeId id)
Returns an PRMInstance given it's NodeId in the relational skeleton.
void _groundAgg_(const PRMClassElement< GUM_SCALAR > &elt, const std::string &name, BayesNetFactory< GUM_SCALAR > &factory) const
Ground an aggregator with the given name in the grounded IBayesNet.

References gum::prm::PRMInstance< GUM_SCALAR >::type().

Referenced by groundedBN().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _groundRef_()

template<typename GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_ ( const PRMInstance< GUM_SCALAR > & instance,
BayesNetFactory< GUM_SCALAR > & factory ) const
protected

Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet.

Parameters
instanceThe PRMInstance grounded by this method.
factoryThe factory used to build the grounded IBayesNet.

Definition at line 270 of file PRMSystem_tpl.h.

271 {
272 for (const auto& elt: instance) {
274 elt_name << instance.name() << "." << elt.second->safeName();
275 factory.startParentsDeclaration(elt_name.str());
276
277 for (const auto par: instance.type().containerDag().parents(elt.second->id())) {
278 switch (instance.type().get(par).elt_type()) {
282 parent_name << instance.name() << "." << instance.get(par).safeName();
283 factory.addParent(parent_name.str());
284 break;
285 }
286
289 = static_cast< const PRMSlotChain< GUM_SCALAR >& >(instance.type().get(par))
290 .lastElt()
291 .safeName();
292
293 try {
294 for (const auto ref: instance.getInstances(par)) {
296 sBuff << ref->name() << "." << parent_name;
297 factory.addParent(sBuff.str());
298 }
299 } catch (NotFound const&) {
300 // No instances for this slotchain
301 }
302
303 break;
304 }
305
306 default :
307 break;
308 /* nothing to do by default */
309 }
310 }
311
312 factory.endParentsDeclaration();
313
314 // Checking if we need to ground the Tensor (only for class level
315 // attributes since
316 // aggregates Tensors are generated)
317 if (PRMClassElement< GUM_SCALAR >::isAttribute(instance.type().get(elt.second->safeName())))
319 }
320 }
void _groundTensor_(const PRMInstance< GUM_SCALAR > &instance, const PRMAttribute< GUM_SCALAR > &attr, BayesNetFactory< GUM_SCALAR > &factory) const
Method which copy node's Tensor of an PRMInstance to the grounded Bayesian network.

References gum::BayesNetFactory< GUM_SCALAR >::addParent(), gum::prm::PRMInstance< GUM_SCALAR >::get(), get(), gum::prm::PRMInstance< GUM_SCALAR >::getInstances(), gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::prm_aggregate, gum::prm::PRMClassElement< GUM_SCALAR >::prm_attribute, gum::prm::PRMClassElement< GUM_SCALAR >::prm_slotchain, gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::BayesNetFactory< GUM_SCALAR >::startParentsDeclaration(), and gum::prm::PRMInstance< GUM_SCALAR >::type().

Here is the call graph for this function:

◆ _groundTensor_()

template<typename GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::_groundTensor_ ( const PRMInstance< GUM_SCALAR > & instance,
const PRMAttribute< GUM_SCALAR > & attr,
BayesNetFactory< GUM_SCALAR > & factory ) const
protected

Method which copy node's Tensor of an PRMInstance to the grounded Bayesian network.

Parameters
instanceThe PRMInstance currently grounded.
attrThe PRMAttribute<GUM_SCALAR> for which the Tensor is grounded.
factoryThe factory used to build the grounded IBayesNet.

Definition at line 323 of file PRMSystem_tpl.h.

325 {
328 var_name << instance.name() << "." << attr.safeName();
329 bijection.insert(&(attr.type().variable()), &(factory.variable(var_name.str())));
330
331 for (const auto parent: instance.type().containerDag().parents(attr.id())) {
332 switch (instance.type().get(parent).elt_type()) {
336 parent_name << instance.name() << "." << instance.get(parent).safeName();
337 bijection.insert(&(instance.get(parent).type().variable()),
338 &(factory.variable(parent_name.str())));
339 break;
340 }
341
345 = static_cast< const PRMSlotChain< GUM_SCALAR >& >(instance.type().get(parent));
346 parent_name << instance.getInstance(sc.id()).name() << "." << sc.lastElt().safeName();
347 bijection.insert(
348 &(instance.getInstance(sc.id()).get(sc.lastElt().safeName()).type().variable()),
349 &(factory.variable(parent_name.str())));
350 break;
351 }
352
353 default : {
354 GUM_ERROR(FatalError, "invalid ClassElement<GUM_SCALAR> type as parent.")
355 break;
356 }
357 }
358 }
359
360 // Copy Tensor
361 // DO NOT USE MultiDimBijArray as they will wreck havok if you delete
362 // the prm befor its grounded BN (happens a lot in pyAgrum)
365 p->add(*(bijection.second(var)));
366 }
367 Instantiation inst(attr.cpf()), jnst(*p);
368 for (inst.setFirst(), jnst.setFirst(); !(inst.end() || jnst.end()); inst.inc(), jnst.inc()) {
369 p->set(jnst, attr.cpf().get(inst));
370 }
371 GUM_ASSERT(inst.end() && jnst.end());
372 factory.setVariableCPT(var_name.str(), p, false);
373 }
const iterator & end()
Returns a iterator at the end of the set of PRMInstance in this PRMSystem.
NodeId add(PRMInstance< GUM_SCALAR > *i)
Add an PRMInstance to this system.

◆ add() [1/3]

template<typename GUM_SCALAR>
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::add ( const std::string & array,
PRMInstance< GUM_SCALAR > & i )

Add an PRMInstance to an array in this system. If the array doesn't exists it is created.

Exceptions
PRMTypeErrorRaised if i is not of the good type.
DuplicateElementRaised if an PRMInstance with same name already exists.

Definition at line 376 of file PRMSystem_tpl.h.

377 {
378 return add(array, &i);
379 }

References add().

Here is the call graph for this function:

◆ add() [2/3]

template<typename GUM_SCALAR>
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::add ( const std::string & array,
PRMInstance< GUM_SCALAR > * i )

Add an PRMInstance to an array in this system. If the array doesn't exists it is created.

Exceptions
PRMTypeErrorRaised if i is not of the good type.
DuplicateElementRaised if an PRMInstance with same name already exists.

Definition at line 501 of file PRMSystem_tpl.h.

502 {
503 try {
504 if (i->type().isSubTypeOf(*(arrayMap_[array].first))) {
505 NodeId id = add(i);
506 arrayMap_[array].second->insert(i);
507 return id;
508 } else {
510 "the given Instance<GUM_SCALAR> is of an incorrect "
511 "Class<GUM_SCALAR> type");
512 }
513 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
514 }

References add(), arrayMap_, GUM_ERROR, and gum::prm::PRMInstance< GUM_SCALAR >::type().

Here is the call graph for this function:

◆ add() [3/3]

template<typename GUM_SCALAR>
NodeId gum::prm::PRMSystem< GUM_SCALAR >::add ( PRMInstance< GUM_SCALAR > * i)

Add an PRMInstance to this system.

Exceptions
DuplicateElementRaised if an PRMInstance with the same name already exists.

Definition at line 86 of file PRMSystem_tpl.h.

86 {
87 if (nameMap_.exists(i->name())) {
89 "an Instance<GUM_SCALAR> with the same is already in this System");
90 }
91
92 NodeId id = skeleton_.addNode();
93 nodeIdMap_.insert(id, i);
94 nameMap_.insert(i->name(), i);
95
96 try {
97 instanceMap_[&(i->type())]->insert(i);
98 } catch (NotFound const&) {
99 instanceMap_.insert(&(i->type()), new Set< PRMInstance< GUM_SCALAR >* >());
100 instanceMap_[&(i->type())]->insert(i);
101 }
102
103 return id;
104 }

References GUM_ERROR, gum::prm::PRMObject::name(), and nameMap_.

Referenced by add(), add(), gum::prm::PRMFactory< GUM_SCALAR >::addArray(), gum::prm::PRMFactory< GUM_SCALAR >::incArray(), and gum::O3prmBNReader< GUM_SCALAR >::proceed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ addArray()

template<typename GUM_SCALAR>
INLINE void gum::prm::PRMSystem< GUM_SCALAR >::addArray ( const std::string & array,
PRMClassElementContainer< GUM_SCALAR > & type )

Add an array of instances in this system. If the array doesn't exists it is created.

Exceptions
DuplicateElementRaised if an existing array with the same name already exists.

Definition at line 517 of file PRMSystem_tpl.h.

518 {
519 if (arrayMap_.exists(array)) {
520 GUM_ERROR(DuplicateElement, "an array '" << array << "' is already in this System")
521 }
522
523 arrayMap_.insert(
524 array,
526 }

References arrayMap_, and GUM_ERROR.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addArray().

Here is the caller graph for this function:

◆ begin() [1/4]

template<typename GUM_SCALAR>
INLINE PRMSystem< GUM_SCALAR >::iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( )

Returns an iterator over the instances in this system.

Definition at line 529 of file PRMSystem_tpl.h.

529 {
530 return nodeIdMap_.begin();
531 }

References nodeIdMap_.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph(), groundedBN(), and instantiate().

Here is the caller graph for this function:

◆ begin() [2/4]

template<typename GUM_SCALAR>
INLINE PRMSystem< GUM_SCALAR >::const_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( ) const

Returns a constant iterator over the instances in this system.

Definition at line 539 of file PRMSystem_tpl.h.

539 {
540 return nodeIdMap_.begin();
541 }

References nodeIdMap_.

◆ begin() [3/4]

template<typename GUM_SCALAR>
INLINE PRMSystem< GUM_SCALAR >::array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( const std::string & a)

Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.

Exceptions
NotFoundRaised if no array matches a.

Definition at line 551 of file PRMSystem_tpl.h.

551 {
552 try {
553 return arrayMap_[a].second->begin();
554 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
555 }

References arrayMap_, and GUM_ERROR.

◆ begin() [4/4]

template<typename GUM_SCALAR>
INLINE PRMSystem< GUM_SCALAR >::const_array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( const std::string & a) const

Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.

Exceptions
NotFoundRaised if no array matches a.

Definition at line 567 of file PRMSystem_tpl.h.

567 {
568 try {
569 return arrayMap_[a].second->begin();
570 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
571 }

References arrayMap_, and GUM_ERROR.

◆ end() [1/4]

template<typename GUM_SCALAR>
INLINE const PRMSystem< GUM_SCALAR >::iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( )

Returns a iterator at the end of the set of PRMInstance in this PRMSystem.

Definition at line 534 of file PRMSystem_tpl.h.

534 {
535 return nodeIdMap_.end();
536 }

References nodeIdMap_.

Referenced by gum::prm::gspan::InterfaceGraph< GUM_SCALAR >::InterfaceGraph(), groundedBN(), and instantiate().

Here is the caller graph for this function:

◆ end() [2/4]

template<typename GUM_SCALAR>
INLINE const PRMSystem< GUM_SCALAR >::const_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( ) const

Returns a constant iterator at the end of the set of PRMInstance in this PRMSystem.

Definition at line 545 of file PRMSystem_tpl.h.

545 {
546 return nodeIdMap_.end();
547 }

References nodeIdMap_.

◆ end() [3/4]

template<typename GUM_SCALAR>
INLINE const PRMSystem< GUM_SCALAR >::array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( const std::string & a)

Returns an iterator at the end of the Sequence of PRMInstance in the array named a.

Exceptions
NotFoundRaised if no array matches a.

Definition at line 559 of file PRMSystem_tpl.h.

559 {
560 try {
561 return arrayMap_[a].second->end();
562 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
563 }

References arrayMap_, and GUM_ERROR.

◆ end() [4/4]

template<typename GUM_SCALAR>
INLINE const PRMSystem< GUM_SCALAR >::const_array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( const std::string & a) const

Returns an iterator at the end of the Sequence of PRMInstance in the array named a.

Exceptions
NotFoundRaised if no array matches a.

Definition at line 575 of file PRMSystem_tpl.h.

575 {
576 try {
577 return arrayMap_[a].second->end();
578 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
579 }

References arrayMap_, and GUM_ERROR.

◆ enum2str()

std::string gum::prm::PRMObject::enum2str ( prm_type type)
inlinestaticinherited

Returns the string representation of a PRMObject.

Definition at line 95 of file PRMObject.h.

95 {
96 switch (type) {
97 case prm_type::CLASS : return "PRMType::CLASS";
98
99 case prm_type::CLASS_ELT : return "PRMType::CLASS_ELT";
100
101 case prm_type::TYPE : return "PRMType::TYPE";
102
103 case prm_type::SYSTEM : return "PRMType::SYSTEM";
104
105 case prm_type::INSTANCE : return "PRMType::INSTANCE";
106
107 case prm_type::PRM_INTERFACE : return "PRMType::PRM_INTERFACE";
108
109 default : return "unknown";
110 }
111 }

References CLASS, CLASS_ELT, INSTANCE, PRM_INTERFACE, SYSTEM, and TYPE.

Referenced by gum::prm::operator<<().

Here is the caller graph for this function:

◆ exists()

template<typename GUM_SCALAR>
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::exists ( const std::string & name) const

Retruns true either if name is an instance or an array in this PRMSystem.

Definition at line 582 of file PRMSystem_tpl.h.

582 {
583 return nameMap_.exists(name) || arrayMap_.exists(name);
584 }

References arrayMap_, gum::prm::PRMObject::name(), and nameMap_.

Referenced by gum::prm::o3prmr::O3prmrInterpreter::findInstanceName().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [1/6]

template<typename GUM_SCALAR>
INLINE const Set< PRMInstance< GUM_SCALAR > * > & gum::prm::PRMSystem< GUM_SCALAR >::get ( const PRMClass< GUM_SCALAR > & type) const

Returns the sequence of all instances of the given type.

Exceptions
NotFoundRaised if there is instantiation of type.

Definition at line 467 of file PRMSystem_tpl.h.

467 {
468 try {
469 return *(instanceMap_[const_cast< PRMClass< GUM_SCALAR >* >(&type)]);
470 } catch (NotFound const&) {
471 GUM_ERROR(NotFound, "the given Class<GUM_SCALAR> has no instantiation in this System");
472 }
473 }

References GUM_ERROR, and instanceMap_.

◆ get() [2/6]

template<typename GUM_SCALAR>
INLINE NodeId gum::prm::PRMSystem< GUM_SCALAR >::get ( const PRMInstance< GUM_SCALAR > & i) const

Returns the relation skeleton of this PRMSystem.

Definition at line 405 of file PRMSystem_tpl.h.

405 {
406 try {
407 return nodeIdMap_.keyByVal(const_cast< PRMInstance< GUM_SCALAR >* >(&i));
408 } catch (NotFound const&) {
409 GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given id")
410 }
411 }

References GUM_ERROR, and nodeIdMap_.

◆ get() [3/6]

template<typename GUM_SCALAR>
INLINE PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( const std::string & name)

Returns a reference over an PRMInstance given it's name.

Exceptions
NotFoundRaised if the no PRMInstance matches name.

Definition at line 446 of file PRMSystem_tpl.h.

446 {
447 try {
448 return *(nameMap_[name]);
449 } catch (NotFound const&) {
450 GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given name")
451 }
452 }

References GUM_ERROR, gum::prm::PRMObject::name(), and nameMap_.

Here is the call graph for this function:

◆ get() [4/6]

template<typename GUM_SCALAR>
INLINE const PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( const std::string & name) const

Returns a constant reference over an PRMInstance given it's name.

Exceptions
NotFoundRaised if the no PRMInstance matches name.

Definition at line 456 of file PRMSystem_tpl.h.

456 {
457 try {
458 return *(nameMap_[name]);
459 } catch (NotFound const&) {
460 GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given name")
461 }
462 }

References GUM_ERROR, gum::prm::PRMObject::name(), and nameMap_.

Here is the call graph for this function:

◆ get() [5/6]

template<typename GUM_SCALAR>
INLINE PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( NodeId id)

Returns an PRMInstance given it's NodeId in the relational skeleton.

Exceptions
NotFoundRaised if no PRMInstance matches the given NodeId.

Definition at line 387 of file PRMSystem_tpl.h.

387 {
388 try {
389 return *(nodeIdMap_[id]);
390 } catch (NotFound const&) {
391 GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given id")
392 }
393 }

References GUM_ERROR, and nodeIdMap_.

Referenced by _groundRef_(), gum::prm::o3prmr::O3prmrInterpreter::checkObserve(), gum::prm::o3prmr::O3prmrInterpreter::checkQuery(), gum::prm::o3prmr::O3prmrInterpreter::checkUnobserve(), and gum::prm::PRMFactory< GUM_SCALAR >::incArray().

Here is the caller graph for this function:

◆ get() [6/6]

template<typename GUM_SCALAR>
INLINE const PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( NodeId id) const

Returns an PRMInstance given it's NodeId in the relational skeleton.

Exceptions
NotFoundRaised if no PRMInstance matches the given NodeId.

Definition at line 396 of file PRMSystem_tpl.h.

396 {
397 try {
398 return *(nodeIdMap_[id]);
399 } catch (NotFound const&) {
400 GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given id")
401 }
402 }

References GUM_ERROR, and nodeIdMap_.

◆ getArray()

template<typename GUM_SCALAR>
INLINE const Sequence< PRMInstance< GUM_SCALAR > * > & gum::prm::PRMSystem< GUM_SCALAR >::getArray ( const std::string & name) const

Returns the sequence of instances of a given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 478 of file PRMSystem_tpl.h.

478 {
479 try {
480 return *(arrayMap_[name].second);
481 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
482 }

References arrayMap_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ getArrayType() [1/2]

template<typename GUM_SCALAR>
INLINE PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType ( const std::string & name)

Returns the type of the given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 486 of file PRMSystem_tpl.h.

486 {
487 try {
488 return *(arrayMap_[name].first);
489 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
490 }

References arrayMap_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ getArrayType() [2/2]

template<typename GUM_SCALAR>
INLINE const PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType ( const std::string & name) const

Returns the type of the given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 494 of file PRMSystem_tpl.h.

494 {
495 try {
496 return *(arrayMap_[name].first);
497 } catch (NotFound const&) { GUM_ERROR(NotFound, "found no array matching the given name") }
498 }

References arrayMap_, GUM_ERROR, and gum::prm::PRMObject::name().

Here is the call graph for this function:

◆ groundedBN()

template<typename GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::groundedBN ( BayesNetFactory< GUM_SCALAR > & factory) const

Returns the grounded Bayesian network of this system.

Parameters
factoryThe factory used to build the grounded Bayesian network.

Definition at line 107 of file PRMSystem_tpl.h.

107 {
108 factory.startNetworkDeclaration();
109 factory.addNetworkProperty("name", name());
110 factory.endNetworkDeclaration();
111
112 // Adding nodes
114 _groundAttr_(*(iter.val()), factory);
115 }
116
117 // Adding arcs and filling CPTs
119 _groundRef_(*(iter.val()), factory);
120 }
121 }
iterator begin()
Returns an iterator over the instances in this system.
void _groundRef_(const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
Method which ground PRMReferenceSlot of an PRMInstance and add arcs in the IBayesNet.
void _groundAttr_(const PRMInstance< GUM_SCALAR > &instance, BayesNetFactory< GUM_SCALAR > &factory) const
Method which ground Atttributes and Aggregators of an PRMInstance.

References _groundAttr_(), gum::BayesNetFactory< GUM_SCALAR >::addNetworkProperty(), begin(), end(), gum::BayesNetFactory< GUM_SCALAR >::endNetworkDeclaration(), gum::prm::PRMObject::name(), and gum::BayesNetFactory< GUM_SCALAR >::startNetworkDeclaration().

Referenced by gum::O3prmBNReader< GUM_SCALAR >::_generateBN_(), and gum::prm::o3prmr::O3prmrInterpreter::generateInfEngine().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ instantiate()

template<typename GUM_SCALAR>
INLINE void gum::prm::PRMSystem< GUM_SCALAR >::instantiate ( )

Instantiate all the PRMInstance in this PRMSystem.

Definition at line 439 of file PRMSystem_tpl.h.

439 {
440 for (auto iter = begin(); iter != end(); ++iter) {
441 (*(iter.val())).instantiate();
442 }
443 }

References begin(), and end().

Referenced by gum::O3prmBNReader< GUM_SCALAR >::_generateBN_(), and gum::prm::PRMFactory< GUM_SCALAR >::endSystem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isArray()

template<typename GUM_SCALAR>
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isArray ( const std::string & name) const

Returns true if an array with the given name exists.

Definition at line 434 of file PRMSystem_tpl.h.

434 {
435 return arrayMap_.exists(name);
436 }

References arrayMap_, and gum::prm::PRMObject::name().

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::incArray(), and gum::prm::PRMFactory< GUM_SCALAR >::isArrayInCurrentSystem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isClass()

INLINE bool gum::prm::PRMObject::isClass ( const PRMObject & obj)
inlinestaticinherited

Returns true if obj_ptr is of type Class.

Definition at line 114 of file PRMObject.h.

114{ return obj.obj_type() == prm_type::CLASS; }

References PRMObject(), CLASS, and obj_type().

Referenced by gum::prm::PRMClass< GUM_SCALAR >::scope(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInstance() [1/2]

INLINE bool gum::prm::PRMObject::isInstance ( const PRMObject & obj)
inlinestaticinherited

Returns true if obj_ptr is of type PRMInstance.

Definition at line 122 of file PRMObject.h.

122 {
123 return obj.obj_type() == prm_type::INSTANCE;
124 }

References PRMObject(), INSTANCE, and obj_type().

Here is the call graph for this function:

◆ isInstance() [2/2]

template<typename GUM_SCALAR>
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isInstance ( const std::string & name) const

Returns true if an PRMInstance with the given name exists.

Definition at line 429 of file PRMSystem_tpl.h.

429 {
430 return nameMap_.exists(name);
431 }

References gum::prm::PRMObject::name(), and nameMap_.

Referenced by gum::prm::PRMFactory< GUM_SCALAR >::incArray().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isInstantiated()

template<typename GUM_SCALAR>
INLINE bool gum::prm::PRMSystem< GUM_SCALAR >::isInstantiated ( const PRMClass< GUM_SCALAR > & c) const

Returns true if the given Class<GUM_SCALAR> has at least one PRMInstance in this PRMSystem.

Definition at line 424 of file PRMSystem_tpl.h.

424 {
425 return instanceMap_.exists(const_cast< PRMClass< GUM_SCALAR >* >(&c));
426 }

References instanceMap_.

◆ isInterface()

INLINE bool gum::prm::PRMObject::isInterface ( const PRMObject & obj)
inlinestaticinherited

Returns true if obj_ptr is of type PRMInterface.

Definition at line 117 of file PRMObject.h.

117 {
118 return obj.obj_type() == prm_type::PRM_INTERFACE;
119 }

References PRMObject(), obj_type(), and PRM_INTERFACE.

Here is the call graph for this function:

◆ LEFT_CAST()

std::string gum::prm::PRMObject::LEFT_CAST ( )
inlinestaticinherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 90 of file PRMObject.h.

90{ return "("; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

◆ name() [1/2]

INLINE const std::string & gum::prm::PRMObject::name ( ) const
inherited

Returns the name of this object.

Definition at line 54 of file PRMObject_inl.h.

54{ return _name_; }
std::string _name_
Definition PRMObject.h:211

References _name_.

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAttribute< GUM_SCALAR >::PRMAttribute(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClass< GUM_SCALAR >::PRMClass(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElement< GUM_SCALAR >::PRMClassElement(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainer(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMFuncAttribute< GUM_SCALAR >::PRMFuncAttribute(), gum::prm::PRMInstance< GUM_SCALAR >::PRMInstance(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), gum::prm::PRMInterface< GUM_SCALAR >::PRMInterface(), PRMObject(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMParameter< GUM_SCALAR >::PRMParameter(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMSlotChain< double >::PRMSlotChain(), gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem(), gum::prm::__print_attribute__(), gum::prm::__print_instance__(), gum::prm::SVE< GUM_SCALAR >::_addDelayedVariable_(), gum::prm::PRMClass< GUM_SCALAR >::_addIOInterfaceFlags_(), gum::prm::PRMFactory< GUM_SCALAR >::_addParent_(), gum::prm::PRMInstance< GUM_SCALAR >::_addReferingInstance_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterface_(), gum::prm::PRMFactory< GUM_SCALAR >::_checkInterfaceImplementation_(), gum::prm::PRMClass< GUM_SCALAR >::_checkInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRawCPT_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterface_(), gum::prm::PRMClass< GUM_SCALAR >::_checkRefInterfaces_(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::_checkRuleCPTSumsTo1_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAggregates_(), gum::prm::PRMInstance< GUM_SCALAR >::_copyAttribute_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_(), gum::prm::PRMSystem< double >::_groundAgg_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_(), gum::prm::PRMSystem< double >::_groundTensor_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadParameter_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadReference_(), gum::prm::PRMInterface< GUM_SCALAR >::_overloadReferenceSlot_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::gspan::StrictSearch< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::StructuredInference< GUM_SCALAR >::_str_(), gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMInterface< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMFactory< GUM_SCALAR >::addAggregator(), gum::prm::PRMFormAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::addParent(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::prm::PRMClass< GUM_SCALAR >::completeInheritance(), gum::prm::PRMFormAttribute< GUM_SCALAR >::copy(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::copy(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMInstance< GUM_SCALAR >::exists(), gum::prm::PRMSystem< GUM_SCALAR >::exists(), gum::prm::o3prmr::O3prmrInterpreter::findAttributeName(), gum::prm::o3prmr::O3prmrInterpreter::findInstanceName(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClass< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInstance< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMInterface< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::get(), gum::prm::PRMSystem< GUM_SCALAR >::getArray(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMSystem< GUM_SCALAR >::getArrayType(), gum::prm::PRMFormAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::getCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::groundedBN(), gum::prm::PRMClass< GUM_SCALAR >::inheritAggregates(), gum::prm::PRMSystem< double >::instantiate(), gum::prm::PRMSystem< GUM_SCALAR >::isArray(), gum::prm::PRMClass< GUM_SCALAR >::isCastDescendant(), gum::prm::PRMSystem< GUM_SCALAR >::isInstance(), name(), gum::prm::PRMType::name(), gum::prm::PRMFormAttribute< GUM_SCALAR >::newFactory(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::newFactory(), operator!=(), gum::prm::PRMClass< GUM_SCALAR >::operator=(), operator==(), gum::prm::PRMType::operator==(), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMClassElementContainer< GUM_SCALAR >::operator[](), gum::prm::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainterConstIterator, gum::prm::PRMClassElementContainer< GUM_SCALAR >::setInputNode(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), gum::prm::PRMFactory< GUM_SCALAR >::startClass(), gum::prm::PRMFactory< GUM_SCALAR >::startInterface(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().

◆ name() [2/2]

INLINE void gum::prm::PRMObject::name ( const std::string & name)
inherited

Change the name of the PRM Object.

Warning
Don't do this unless you know what you are doing !

Definition at line 58 of file PRMObject_inl.h.

58{ _name_ = name; }

References _name_, and name().

Here is the call graph for this function:

◆ obj_type()

template<typename GUM_SCALAR>
INLINE PRMObject::prm_type gum::prm::PRMSystem< GUM_SCALAR >::obj_type ( ) const
virtual

Returns the PRM type of this object.

Implements gum::prm::PRMObject.

Definition at line 414 of file PRMSystem_tpl.h.

414 {
416 }

References gum::prm::PRMObject::SYSTEM.

◆ operator!=()

INLINE bool gum::prm::PRMObject::operator!= ( const PRMObject & obj) const
inherited

To PRMObject are equal if they have the same name (which is unique).

Definition at line 66 of file PRMObject_inl.h.

66{ return _name_ != obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ operator=()

template<typename GUM_SCALAR>
PRMSystem< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::operator= ( const PRMSystem< GUM_SCALAR > & from)
protecteddelete

Copy operator. Don't use it.

References PRMSystem().

Here is the call graph for this function:

◆ operator==()

INLINE bool gum::prm::PRMObject::operator== ( const PRMObject & obj) const
inherited

To PRMObject are equal if they have the same name (which is unique).

Definition at line 62 of file PRMObject_inl.h.

62{ return _name_ == obj.name(); }

References PRMObject(), _name_, and name().

Here is the call graph for this function:

◆ RIGHT_CAST()

std::string gum::prm::PRMObject::RIGHT_CAST ( )
inlinestaticinherited

Enumeration of the different types of objects handled by a PRM.

The "all" type is used to tell that we want any kind of PRMType (useful with iterators for example). No PRMObject will ever have "all" as type.

Definition at line 92 of file PRMObject.h.

92{ return ")"; }

Referenced by gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMAggregate< GUM_SCALAR >::PRMAggregate(), gum::prm::PRMFormAttribute< GUM_SCALAR >::PRMFormAttribute(), gum::prm::PRMReferenceSlot< GUM_SCALAR >::PRMReferenceSlot(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::PRMScalarAttribute(), gum::prm::PRMSlotChain< GUM_SCALAR >::PRMSlotChain(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), and gum::prm::decomposePath().

Here is the caller graph for this function:

◆ size()

template<typename GUM_SCALAR>
INLINE Size gum::prm::PRMSystem< GUM_SCALAR >::size ( ) const

Returns the number of PRMInstance in this PRMSystem.

Definition at line 419 of file PRMSystem_tpl.h.

419 {
420 return nodeIdMap_.size();
421 }

References nodeIdMap_.

◆ skeleton()

template<typename GUM_SCALAR>
INLINE const DiGraph & gum::prm::PRMSystem< GUM_SCALAR >::skeleton ( ) const

Returns the relation skeleton of this PRMSystem.

Definition at line 382 of file PRMSystem_tpl.h.

382 {
383 return skeleton_;
384 }

References skeleton_.

Member Data Documentation

◆ _name_

std::string gum::prm::PRMObject::_name_
privateinherited

◆ arrayMap_

template<typename GUM_SCALAR>
HashTable< std::string, model_pair > gum::prm::PRMSystem< GUM_SCALAR >::arrayMap_
protected

Mapping between arrays and their name. The first element of the pair is the type of the array.

Definition at line 293 of file PRMSystem.h.

Referenced by ~PRMSystem(), add(), addArray(), begin(), begin(), end(), end(), exists(), getArray(), getArrayType(), getArrayType(), and isArray().

◆ instanceMap_

template<typename GUM_SCALAR>
HashTable< PRMClass< GUM_SCALAR >*, Set< PRMInstance< GUM_SCALAR >* >* > gum::prm::PRMSystem< GUM_SCALAR >::instanceMap_
protected

Mapping between a class and all it's PRMInstance in this system.

Definition at line 284 of file PRMSystem.h.

Referenced by ~PRMSystem(), get(), and isInstantiated().

◆ nameMap_

template<typename GUM_SCALAR>
HashTable< std::string, PRMInstance< GUM_SCALAR >* > gum::prm::PRMSystem< GUM_SCALAR >::nameMap_
protected

The mapping between PRMInstance and their names.

Definition at line 281 of file PRMSystem.h.

Referenced by add(), exists(), get(), get(), and isInstance().

◆ nodeIdMap_

template<typename GUM_SCALAR>
NodeProperty< PRMInstance< GUM_SCALAR >* > gum::prm::PRMSystem< GUM_SCALAR >::nodeIdMap_
protected

The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem.

Definition at line 278 of file PRMSystem.h.

Referenced by PRMSystem(), begin(), begin(), end(), end(), get(), get(), get(), and size().

◆ skeleton_

template<typename GUM_SCALAR>
DiGraph gum::prm::PRMSystem< GUM_SCALAR >::skeleton_
protected

The relational skeleton of this PRMSystem.

Definition at line 274 of file PRMSystem.h.

Referenced by PRMSystem(), and skeleton().


The documentation for this class was generated from the following files: