![]() |
aGrUM
0.16.0
|
Factory which builds a PRM<GUM_SCALAR>. More...
#include <PRMType.h>
Public Member Functions | |
Constructors & destructor | |
PRMFactory () | |
Default constructor. More... | |
PRMFactory (PRM< GUM_SCALAR > *prm) | |
This constructor let you set on which PRM instance the factory works. More... | |
PRMFactory (const PRMFactory &from)=delete | |
Copy constructor. Don't use it. More... | |
PRMFactory & | operator= (const PRMFactory &from)=delete |
Copy operator. Don't use it. More... | |
virtual | ~PRMFactory () |
Destructor. More... | |
Getters & Setters | |
PRM< GUM_SCALAR > * | prm () const |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
virtual PRMObject::prm_type | currentType () const override |
virtual PRMObject * | getCurrent () override |
virtual const PRMObject * | getCurrent () const override |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
virtual PRMObject * | closeCurrent () override |
Close current object being built. More... | |
virtual std::string | currentPackage () const override |
PRMClass< GUM_SCALAR > & | retrieveClass (const std::string &name) |
Returns a reference over a Class<GUM_SCALAR> given its name. More... | |
PRMType & | retrieveType (const std::string &name) |
Returns a reference over a PRMType given its name. More... | |
PRMType & | retrieveCommonType (const std::vector< PRMClassElement< GUM_SCALAR > * > &elts) |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory. More... | |
Package construction methods. | |
virtual void | pushPackage (const std::string &name) override |
Define the current package. More... | |
virtual std::string | popPackage () override |
Pop the current package from the package stack. More... | |
virtual void | addImport (const std::string &name) override |
Add an import for namespace lookup. More... | |
PRMType construction methods. | |
virtual void | startDiscreteType (const std::string &name, std::string super="") override |
Start a discrete subtype declaration. More... | |
virtual void | addLabel (const std::string &l, std::string ext="") override |
Add a label to the current discrete type. More... | |
virtual void | endDiscreteType () override |
End the current discrete type declaration. More... | |
virtual void | startDiscretizedType (const std::string &name) override |
Start a discretized type declaration. More... | |
virtual void | addTick (double tick) override |
Add a tick to the current discretized type. More... | |
virtual void | endDiscretizedType () override |
End the current discretized type declaration. More... | |
virtual void | addRangeType (const std::string &name, long minVal, long maxVal) override |
Add a range variable type declaration. More... | |
several checks for parsers | |
virtual bool | isClassOrInterface (const std::string &type) const override |
virtual bool | isArrayInCurrentSystem (const std::string &name) const override |
Class<GUM_SCALAR> construction models. | |
virtual void | startClass (const std::string &c, const std::string &ext="", const Set< std::string > *implements=nullptr, bool delayInheritance=false) override |
Tells the factory that we start a class declaration. More... | |
virtual void | continueClass (const std::string &c) override |
Continue the declaration of a class. More... | |
virtual void | endClass (bool checkImplementations=true) override |
Tells the factory that we finished a class declaration. More... | |
PRMInterface<GUM_SCALAR> construction models. | |
virtual void | startInterface (const std::string &i, const std::string &ext="", bool delayInheritance=false) override |
Tells the factory that we start an interface declaration. More... | |
virtual void | continueInterface (const std::string &name) override |
Continue the declaration of an interface. More... | |
virtual void | addAttribute (const std::string &type, const std::string &name) override |
Add an attribute to an interface. More... | |
virtual void | endInterface () override |
Tells the factory that we finished an interface declaration. More... | |
Attributes construction methods. | |
virtual void | addAttribute (PRMAttribute< GUM_SCALAR > *attr) |
Add an already created attribute to the current class. More... | |
virtual void | startAttribute (const std::string &type, const std::string &name, bool scalar_atttr=false) override |
Tells the factory that we start an attribute declaration. More... | |
virtual void | continueAttribute (const std::string &name) override |
Continues the declaration of an attribute. More... | |
virtual void | addParent (const std::string &name) override |
Tells the factory that we add a parent to the current declared attribute. More... | |
void | setRawCPFByLines (const std::vector< GUM_SCALAR > &array) |
Gives the factory the CPF in its raw form. More... | |
void | setRawCPFByColumns (const std::vector< GUM_SCALAR > &array) |
Gives the factory the CPF in its raw form. More... | |
virtual void | setCPFByRule (const std::vector< std::string > &labels, const std::vector< GUM_SCALAR > &values) |
Fills the CPF using a rule. More... | |
virtual void | setCPFByRule (const std::vector< std::string > &labels, const std::vector< std::string > &values) override |
Fills the CPF using a rule and gum::Formula. More... | |
virtual void | setRawCPFByFloatLines (const std::vector< float > &array) override |
Gives the factory the CPF in its raw form. More... | |
virtual void | setRawCPFByFloatColumns (const std::vector< float > &array) override |
Gives the factory the CPF in its raw form. More... | |
virtual void | setRawCPFByColumns (const std::vector< std::string > &array) override |
Gives the factory the CPF in its raw form use gum::Formula. More... | |
virtual void | setRawCPFByLines (const std::vector< std::string > &array) override |
Gives the factory the CPF in its raw form using gum::Formula. More... | |
virtual void | setCPFByFloatRule (const std::vector< std::string > &labels, const std::vector< float > &values) override |
Fills the CPF using a rule. More... | |
virtual void | endAttribute () override |
Tells the factory that we finished declaring an attribute. More... | |
Parameters construction methods. | |
void | addParameter (const std::string &type, const std::string &name, double value) override |
Add a parameter to the current class with a default value. More... | |
Aggregator and function construction methods. | |
virtual void | addAggregator (const std::string &name, const std::string &agg_type, const std::vector< std::string > &chains, const std::vector< std::string > ¶ms, std::string type="") override |
Add an aggregator in the current declared class. More... | |
void | startAggregator (const std::string &name, const std::string &agg_type, const std::string &rv_type, const std::vector< std::string > ¶ms) |
Start an aggregator declaration. More... | |
void | continueAggregator (const std::string &name) |
Conitnues an aggregator declaration. More... | |
void | endAggregator () |
Finishes an aggregate declaration. More... | |
virtual void | addNoisyOrCompound (const std::string &name, const std::vector< std::string > &chains, const std::vector< float > &numbers, float leak, const std::vector< std::string > &label) override |
Add a compound noisy-or as an PRMAttribute<GUM_SCALAR> to the current Class<GUM_SCALAR>. More... | |
PRMReferenceSlot<GUM_SCALAR> construction methods. | |
virtual void | addReferenceSlot (const std::string &type, const std::string &name, bool isArray) override |
Tells the factory that we started declaring a slot. More... | |
Systems constructions methods. | |
virtual void | startSystem (const std::string &name) override |
Tells the factory that we started declaring a model. More... | |
virtual void | endSystem () override |
Tells the factory that we finished declaring a model. More... | |
virtual void | addInstance (const std::string &type, const std::string &name) override |
Add an instance to the model. More... | |
void | addInstance (const std::string &type, const std::string &name, const HashTable< std::string, double > ¶ms) override |
Add an instance with params as values of type's parameters. More... | |
virtual void | addArray (const std::string &type, const std::string &name, Size size) override |
Creates an array with the given number of instances of the given type. More... | |
virtual void | incArray (const std::string &l_i, const std::string &r_i) override |
Add an instance to an array. More... | |
virtual void | setReferenceSlot (const std::string &left_instance, const std::string &left_reference, const std::string &right_instance) override |
Instantiate a reference in the current model. More... | |
virtual void | setReferenceSlot (const std::string &l_i, const std::string &r_i) override |
Instantiate a reference in the current model. More... | |
Factory which builds a PRM<GUM_SCALAR>.
The Factory always create one PRM<GUM_SCALAR> which is not deleted with the factory, so be very careful to delete the PRM<GUM_SCALAR> built by this factory.
The factory does not allow any sequence of calls, if you call a method when the factory is in an incoherent state it will raise a FactoryInvalidState exception.
Keep in mind that most methods could raise gum::FatalError if something unexpected happens, since the framework is meant to evolve it is possible.
INLINE gum::prm::PRMFactory< GUM_SCALAR >::PRMFactory | ( | ) |
Default constructor.
Definition at line 1359 of file PRMFactory_tpl.h.
INLINE gum::prm::PRMFactory< GUM_SCALAR >::PRMFactory | ( | PRM< GUM_SCALAR > * | prm | ) |
This constructor let you set on which PRM instance the factory works.
Definition at line 1365 of file PRMFactory_tpl.h.
|
delete |
Copy constructor. Don't use it.
|
virtual |
Destructor.
Definition at line 1371 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__namespaces.
|
private |
Adds a instance to the current model.
Definition at line 1749 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMInstance< GUM_SCALAR >::add(), and gum::prm::PRMObject::SYSTEM.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addInstance().
|
private |
Add a parent to an attribute.
Definition at line 251 of file PRMFactory_tpl.h.
References gum::prm::PRMClassElementContainer< GUM_SCALAR >::add(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::addArc(), gum::prm::PRMClassElement< GUM_SCALAR >::elt_type(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), GUM_ERROR, gum::prm::PRMSlotChain< GUM_SCALAR >::isMultiple(), and gum::prm::PRMObject::name().
|
private |
Add a parent to an aggregate.
Definition at line 620 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::addArc(), gum::prm::PRMAggregate< GUM_SCALAR >::agg_type(), GUM_ERROR, gum::prm::PRMAggregate< GUM_SCALAR >::hasLabel(), gum::prm::PRMAggregate< GUM_SCALAR >::labelValue(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), and gum::prm::PRMAggregate< GUM_SCALAR >::setLabel().
|
private |
Adds __prefix to str iff __prefix != "".
Definition at line 1766 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__packages.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addRangeType(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscretizedType(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().
|
private |
Builds all Aggregates CPF in the given model. This must be called after all the slot chains have been generated.
|
private |
This methods build a PRMSlotChain<GUM_SCALAR> given a starting element and a string.
Definition at line 958 of file PRMFactory_tpl.h.
References gum::SequenceImplementation< Key, Alloc, std::is_scalar< Key >::value >::back(), gum::prm::decomposePath(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), gum::SequenceImplementation< Key, Alloc, std::is_scalar< Key >::value >::insert(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::setOutputNode(), gum::SequenceImplementation< Key, Alloc, std::is_scalar< Key >::value >::size(), and gum::prm::PRMReferenceSlot< GUM_SCALAR >::slotType().
|
private |
Builds all PRMSlotChain<GUM_SCALAR><PRMInstance<GUM_SCALAR>> in the given model.
OperationNotAllowed | If reference slots are left un affected |
|
private |
Check if c implements correctly all his interfaces.
Definition at line 106 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::get(), GUM_ERROR, gum::prm::PRMClass< GUM_SCALAR >::implements(), gum::prm::PRMObject::name(), and gum::prm::PRMReferenceSlot< GUM_SCALAR >::slotType().
|
private |
Return a pointer on a PRMObject at __stack.size() - i position after checking the type of the object given obj_type.
FactoryInvalidState | Raised if the stack isn't consistent with the |
Definition at line 1779 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, GUM_ERROR, and gum::prm::PRMObject::obj_type().
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addInstance(), gum::prm::PRMFactory< GUM_SCALAR >::addAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::addLabel(), gum::prm::PRMFactory< GUM_SCALAR >::addTick(), gum::prm::PRMFactory< GUM_SCALAR >::endAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::prm::PRMFactory< GUM_SCALAR >::endInterface(), gum::prm::PRMFactory< GUM_SCALAR >::endSystem(), gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByColumns(), and gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByLines().
|
private |
Adds __prefix to str iff __prefix != "".
Definition at line 1814 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::prm::PRMClassElement< GUM_SCALAR >::elt_type(), and GUM_ERROR.
|
private |
Adds __prefix to str iff __prefix != "".
Definition at line 1797 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::prm::PRMObject::CLASS, GUM_ERROR, gum::prm::PRMObject::obj_type(), and gum::prm::PRMObject::PRM_INTERFACE.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::continueAttribute(), and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().
|
private |
Decompose a string in v using dots ('.') as delimiters.
|
private |
Instantiate a slot chain in the given instance.
|
private |
Returns a pointer on a class given it's name. Used when building models, meaning that the class name can either be local (need to add the current prefix) or global (no prefix needed).
NotFound | If no class matching the name is found. |
Definition at line 1255 of file PRMFactory_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addInstance(), gum::prm::PRMFactory< GUM_SCALAR >::isClassOrInterface(), and gum::prm::PRMFactory< GUM_SCALAR >::retrieveClass().
|
private |
Retrieve the common PRMType of a vector of PRMClassElement<GUM_SCALAR>.
The vector elts must only contains PRMClassElement<GUM_SCALAR> with a PRMType, i.e. PRMAttribute<GUM_SCALAR>, PRMAggregate and PRMSlotChain<GUM_SCALAR>. If not a WrongClassElement is raised.
A common PRMType is PRMType t such as t.isSuperTypeOf(elts[i]) for 0 < i < elts.size(), where elts is a PRMType container.
elts | A vector of PRMClassElement<GUM_SCALAR>. |
WrongClassElement | Raised if elts contains a PRMClassElement<GUM_SCALAR> without a PRMType. |
NotFound | Raised if there exists no common super type of all PRMClassElement<GUM_SCALAR> in elts. |
Definition at line 1062 of file PRMFactory_tpl.h.
References gum::HashTable< Key, Val, Alloc >::exists(), GUM_ERROR, gum::HashTable< Key, Val, Alloc >::insert(), and gum::Variable::name().
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::retrieveCommonType().
|
private |
Retrieve inputs for an PRMAggregate.
The vector chains contains names of the PRMAggregate inputs. If a name does not match an existing PRMClassElement<GUM_SCALAR> in c, then a call to PRMFactory::__buildSlotChains() is made. Such created PRMSlotChain<GUM_SCALAR> are added to c.
c | The class in which the PRMAggregate is defined. |
chains | Vector of the PRMAggregate inputs names. |
inputs | Vector filled with the PRMClassElement<GUM_SCALAR> matching the names in chains. |
NotFound | Raised if a name in chains does not match a legal PRMSlotChain<GUM_SCALAR> or an existing PRMClassElement<GUM_SCALAR> in c. |
Definition at line 1002 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMSlotChain< GUM_SCALAR >::chain(), gum::prm::PRMClass< GUM_SCALAR >::get(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::isSlotChain(), gum::prm::PRMSlotChain< GUM_SCALAR >::lastElt(), and gum::Variable::name().
|
private |
Fill seq with the sequence of instance build using inst as the instantiation of sc->__class and seeking each instantiation of reference in sc.
|
private |
Returns a pointer on an interface given it's name. Used when building models, meaning that the interface name can either be local (need to add the current prefix) or global (no prefix needed).
NotFound | If no class matching the name is found. |
Definition at line 1305 of file PRMFactory_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::isClassOrInterface().
|
private |
Returns a pointer on a PRMType given it's name. Since the type can be given either with it's local name (without the prefix), full name (with the prefix) or can come from an import unit, or maybe one day with a using declaration we need some processing to find it.
The following precedences on finding the name is used:
OperationNotAllowed | If the type is undeclared. |
Definition at line 1187 of file PRMFactory_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::retrieveType(), gum::prm::PRMFactory< GUM_SCALAR >::startAttribute(), and gum::prm::PRMFactory< GUM_SCALAR >::startDiscreteType().
|
private |
Returns the inheritance depth of a PRMType.
This used by PRMFactory::__retrieveCommonType. This returns 0 if t does not have a super type.
t | The PRMType for which we compute its depth. |
Definition at line 1837 of file PRMFactory_tpl.h.
|
overridevirtual |
Add an aggregator in the current declared class.
If at least one parent of an aggregator is a PRMSlotChain<GUM_SCALAR>, then all of it's parents must be PRMSlotChain<GUM_SCALAR>. When an aggregator parents are only composed of PRMAttribute<GUM_SCALAR> and PRMAggregate, then it is directly added as an PRMAttribute<GUM_SCALAR> to it's Class<GUM_SCALAR>.
name | The name of this aggregator. |
agg_type | The name of the aggregator type of this aggregator. |
chains | The set of chains on which this aggregate applies. |
params | The list of parameters for this aggregator. |
type | Some aggregators have a user defined type, use this parameter to define it. |
OperationNotAllowed | Raised if one or more parameters misses or are not correct. |
WrongType | Raised if the aggregator's type or one or more of the chains are not of the good type. |
Implements gum::prm::IPRMFactory.
Definition at line 682 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::addArc(), gum::prm::PRMAggregate< GUM_SCALAR >::buildImpl(), gum::prm::PRMObject::CLASS, GUM_ERROR, gum::prm::PRMAggregate< GUM_SCALAR >::label(), gum::prm::PRMObject::name(), gum::prm::PRMClass< GUM_SCALAR >::overload(), gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMAggregate< GUM_SCALAR >::str2enum(), and gum::prm::PRMAggregate< GUM_SCALAR >::type().
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), and gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster().
|
overridevirtual |
Creates an array with the given number of instances of the given type.
PRMInstance<GUM_SCALAR> are name using "name" as prefix and adding the suffix "[i]", with "i" being the position of the instance in the array.
Implements gum::prm::IPRMFactory.
Definition at line 875 of file PRMFactory_tpl.h.
References gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::addArray(), and gum::prm::PRMObject::SYSTEM.
Referenced by gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::__addInstances().
|
overridevirtual |
Add an attribute to an interface.
Implements gum::prm::IPRMFactory.
Definition at line 1589 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::endAttribute(), gum::prm::PRMObject::PRM_INTERFACE, and gum::prm::PRMFactory< GUM_SCALAR >::startAttribute().
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateInterfaces(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateInterfaces(), and gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildElements().
|
virtual |
Add an already created attribute to the current class.
Use this method when you must add functions, such as Noisy-Or.
Use this method when you need to add functions, such as Noisy-Or. The attribute CPT is checked for parents and arcs will be added using the DiscreteVariable pointers, thus be careful to use those of the attributes, aggregates and slotchains of the current class. gum::prm::Class<GUM_SCALAR>::insertArc() will be called for each found parent of attr, so you should overload gum::prm::PRMAttribute<GUM_SCALAR>::addParent() to prevent duplication errors. Such class exists: gum::prm::PRMFuncAttribute .
The pointer is given to the class, so do not worry about deleting it.
attr | The attribute added to the current class. |
NotFound | Raised if one of the DiscreteVariable in attr CPT does not match any PRMClassElement<GUM_SCALAR> in this. |
Definition at line 225 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMClass< GUM_SCALAR >::addArc(), gum::prm::PRMObject::CLASS, gum::prm::PRMClassElementContainer< GUM_SCALAR >::containerDag(), gum::prm::PRMAttribute< GUM_SCALAR >::cpf(), gum::SequenceImplementation< Key, Alloc, std::is_scalar< Key >::value >::exists(), gum::prm::PRMClass< GUM_SCALAR >::get(), GUM_ERROR, gum::prm::PRMClassElement< GUM_SCALAR >::safeName(), gum::prm::PRMAttribute< GUM_SCALAR >::type(), and gum::prm::PRMType::variable().
|
overridevirtual |
Add an import for namespace lookup.
When loading a module, you should push all import declarations using this method. The order in which you add imports will impact name resolution (first found, first used).
Imports are sync with packages: when you push a new package a new empty list of imports is added. When you pop a package the current list of imports is discarded and the previous one is restored.
name | The name of the package for all further objects. |
Implements gum::prm::IPRMFactory.
Definition at line 1874 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__namespaces, and GUM_ERROR.
|
overridevirtual |
Add an instance to the model.
Implements gum::prm::IPRMFactory.
Definition at line 1667 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addInstance(), and gum::prm::PRMFactory< GUM_SCALAR >::__retrieveClass().
Referenced by gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::__addInstances(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateSystem(), and gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateSystem().
|
overridevirtual |
Add an instance with params as values of type's parameters.
Implements gum::prm::IPRMFactory.
Definition at line 1682 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addInstance(), gum::prm::PRMFactory< GUM_SCALAR >::__packages, gum::prm::PRMFactory< GUM_SCALAR >::__retrieveClass(), gum::prm::PRMFactory< GUM_SCALAR >::addParameter(), gum::HashTable< Key, Val, Alloc >::empty(), gum::prm::PRMFactory< GUM_SCALAR >::endClass(), GUM_ERROR, gum::HashTable< Key, Val, Alloc >::insert(), and gum::prm::PRMFactory< GUM_SCALAR >::startClass().
|
overridevirtual |
Add a label to the current discrete type.
l | The label value. |
ext | The super type label for which l is an extension. |
OperationNotAllowed | Raised if the current type does not have a super type, see PRMFactory::addLabel(const std::string&). |
DuplicateElement | Raised if a label with the same value already exists. |
NotFound | Raised if ext does not match any label in the current type's super type. |
Implements gum::prm::IPRMFactory.
Definition at line 1442 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::LabelizedVariable::addLabel(), gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::DiscreteVariable::label(), and gum::prm::PRMObject::TYPE.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildTypes(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateType(), and gum::prm::LayerGenerator< GUM_SCALAR >::__generateType().
|
overridevirtual |
Add a compound noisy-or as an PRMAttribute<GUM_SCALAR> to the current Class<GUM_SCALAR>.
The type of a noisy-or must be a boolean.
name | the name of the PRMAttribute<GUM_SCALAR> added as a noisy-or. |
chains | the list of parents of the noisy-or. |
numbers | the list of weights for each parent. Can consist of only one value which will be applied to all the parents. |
leak | the leak |
label | the label on which the noisy-or applies, can be an empty string (the noisy-or will behave as if chains are all booleans). |
NotFound | Raised if one of the chains or the label is not found. |
FactoryInvalidState | Raised if a Class<GUM_SCALAR> is not the current declared PRMObject. |
OperationNotAllowed | Raised if for some reasons the parameters are invalid. |
Implements gum::prm::IPRMFactory.
Definition at line 1117 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMClassElement< GUM_SCALAR >::cast(), gum::MultiDimICIModel< GUM_SCALAR >::causalWeight(), gum::prm::PRMObject::CLASS, gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMClass< GUM_SCALAR >::get(), and GUM_ERROR.
|
overridevirtual |
Add a parameter to the current class with a default value.
A parameter with a default value is an PRMAttribute<GUM_SCALAR> (aka mutable PRMAttribute<GUM_SCALAR>) with no parents and with a CPF filled with 1.
type | The type of this parameter. |
name | The name of this parameter. |
value | The label used as default value for this parameter. |
Implements gum::prm::IPRMFactory.
Definition at line 547 of file PRMFactory_tpl.h.
References gum::prm::PRMObject::CLASS.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__addParameters(), and gum::prm::PRMFactory< GUM_SCALAR >::addInstance().
|
overridevirtual |
Tells the factory that we add a parent to the current declared attribute.
The name can refer to an already declared attribute or aggregate of the same class. It can also be a slot chain only if there is no multiple reference in it.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 308 of file PRMFactory_tpl.h.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAggregates(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAttribute(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), and gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster().
|
overridevirtual |
Add a range variable type declaration.
name | The variable's name |
minVal | The variable's lower bound. |
maxVal | The variable's upper bound. |
DuplicateElement | Raised if an object with the same name already exists. |
OperationNotAllowed | Raised if the range variable is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1560 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addPrefix(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, and GUM_ERROR.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildIntTypes().
|
overridevirtual |
Tells the factory that we started declaring a slot.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 850 of file PRMFactory_tpl.h.
References gum::prm::PRMClassElementContainer< GUM_SCALAR >::add(), GUM_ERROR, and gum::prm::PRMClassElementContainer< GUM_SCALAR >::overload().
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__addReferenceSlots(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateInterfaces(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateInterfaces(), and gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildElements().
|
overridevirtual |
Add a tick to the current discretized type.
tick | The tick value. |
Implements gum::prm::IPRMFactory.
Definition at line 1525 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::DiscretizedVariable< T_TICKS >::addTick(), GUM_ERROR, and gum::prm::PRMObject::TYPE.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildRealTypes().
|
overridevirtual |
Close current object being built.
Nothing is done in particular except removing the current object from the factory's stack. If the object was not added to a container it will not be deleted properly, so you might want to delete it yourself (at your own risks!).
Implements gum::prm::IPRMFactory.
Definition at line 1407 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::continueAggregator | ( | const std::string & | name | ) |
Conitnues an aggregator declaration.
Definition at line 608 of file PRMFactory_tpl.h.
References gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), and GUM_ERROR.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAggregates().
|
overridevirtual |
Continues the declaration of an attribute.
Implements gum::prm::IPRMFactory.
Definition at line 1628 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStackContainter(), gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::get(), and GUM_ERROR.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAttribute().
|
overridevirtual |
Continue the declaration of a class.
Implements gum::prm::IPRMFactory.
Definition at line 85 of file PRMFactory_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__addReferenceSlots(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAggregates(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAttribute(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildParameters(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAggregates(), and gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAttributes().
|
overridevirtual |
Continue the declaration of an interface.
Implements gum::prm::IPRMFactory.
Definition at line 213 of file PRMFactory_tpl.h.
References GUM_ERROR.
Referenced by gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildElements().
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1418 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__packages.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::popPackage().
|
overridevirtual |
NotFound | if no type is being built. |
Implements gum::prm::IPRMFactory.
Definition at line 1386 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, and GUM_ERROR.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::endAggregator | ( | ) |
Finishes an aggregate declaration.
Definition at line 676 of file PRMFactory_tpl.h.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAggregates(), and gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAggregates().
|
overridevirtual |
Tells the factory that we finished declaring an attribute.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1639 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), and gum::prm::PRMFactory< GUM_SCALAR >::__stack.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAttribute(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAttribute(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), and gum::prm::PRMFactory< GUM_SCALAR >::addAttribute().
|
overridevirtual |
Tells the factory that we finished a class declaration.
TypeError | Raised if the current Class<GUM_SCALAR> does not respect one of it's PRMInterface<GUM_SCALAR>. |
Implements gum::prm::IPRMFactory.
Definition at line 96 of file PRMFactory_tpl.h.
References gum::prm::PRMObject::CLASS.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__addReferenceSlots(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAggregates(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAttribute(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), gum::prm::PRMFactory< GUM_SCALAR >::addInstance(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildClasses(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildParameters(), gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAggregates(), and gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::completeAttributes().
|
overridevirtual |
End the current discrete type declaration.
OperationNotAllowed | Raised if the current type is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1495 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::Variable::name(), and gum::prm::PRMObject::TYPE.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildTypes(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateType(), and gum::prm::LayerGenerator< GUM_SCALAR >::__generateType().
|
overridevirtual |
End the current discretized type declaration.
OperationNotAllowed | Raised if the current type is not a valid discrete type. |
Implements gum::prm::IPRMFactory.
Definition at line 1544 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::Variable::name(), and gum::prm::PRMObject::TYPE.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildRealTypes().
|
overridevirtual |
Tells the factory that we finished an interface declaration.
Implements gum::prm::IPRMFactory.
Definition at line 1583 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::__stack, and gum::prm::PRMObject::PRM_INTERFACE.
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateInterfaces(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateInterfaces(), gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildElements(), and gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildInterfaces().
|
overridevirtual |
Tells the factory that we finished declaring a model.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1657 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::__stack, GUM_ERROR, gum::prm::PRMSystem< GUM_SCALAR >::instantiate(), and gum::prm::PRMObject::SYSTEM.
Referenced by gum::prm::LayerGenerator< GUM_SCALAR >::__generateSystem(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateSystem(), and gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::build().
|
overridevirtual |
NotFound | if nothing is being built. |
Implements gum::prm::IPRMFactory.
Definition at line 1393 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, and GUM_ERROR.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::isArrayInCurrentSystem().
|
overridevirtual |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Implements gum::prm::IPRMFactory.
Definition at line 1400 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__stack, and GUM_ERROR.
|
overridevirtual |
Add an instance to an array.
Implements gum::prm::IPRMFactory.
Definition at line 902 of file PRMFactory_tpl.h.
References gum::prm::PRMSystem< GUM_SCALAR >::add(), gum::prm::PRMSystem< GUM_SCALAR >::get(), GUM_ERROR, gum::prm::PRMSystem< GUM_SCALAR >::isArray(), gum::prm::PRMSystem< GUM_SCALAR >::isInstance(), and gum::prm::PRMObject::SYSTEM.
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1938 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::getCurrent(), and gum::prm::PRMSystem< GUM_SCALAR >::isArray().
|
overridevirtual |
Implements gum::prm::IPRMFactory.
Definition at line 1918 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__retrieveClass(), and gum::prm::PRMFactory< GUM_SCALAR >::__retrieveInterface().
|
delete |
Copy operator. Don't use it.
|
overridevirtual |
Pop the current package from the package stack.
Implements gum::prm::IPRMFactory.
Definition at line 1856 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__namespaces, gum::prm::PRMFactory< GUM_SCALAR >::__packages, and gum::prm::PRMFactory< GUM_SCALAR >::currentPackage().
INLINE PRM< GUM_SCALAR > * gum::prm::PRMFactory< GUM_SCALAR >::prm | ( | ) | const |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Definition at line 1381 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__prm.
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::generate(), and gum::prm::LayerGenerator< GUM_SCALAR >::generate().
|
overridevirtual |
Define the current package.
A stack is used to keep track of packages given the different imports.
name | The name of the package for all further objects. |
Implements gum::prm::IPRMFactory.
Definition at line 1850 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__namespaces, and gum::prm::PRMFactory< GUM_SCALAR >::__packages.
INLINE PRMClass< GUM_SCALAR > & gum::prm::PRMFactory< GUM_SCALAR >::retrieveClass | ( | const std::string & | name | ) |
Returns a reference over a Class<GUM_SCALAR> given its name.
This methods adds if necessary the current package as a prefix to name.
name | The name of the Class<GUM_SCALAR>. |
NotFound | if no Class<GUM_SCALAR> matches the given name. |
Definition at line 1900 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__retrieveClass().
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), and gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster().
INLINE PRMType & gum::prm::PRMFactory< GUM_SCALAR >::retrieveCommonType | ( | const std::vector< PRMClassElement< GUM_SCALAR > * > & | elts | ) |
Returns a pointer on the PRM<GUM_SCALAR> created by this factory.
This pointer will not be deleted when the factory is destroyed.
Definition at line 1911 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__retrieveCommonType().
INLINE PRMType & gum::prm::PRMFactory< GUM_SCALAR >::retrieveType | ( | const std::string & | name | ) |
Returns a reference over a PRMType given its name.
This methods adds if necessary the current package as a prefix to name.
name | The name of the PRMType. |
Definition at line 1906 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__retrieveType().
|
overridevirtual |
Fills the CPF using a rule.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parenst. |
Implements gum::prm::IPRMFactory.
Definition at line 398 of file PRMFactory_tpl.h.
References GUM_ERROR.
|
virtual |
Fills the CPF using a rule.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parents. |
Definition at line 417 of file PRMFactory_tpl.h.
References gum::Instantiation::chgVal(), gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::DiscreteVariable::label(), gum::Instantiation::setVals(), and gum::to_string().
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAttribute().
|
overridevirtual |
Fills the CPF using a rule and gum::Formula.
The labels vector is filled with one of each parent's labels or with a wildcard ("*"). If a wildcard is used then all values of the corresponding parents are used. The sequence of parents must be the declaration order used when adding the current attribute's parents.
labels | The value of each parents. |
values | The probability values of the current attribute given the values in parents. |
Implements gum::prm::IPRMFactory.
Definition at line 482 of file PRMFactory_tpl.h.
References gum::Instantiation::chgVal(), gum::DiscreteVariable::domainSize(), GUM_ERROR, gum::DiscreteVariable::label(), and gum::Instantiation::setVals().
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByColumns | ( | const std::vector< GUM_SCALAR > & | array | ) |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Definition at line 365 of file PRMFactory_tpl.h.
References gum::Instantiation::add(), gum::prm::PRMAttribute< GUM_SCALAR >::cpf(), and GUM_ERROR.
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__completeAttribute().
|
overridevirtual |
Gives the factory the CPF in its raw form use gum::Formula.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1946 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::Instantiation::add(), gum::prm::PRMObject::CLASS, GUM_ERROR, and gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByLines().
|
overridevirtual |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
See PRMFactory::setRawCPFByLines() for more details.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 351 of file PRMFactory_tpl.h.
References gum::prm::PRMAttribute< GUM_SCALAR >::cpf(), and GUM_ERROR.
|
overridevirtual |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 323 of file PRMFactory_tpl.h.
References gum::prm::PRMObject::CLASS, gum::prm::PRMAttribute< GUM_SCALAR >::cpf(), and GUM_ERROR.
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByLines | ( | const std::vector< GUM_SCALAR > & | array | ) |
Gives the factory the CPF in its raw form.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Definition at line 337 of file PRMFactory_tpl.h.
References gum::prm::PRMObject::CLASS, and GUM_ERROR.
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), and gum::prm::PRMFactory< GUM_SCALAR >::setRawCPFByColumns().
|
overridevirtual |
Gives the factory the CPF in its raw form using gum::Formula.
The creation of the CPF is left to the factory because we do not know what level of complexity for CPF implementation can be handled by the PRM<GUM_SCALAR> implementation.
How to fill a CPT? If you want to fill the CPT of P(A|B,C) with A, B and C boolean variables ( {f, t}, the order is important), then the following array is valid:
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1984 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMObject::CLASS, and GUM_ERROR.
|
overridevirtual |
Instantiate a reference in the current model.
This is equivalent to the following SKOOL instruction: left_instance.left_reference = right_instance;
right_instance's type must be compatible with the slot type of left_reference.
left_instance | The name of an instance in the model. |
left_reference | The name of a reference of left_instance. |
right_instance | The name of an instance or an array of instances in the model. |
Implements gum::prm::IPRMFactory.
Definition at line 919 of file PRMFactory_tpl.h.
References GUM_ERROR, and gum::prm::PRMObject::SYSTEM.
Referenced by gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::__addAssignments(), gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::__addIncrements(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateSystem(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateSystem(), and gum::prm::PRMFactory< GUM_SCALAR >::setReferenceSlot().
|
overridevirtual |
Instantiate a reference in the current model.
This is equivalent to the following SKOOL instruction: left_instance.left_reference = right_instance;
right_instance's type must be compatible with the slot type of left_reference.
l_i | A slot chain starting from an instance and ending over a reference slot. |
r_i | The name of an instance or an array of instances in the model. |
Implements gum::prm::IPRMFactory.
Definition at line 1886 of file PRMFactory_tpl.h.
References GUM_ERROR, and gum::prm::PRMFactory< GUM_SCALAR >::setReferenceSlot().
INLINE void gum::prm::PRMFactory< GUM_SCALAR >::startAggregator | ( | const std::string & | name, |
const std::string & | agg_type, | ||
const std::string & | rv_type, | ||
const std::vector< std::string > & | params | ||
) |
Start an aggregator declaration.
name | The aggregator's name. |
agg_type | The aggregtor's type ( |
rv_type | The aggregator's random variable type ( |
params | The aggregator's parameters. |
Definition at line 572 of file PRMFactory_tpl.h.
References gum::prm::PRMClass< GUM_SCALAR >::add(), gum::prm::PRMObject::CLASS, GUM_ERROR, gum::prm::PRMClass< GUM_SCALAR >::overload(), and gum::prm::PRMAggregate< GUM_SCALAR >::str2enum().
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAggregates().
|
overridevirtual |
Tells the factory that we start an attribute declaration.
FatalError | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1597 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__checkStackContainter(), gum::prm::PRMFactory< GUM_SCALAR >::__retrieveType(), gum::prm::PRMFactory< GUM_SCALAR >::__stack, gum::prm::PRMClassElementContainer< GUM_SCALAR >::add(), gum::prm::PRMClassElementContainer< GUM_SCALAR >::exists(), gum::prm::PRMClassElement< GUM_SCALAR >::id(), gum::prm::PRMObject::isClass(), and gum::prm::PRMClassElementContainer< GUM_SCALAR >::overload().
Referenced by gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::__declareAttribute(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), and gum::prm::PRMFactory< GUM_SCALAR >::addAttribute().
|
overridevirtual |
Tells the factory that we start a class declaration.
Use the default values if you do not want c to be a subclass or to implement interfaces.
c | The class name. |
ext | The name of the super class of c. |
implements | The list of interface implemented by c. |
delayInheritance | If true, the created gum::prm::Class inheritance will be delayed. |
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 48 of file PRMFactory_tpl.h.
References gum::Set< Key, Alloc >::empty(), GUM_ERROR, gum::Set< Key, Alloc >::insert(), and gum::prm::PRMObject::name().
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateClass(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateClasses(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateCluster(), gum::prm::PRMFactory< GUM_SCALAR >::addInstance(), and gum::prm::o3prm::O3ClassFactory< GUM_SCALAR >::buildClasses().
|
overridevirtual |
Start a discrete subtype declaration.
name | The discrete type's name. |
super | The super type of the declared discrete type. |
DuplicateElement | Raised if an object with the same name already exists. |
Implements gum::prm::IPRMFactory.
Definition at line 1424 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addPrefix(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, gum::prm::PRMFactory< GUM_SCALAR >::__retrieveType(), gum::prm::PRMFactory< GUM_SCALAR >::__stack, and GUM_ERROR.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildTypes(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateType(), and gum::prm::LayerGenerator< GUM_SCALAR >::__generateType().
|
overridevirtual |
Start a discretized type declaration.
name | The discretized type's name. |
DuplicateElement | Raised if an object with the same name already exists. |
Implements gum::prm::IPRMFactory.
Definition at line 1514 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addPrefix(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, gum::prm::PRMFactory< GUM_SCALAR >::__stack, and GUM_ERROR.
Referenced by gum::prm::o3prm::O3TypeFactory< GUM_SCALAR >::__buildRealTypes().
|
overridevirtual |
Tells the factory that we start an interface declaration.
Use the default values if you do not want c to be a subclass or to implement interfaces.
i | The interface name. |
ext | The name of the super interface of i. |
delayInheritance | If true, the created gum::prm::PRMInterface inheritance will be delayed. |
NotFound | Raised if ext does not match any declared PRMInterface<GUM_SCALAR>. |
Implements gum::prm::IPRMFactory.
Definition at line 187 of file PRMFactory_tpl.h.
References GUM_ERROR, and gum::prm::PRMObject::name().
Referenced by gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateInterfaces(), gum::prm::LayerGenerator< GUM_SCALAR >::__generateInterfaces(), and gum::prm::o3prm::O3InterfaceFactory< GUM_SCALAR >::buildInterfaces().
|
overridevirtual |
Tells the factory that we started declaring a model.
OperationNotAllowed | Raised if the given operation is illegal. |
Implements gum::prm::IPRMFactory.
Definition at line 1645 of file PRMFactory_tpl.h.
References gum::prm::PRMFactory< GUM_SCALAR >::__addPrefix(), gum::prm::PRMFactory< GUM_SCALAR >::__prm, gum::prm::PRMFactory< GUM_SCALAR >::__stack, GUM_ERROR, and gum::prm::PRMObject::name().
Referenced by gum::prm::LayerGenerator< GUM_SCALAR >::__generateSystem(), gum::prm::ClusteredLayerGenerator< GUM_SCALAR >::__generateSystem(), and gum::prm::o3prm::O3SystemFactory< GUM_SCALAR >::build().
|
private |
A mapping between aggregators and their parameters.
Definition at line 1056 of file PRMFactory.h.
|
private |
Set of all declared namespaces.
Definition at line 1046 of file PRMFactory.h.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addImport(), gum::prm::PRMFactory< GUM_SCALAR >::popPackage(), gum::prm::PRMFactory< GUM_SCALAR >::pushPackage(), and gum::prm::PRMFactory< GUM_SCALAR >::~PRMFactory().
|
private |
The prefix used for classes and types names. It is normally the namespace of the corresponding compilation unit.
Definition at line 1043 of file PRMFactory.h.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__addPrefix(), gum::prm::PRMFactory< GUM_SCALAR >::addInstance(), gum::prm::PRMFactory< GUM_SCALAR >::currentPackage(), gum::prm::PRMFactory< GUM_SCALAR >::popPackage(), and gum::prm::PRMFactory< GUM_SCALAR >::pushPackage().
|
private |
The pointer on the PRM<GUM_SCALAR> built by this factory.
Definition at line 1049 of file PRMFactory.h.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::addRangeType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::prm::PRMFactory< GUM_SCALAR >::prm(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscretizedType(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().
|
private |
A stack used to keep track of created PRMObject.
Definition at line 1052 of file PRMFactory.h.
Referenced by gum::prm::PRMFactory< GUM_SCALAR >::__checkStack(), gum::prm::PRMFactory< GUM_SCALAR >::__checkStackContainter(), gum::prm::PRMFactory< GUM_SCALAR >::closeCurrent(), gum::prm::PRMFactory< GUM_SCALAR >::continueAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::currentType(), gum::prm::PRMFactory< GUM_SCALAR >::endAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::endDiscretizedType(), gum::prm::PRMFactory< GUM_SCALAR >::endInterface(), gum::prm::PRMFactory< GUM_SCALAR >::endSystem(), gum::prm::PRMFactory< GUM_SCALAR >::getCurrent(), gum::prm::PRMFactory< GUM_SCALAR >::startAttribute(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscreteType(), gum::prm::PRMFactory< GUM_SCALAR >::startDiscretizedType(), and gum::prm::PRMFactory< GUM_SCALAR >::startSystem().