aGrUM 3.0.0
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 (std::string_view name)
 Default constructor.
 ~PRMSystem () override
 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.
PRMObject::prm_type obj_type () const override
 Returns the PRM type of this object.
Size size () const
 Returns the number of PRMInstance in this PRMSystem.
bool exists (std::string_view 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 (std::string_view name) const
 Returns true if an PRMInstance with the given name exists.
bool isArray (std::string_view 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 (std::string_view name)
 Returns a reference over an PRMInstance given it's name.
const PRMInstance< GUM_SCALAR > & get (std::string_view 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 (std::string_view name) const
 Returns the sequence of instances of a given array.
PRMClassElementContainer< GUM_SCALAR > & getArrayType (std::string_view name)
 Returns the type of the given array.
const PRMClassElementContainer< GUM_SCALAR > & getArrayType (std::string_view name) const
 Returns the type of the given array.
NodeId add (std::string_view 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 (std::string_view 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 (std::string_view 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 (std::string_view 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, std::string_view 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 an 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 (std::string_view a)
 Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
const array_iteratorend (std::string_view a)
 Returns an iterator at the end of the Sequence of PRMInstance in the array named a.
const_array_iterator begin (std::string_view a) const
 Returns an iterator at the beginning of the Sequence of PRMInstance in the array named a;.
const const_array_iteratorend (std::string_view 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<GUM_Numeric GUM_SCALAR>
class gum::prm::PRMSystem< GUM_SCALAR >

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

Definition at line 72 of file PRMSystem.h.

Member Typedef Documentation

◆ array_iterator

template<GUM_Numeric 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 236 of file PRMSystem.h.

◆ const_array_iterator

template<GUM_Numeric 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 249 of file PRMSystem.h.

◆ const_iterator

template<GUM_Numeric 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 226 of file PRMSystem.h.

◆ iterator

template<GUM_Numeric 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 216 of file PRMSystem.h.

◆ model_pair

template<GUM_Numeric 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:994

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

Definition at line 290 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 90 of file PRMObject.h.

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

Constructor & Destructor Documentation

◆ PRMSystem() [1/2]

template<GUM_Numeric GUM_SCALAR>
gum::prm::PRMSystem< GUM_SCALAR >::PRMSystem ( std::string_view name)
explicit

Default constructor.

Definition at line 61 of file PRMSystem_tpl.h.

61 : PRMObject(name) {
63 }
PRMObject(std::string_view name)
Constructor.
Definition PRMObject.cpp:62
const std::string & name() const
Returns the name of this object.
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
Definition PRMSystem.h:72
PRMSystem(std::string_view 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<GUM_Numeric GUM_SCALAR>
gum::prm::PRMSystem< GUM_SCALAR >::~PRMSystem ( )
override

Destructor.

Definition at line 66 of file PRMSystem_tpl.h.

66 {
68
69 for (const auto& elt: *this)
70 delete elt.second;
71
72 for (const auto& elt: instanceMap_)
73 delete elt.second;
74
75 for (const auto& elt: arrayMap_)
76 delete elt.second.second;
77 }
HashTable< PRMClass< GUM_SCALAR > *, Set< PRMInstance< GUM_SCALAR > * > * > instanceMap_
Mapping between a class and all it's PRMInstance in this system.
Definition PRMSystem.h:286
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:295

References PRMSystem(), arrayMap_, and instanceMap_.

Here is the call graph for this function:

◆ PRMSystem() [2/2]

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

Copy constructor. Don't use it.

Definition at line 80 of file PRMSystem_tpl.h.

80 :
84 }
DiGraph skeleton_
The relational skeleton of this PRMSystem.
Definition PRMSystem.h:276
HashTable< std::string, PRMInstance< GUM_SCALAR > * > nameMap_
The mapping between PRMInstance and their names.
Definition PRMSystem.h:283
NodeProperty< PRMInstance< GUM_SCALAR > * > nodeIdMap_
The mapping between PRMInstance and their NodeId in the relational skeleton of this PRMSystem.
Definition PRMSystem.h:280

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

Here is the call graph for this function:

Member Function Documentation

◆ _groundAgg_()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_ ( const PRMClassElement< GUM_SCALAR > & elt,
std::string_view 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:76

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

Here is the call graph for this function:

◆ _groundAttr_()

template<GUM_Numeric 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 125 of file PRMSystem_tpl.h.

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

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<GUM_Numeric 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) {
273 factory.startParentsDeclaration(
274 std::format("{}.{}", instance.name(), elt.second->safeName()));
275
276 for (const auto par: instance.type().containerDag().parents(elt.second->id())) {
277 switch (instance.type().get(par).elt_type()) {
280 factory.addParent(
281 std::format("{}.{}", instance.name(), instance.get(par).safeName()));
282 break;
283 }
284
287 = static_cast< const PRMSlotChain< GUM_SCALAR >& >(instance.type().get(par))
288 .lastElt()
289 .safeName();
290
291 try {
292 for (const auto ref: instance.getInstances(par)) {
293 factory.addParent(std::format("{}.{}", ref->name(), parent_name));
294 }
295 } catch (NotFound const&) {
296 // No instances for this slotchain
297 }
298
299 break;
300 }
301
302 default :
303 break;
304 /* nothing to do by default */
305 }
306 }
307
308 factory.endParentsDeclaration();
309
310 // Checking if we need to ground the Tensor (only for class level
311 // attributes since
312 // aggregates Tensors are generated)
313 if (PRMClassElement< GUM_SCALAR >::isAttribute(instance.type().get(elt.second->safeName())))
315 }
316 }
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<GUM_Numeric 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 319 of file PRMSystem_tpl.h.

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

References gum::BijectionImplementation< T1, T2, Gen >::insert(), gum::prm::PRMObject::name(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMAttribute< GUM_SCALAR >::type(), gum::BayesNetFactory< GUM_SCALAR >::variable(), and gum::prm::PRMType::variable().

Here is the call graph for this function:

◆ add() [1/3]

template<GUM_Numeric 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 87 of file PRMSystem_tpl.h.

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

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:

◆ add() [2/3]

template<GUM_Numeric GUM_SCALAR>
NodeId gum::prm::PRMSystem< GUM_SCALAR >::add ( std::string_view 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 372 of file PRMSystem_tpl.h.

372 {
373 return add(array, &i);
374 }

References add().

Here is the call graph for this function:

◆ add() [3/3]

template<GUM_Numeric GUM_SCALAR>
NodeId gum::prm::PRMSystem< GUM_SCALAR >::add ( std::string_view 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 485 of file PRMSystem_tpl.h.

485 {
486 auto p_arr = arrayMap_.tryGet(array);
487 if (!p_arr) GUM_ERROR(NotFound, "found no array matching the given name")
488 if (i->type().isSubTypeOf(*(p_arr->first))) {
489 NodeId id = add(i);
490 p_arr->second->insert(i);
491 return id;
492 } else {
494 "the given Instance<GUM_SCALAR> is of an incorrect "
495 "Class<GUM_SCALAR> type");
496 }
497 }

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

Here is the call graph for this function:

◆ addArray()

template<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::addArray ( std::string_view 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 500 of file PRMSystem_tpl.h.

501 {
502 if (arrayMap_.exists(array)) {
503 GUM_ERROR(DuplicateElement, "an array '" << array << "' is already in this System")
504 }
505
506 arrayMap_.insert(
509 }
std::pair< PRMClassElementContainer< GUM_SCALAR > *, Sequence< PRMInstance< GUM_SCALAR > * > * > model_pair
Type for the pair of a Class<GUM_SCALAR> and the sequence of it's instantiation.
Definition PRMSystem.h:290

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<GUM_Numeric GUM_SCALAR>
PRMSystem< GUM_SCALAR >::iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( )

Returns an iterator over the instances in this system.

Definition at line 512 of file PRMSystem_tpl.h.

512 {
513 return nodeIdMap_.begin();
514 }

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<GUM_Numeric GUM_SCALAR>
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 522 of file PRMSystem_tpl.h.

522 {
523 return nodeIdMap_.begin();
524 }

References nodeIdMap_.

◆ begin() [3/4]

template<GUM_Numeric GUM_SCALAR>
PRMSystem< GUM_SCALAR >::array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( std::string_view 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 533 of file PRMSystem_tpl.h.

533 {
534 auto p = arrayMap_.tryGet(a);
535 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
536 return p->second->begin();
537 }
iterator begin()
Returns an iterator over the instances in this system.

References arrayMap_, and GUM_ERROR.

◆ begin() [4/4]

template<GUM_Numeric GUM_SCALAR>
PRMSystem< GUM_SCALAR >::const_array_iterator gum::prm::PRMSystem< GUM_SCALAR >::begin ( std::string_view 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 549 of file PRMSystem_tpl.h.

549 {
550 auto p = arrayMap_.tryGet(a);
551 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
552 return p->second->begin();
553 }

References arrayMap_, and GUM_ERROR.

◆ end() [1/4]

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

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

Definition at line 517 of file PRMSystem_tpl.h.

517 {
518 return nodeIdMap_.end();
519 }

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<GUM_Numeric GUM_SCALAR>
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 527 of file PRMSystem_tpl.h.

527 {
528 return nodeIdMap_.end();
529 }

References nodeIdMap_.

◆ end() [3/4]

template<GUM_Numeric GUM_SCALAR>
const PRMSystem< GUM_SCALAR >::array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( std::string_view 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 541 of file PRMSystem_tpl.h.

541 {
542 auto p = arrayMap_.tryGet(a);
543 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
544 return p->second->end();
545 }

References arrayMap_, and GUM_ERROR.

◆ end() [4/4]

template<GUM_Numeric GUM_SCALAR>
const PRMSystem< GUM_SCALAR >::const_array_iterator & gum::prm::PRMSystem< GUM_SCALAR >::end ( std::string_view 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 557 of file PRMSystem_tpl.h.

557 {
558 auto p = arrayMap_.tryGet(a);
559 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
560 return p->second->end();
561 }

References arrayMap_, and GUM_ERROR.

◆ enum2str()

INLINE std::string gum::prm::PRMObject::enum2str ( prm_type type)
staticinherited

Returns the string representation of a PRMObject.

Definition at line 75 of file PRMObject_inl.h.

75 {
76 switch (type) {
77 case prm_type::CLASS : return "PRMType::CLASS";
78
79 case prm_type::CLASS_ELT : return "PRMType::CLASS_ELT";
80
81 case prm_type::TYPE : return "PRMType::TYPE";
82
83 case prm_type::SYSTEM : return "PRMType::SYSTEM";
84
85 case prm_type::INSTANCE : return "PRMType::INSTANCE";
86
87 case prm_type::PRM_INTERFACE : return "PRMType::PRM_INTERFACE";
88
89 default : return "unknown";
90 }
91 }

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<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMSystem< GUM_SCALAR >::exists ( std::string_view name) const

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

Definition at line 564 of file PRMSystem_tpl.h.

564 {
565 return nameMap_.exists(name) || arrayMap_.exists(name);
566 }

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<GUM_Numeric GUM_SCALAR>
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 453 of file PRMSystem_tpl.h.

453 {
454 auto p = instanceMap_.tryGet(const_cast< PRMClass< GUM_SCALAR >* >(&type));
455 if (!p) GUM_ERROR(NotFound, "the given Class<GUM_SCALAR> has no instantiation in this System")
456 return *(*p);
457 }

References GUM_ERROR, and instanceMap_.

◆ get() [2/6]

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

Returns the relation skeleton of this PRMSystem.

Definition at line 396 of file PRMSystem_tpl.h.

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

References GUM_ERROR, and nodeIdMap_.

◆ get() [3/6]

template<GUM_Numeric GUM_SCALAR>
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 382 of file PRMSystem_tpl.h.

382 {
383 auto p = nodeIdMap_.tryGet(id);
384 if (!p) GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given id")
385 return *(*p);
386 }

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() [4/6]

template<GUM_Numeric GUM_SCALAR>
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 389 of file PRMSystem_tpl.h.

389 {
390 auto p = nodeIdMap_.tryGet(id);
391 if (!p) GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given id")
392 return *(*p);
393 }

References GUM_ERROR, and nodeIdMap_.

◆ get() [5/6]

template<GUM_Numeric GUM_SCALAR>
PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( std::string_view name)

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

Exceptions
NotFoundRaised if the no PRMInstance matches name.

Definition at line 437 of file PRMSystem_tpl.h.

437 {
438 auto p = nameMap_.tryGet(name);
439 if (!p) GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given name")
440 return *(*p);
441 }

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

Here is the call graph for this function:

◆ get() [6/6]

template<GUM_Numeric GUM_SCALAR>
const PRMInstance< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::get ( std::string_view name) const

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

Exceptions
NotFoundRaised if the no PRMInstance matches name.

Definition at line 444 of file PRMSystem_tpl.h.

444 {
445 auto p = nameMap_.tryGet(name);
446 if (!p) GUM_ERROR(NotFound, "found no Instance<GUM_SCALAR> matching the given name")
447 return *(*p);
448 }

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

Here is the call graph for this function:

◆ getArray()

template<GUM_Numeric GUM_SCALAR>
const Sequence< PRMInstance< GUM_SCALAR > * > & gum::prm::PRMSystem< GUM_SCALAR >::getArray ( std::string_view name) const

Returns the sequence of instances of a given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 462 of file PRMSystem_tpl.h.

462 {
463 auto p = arrayMap_.tryGet(name);
464 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
465 return *(p->second);
466 }

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

Here is the call graph for this function:

◆ getArrayType() [1/2]

template<GUM_Numeric GUM_SCALAR>
PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType ( std::string_view name)

Returns the type of the given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 470 of file PRMSystem_tpl.h.

470 {
471 auto p = arrayMap_.tryGet(name);
472 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
473 return *(p->first);
474 }

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

Here is the call graph for this function:

◆ getArrayType() [2/2]

template<GUM_Numeric GUM_SCALAR>
const PRMClassElementContainer< GUM_SCALAR > & gum::prm::PRMSystem< GUM_SCALAR >::getArrayType ( std::string_view name) const

Returns the type of the given array.

Exceptions
NotFoundRaised if no array matches name.

Definition at line 478 of file PRMSystem_tpl.h.

478 {
479 auto p = arrayMap_.tryGet(name);
480 if (!p) GUM_ERROR(NotFound, "found no array matching the given name")
481 return *(p->first);
482 }

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

Here is the call graph for this function:

◆ groundedBN()

template<GUM_Numeric 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 108 of file PRMSystem_tpl.h.

108 {
109 factory.startNetworkDeclaration();
110 factory.addNetworkProperty("name", name());
111 factory.endNetworkDeclaration();
112
113 // Adding nodes
115 _groundAttr_(*(iter.val()), factory);
116 }
117
118 // Adding arcs and filling CPTs
120 _groundRef_(*(iter.val()), factory);
121 }
122 }
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<GUM_Numeric GUM_SCALAR>
void gum::prm::PRMSystem< GUM_SCALAR >::instantiate ( )

Instantiate all the PRMInstance in this PRMSystem.

Definition at line 430 of file PRMSystem_tpl.h.

430 {
431 for (auto iter = begin(); iter != end(); ++iter) {
432 (*(iter.val())).instantiate();
433 }
434 }

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<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMSystem< GUM_SCALAR >::isArray ( std::string_view name) const

Returns true if an array with the given name exists.

Definition at line 425 of file PRMSystem_tpl.h.

425 {
426 return arrayMap_.exists(name);
427 }

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)
staticinherited

Returns true if obj_ptr is of type Class.

Definition at line 93 of file PRMObject_inl.h.

93 {
94 return obj.obj_type() == prm_type::CLASS;
95 }

References PRMObject().

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)
staticinherited

Returns true if obj_ptr is of type PRMInstance.

Definition at line 101 of file PRMObject_inl.h.

101 {
102 return obj.obj_type() == prm_type::INSTANCE;
103 }

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

Here is the call graph for this function:

◆ isInstance() [2/2]

template<GUM_Numeric GUM_SCALAR>
bool gum::prm::PRMSystem< GUM_SCALAR >::isInstance ( std::string_view name) const

Returns true if an PRMInstance with the given name exists.

Definition at line 420 of file PRMSystem_tpl.h.

420 {
421 return nameMap_.exists(name);
422 }

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<GUM_Numeric GUM_SCALAR>
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 415 of file PRMSystem_tpl.h.

415 {
416 return instanceMap_.exists(const_cast< PRMClass< GUM_SCALAR >* >(&c));
417 }

References instanceMap_.

◆ isInterface()

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

Returns true if obj_ptr is of type PRMInterface.

Definition at line 97 of file PRMObject_inl.h.

97 {
98 return obj.obj_type() == prm_type::PRM_INTERFACE;
99 }

◆ LEFT_CAST()

INLINE std::string gum::prm::PRMObject::LEFT_CAST ( )
staticinherited

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 71 of file PRMObject_inl.h.

71{ 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 57 of file PRMObject_inl.h.

57{ return _name_; }
std::string _name_
Definition PRMObject.h:193

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::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::PRMSlotChain< GUM_SCALAR >::_copyLastElt_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundAgg_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundRef_(), gum::prm::PRMSystem< GUM_SCALAR >::_groundTensor_(), gum::prm::PRMSystem< double >::_groundTensor_(), gum::prm::PRMClass< GUM_SCALAR >::_inheritClass_(), gum::prm::PRMClass< GUM_SCALAR >::_overloadAttribute_(), gum::prm::PRMInterface< 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::PRMAggregate< GUM_SCALAR >::getCastDescendant(), 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< 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!=(), 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::PRMInterface< GUM_SCALAR >::operator[](), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMInterface< GUM_SCALAR >::overload(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::PRMClassElementContainterConstIterator, gum::prm::PRMFormAttribute< GUM_SCALAR >::setAsCastDescendant(), gum::prm::PRMScalarAttribute< GUM_SCALAR >::setAsCastDescendant(), 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 ( std::string_view name)
inherited

Change the name of the PRM Object.

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

Definition at line 61 of file PRMObject_inl.h.

61{ _name_ = name; }

References _name_, and name().

Here is the call graph for this function:

◆ obj_type()

template<GUM_Numeric GUM_SCALAR>
PRMObject::prm_type gum::prm::PRMSystem< GUM_SCALAR >::obj_type ( ) const
overridevirtual

Returns the PRM type of this object.

Implements gum::prm::PRMObject.

Definition at line 405 of file PRMSystem_tpl.h.

405 {
407 }

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 69 of file PRMObject_inl.h.

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

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

Here is the call graph for this function:

◆ operator=()

template<GUM_Numeric 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 65 of file PRMObject_inl.h.

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

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

Here is the call graph for this function:

◆ RIGHT_CAST()

INLINE std::string gum::prm::PRMObject::RIGHT_CAST ( )
staticinherited

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 73 of file PRMObject_inl.h.

73{ 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<GUM_Numeric GUM_SCALAR>
Size gum::prm::PRMSystem< GUM_SCALAR >::size ( ) const

Returns the number of PRMInstance in this PRMSystem.

Definition at line 410 of file PRMSystem_tpl.h.

410 {
411 return nodeIdMap_.size();
412 }

References nodeIdMap_.

◆ skeleton()

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

Returns the relation skeleton of this PRMSystem.

Definition at line 377 of file PRMSystem_tpl.h.

377 {
378 return skeleton_;
379 }

References skeleton_.

Member Data Documentation

◆ _name_

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

Definition at line 193 of file PRMObject.h.

Referenced by PRMObject(), PRMObject(), PRMObject(), name(), name(), operator!=(), operator=(), and operator==().

◆ arrayMap_

template<GUM_Numeric 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 295 of file PRMSystem.h.

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

◆ instanceMap_

template<GUM_Numeric 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 286 of file PRMSystem.h.

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

◆ nameMap_

template<GUM_Numeric 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 283 of file PRMSystem.h.

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

◆ nodeIdMap_

template<GUM_Numeric 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 280 of file PRMSystem.h.

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

◆ skeleton_

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

The relational skeleton of this PRMSystem.

Definition at line 276 of file PRMSystem.h.

Referenced by PRMSystem(), and skeleton().


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