bpp-core3  3.0.0
bpp::ParametrizableCollection< N > Class Template Reference

Plain collection of parametrizable objects. More...

#include <Bpp/Numeric/ParametrizableCollection.h>

+ Inheritance diagram for bpp::ParametrizableCollection< N >:
+ Collaboration diagram for bpp::ParametrizableCollection< N >:

Public Member Functions

 ParametrizableCollection ()
 Create an empty object set. More...
 
 ParametrizableCollection (const ParametrizableCollection< N > &set)
 
ParametrizableCollection< N > & operator= (const ParametrizableCollection< N > &set)
 
void clear ()
 Resets all the information contained in this object. More...
 
 ~ParametrizableCollection ()
 
ParametrizableCollection< N > * clone () const
 Create a copy of this object and send a pointer to it. More...
 
void fireParameterChanged (const ParameterList &parameters)
 
std::vector< size_t > hasChanged () const
 
void clearChanged ()
 
size_t getNumberOfObjects () const
 
bool hasObject (size_t objectIndex) const
 Says if there is a object with a given index. More...
 
bool hasObject (std::shared_ptr< N > object) const
 Says if there is an object in the map. More...
 
size_t getFirstKey (std::shared_ptr< N > object) const
 Return the first key mapping an object in the map. More...
 
const std::vector< size_t > keys () const
 Returns the keys of the set. More...
 
std::shared_ptr< const N > operator[] (size_t objectIndex) const
 Get one object from the set knowing its index. More...
 
std::shared_ptr< N > operator[] (size_t objectIndex)
 
ParameterList getParametersForObject (size_t objectIndex) const
 Get the paramters of the Collection corresponding to an object from the set knowing its index. More...
 
void addObject (std::shared_ptr< N > object, size_t objectIndex)
 Add a new object to the set with a given number. More...
 
std::shared_ptr< N > removeObject (size_t objectIndex)
 Remove a object from the set, and all corresponding parameters. More...
 
std::shared_ptr< N > replaceObject (std::shared_ptr< N > object, size_t objectIndex)
 Replace a object in the set, and returns the replaced one. More...
 
void setNamespace (const std::string &prefix)
 Set the namespace for the parameter names. More...
 
bool hasIndependentParameter (const std::string &name) const
 
const ParameterListgetIndependentParameters () const
 Get the minimal list of parameters to set the model. More...
 
size_t getNumberOfIndependentParameters () const
 Get the number of independent parameters. More...
 
void aliasParameters (const std::string &p1, const std::string &p2)
 alias the parameters. More...
 
void aliasParameters (std::map< std::string, std::string > &unparsedParams, bool verbose)
 alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden. More...
 
void unaliasParameters (const std::string &p1, const std::string &p2)
 Detach two parameters previously set as 'aliased'. More...
 
ParameterList getAliasedParameters (const ParameterList &pl) const
 Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list. More...
 
ParameterList getFromParameters (const ParameterList &pl) const
 Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not). More...
 
virtual std::vector< std::string > getAlias (const std::string &name) const
 
virtual std::map< std::string, std::string > getAliases () const
 
std::string getFrom (const std::string &name) const
 
bool hasParameter (const std::string &name) const override
 Tell if there is a parameter with specified name. More...
 
const ParameterListgetParameters () const override
 Get all parameters available. More...
 
const Parameterparameter (const std::string &name) const override
 Get the parameter with specified name. More...
 
const std::shared_ptr< Parameter > & getParameter (const std::string &name) const
 
double getParameterValue (const std::string &name) const override
 Get the value for parameter of name 'name'. More...
 
void setAllParametersValues (const ParameterList &parameters) override
 Set the parameters values to be equals to those of parameters. More...
 
void setParameterValue (const std::string &name, double value) override
 Set the value of parameter with name name to be equal to value. More...
 
void setParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
bool matchParametersValues (const ParameterList &parameters) override
 Update the parameters from parameters. More...
 
void removeConstraint (const std::string &name) override
 Remove the constraint associated with one parameter, if any. More...
 
void setConstraint (const std::string &name, std::shared_ptr< ConstraintInterface > constraint) override
 Set/Change the constraint associated with one parameter. More...
 
size_t getNumberOfParameters () const override
 Get the number of parameters. More...
 
std::string getNamespace () const override
 
std::string getParameterNameWithoutNamespace (const std::string &name) const override
 Resolves a parameter name according to the current namespace. More...
 

Protected Member Functions

void addParameter_ (Parameter *parameter)
 
void addParameters_ (const ParameterList &parameters)
 
void shareParameter_ (const std::shared_ptr< Parameter > &parameter)
 
void shareParameters_ (const ParameterList &parameters)
 
void includeParameters_ (const ParameterList &parameters)
 
void deleteParameter_ (size_t index)
 
void deleteParameter_ (std::string &name)
 
void deleteParameters_ (const std::vector< std::string > &names)
 
void resetParameters_ ()
 
const std::shared_ptr< Parameter > & getParameter (size_t i) const
 
std::shared_ptr< Parameter > & getParameter (size_t i)
 
ParametergetParameter_ (const std::string &name)
 
ParametergetParameter_ (size_t index)
 
const ParametergetParameter_ (size_t index) const
 
ParametergetParameterWithNamespace_ (const std::string &name)
 
const ParametergetParameterWithNamespace_ (const std::string &name) const
 
ParameterListgetParameters_ () override
 Get all parameters available. More...
 

Protected Attributes

std::map< size_t, std::shared_ptr< N > > objectsSet_
 Contains all objects used. More...
 
std::vector< size_t > vChanged_
 A vector of the numbers of objects that have changed during the last fireParameterChanged. More...
 

Detailed Description

template<class N>
class bpp::ParametrizableCollection< N >

Plain collection of parametrizable objects.

The collection is a map from unsigned integers to Parametrizables.

The access to the parameters of the objects will be done through this collection.

Definition at line 29 of file ParametrizableCollection.h.

Constructor & Destructor Documentation

◆ ParametrizableCollection() [1/2]

template<class N>
bpp::ParametrizableCollection< N >::ParametrizableCollection ( )
inline

Create an empty object set.

Definition at line 53 of file ParametrizableCollection.h.

◆ ParametrizableCollection() [2/2]

template<class N>
bpp::ParametrizableCollection< N >::ParametrizableCollection ( const ParametrizableCollection< N > &  set)
inline

Definition at line 59 of file ParametrizableCollection.h.

◆ ~ParametrizableCollection()

Member Function Documentation

◆ addObject()

template<class N>
void bpp::ParametrizableCollection< N >::addObject ( std::shared_ptr< N >  object,
size_t  objectIndex 
)
inline

Add a new object to the set with a given number.

Exceptions
Exceptionif the number is already used. See replace function instead.
Parameters
objectA pointer toward an object, that will added to the set.

WARNING! The set will now be the owner of the pointer, and will destroy it if needed! Copy the object first if you don't want it to be lost!

Parameters
objectIndexThe number of the object in the Collection

Definition at line 284 of file ParametrizableCollection.h.

References bpp::AbstractParameterAliasable::addParameter_(), bpp::AbstractParameterAliasable::aliasParameters(), bpp::ParameterAliasable::getAlias(), bpp::Parameter::setName(), and bpp::TextTools::toString().

Referenced by bpp::ParametrizableCollection< N >::replaceObject().

◆ addParameter_()

◆ addParameters_()

◆ aliasParameters() [1/2]

◆ aliasParameters() [2/2]

void AbstractParameterAliasable::aliasParameters ( std::map< std::string, std::string > &  unparsedParams,
bool  verbose 
)
virtualinherited

alias the parameters following the links described in a map, and update the object accordingly. Cycles in aliasing are detected and forbidden.

Parameters
unparsedParamsthe map of the links : <A,B> matches for A->B aliasing.
verboseverbosity

Implements bpp::ParameterAliasable.

Definition at line 120 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasParameters(), bpp::ParameterList::clone(), bpp::Parameter::clone(), bpp::ApplicationTools::displayResult(), bpp::AbstractParametrizable::getParameters(), bpp::Parameter::getValue(), bpp::ParameterList::hasParameter(), bpp::AbstractParametrizable::matchParametersValues(), bpp::ParameterList::parameter(), bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ clear()

template<class N>
void bpp::ParametrizableCollection< N >::clear ( )
inline

◆ clearChanged()

template<class N>
void bpp::ParametrizableCollection< N >::clearChanged ( )
inline

Definition at line 147 of file ParametrizableCollection.h.

◆ clone()

template<class N>
ParametrizableCollection<N>* bpp::ParametrizableCollection< N >::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 106 of file ParametrizableCollection.h.

◆ deleteParameter_() [1/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( size_t  index)
inlineprotectedvirtualinherited

◆ deleteParameter_() [2/2]

void bpp::AbstractParameterAliasable::deleteParameter_ ( std::string &  name)
inlineprotectedvirtualinherited

◆ deleteParameters_()

void bpp::AbstractParameterAliasable::deleteParameters_ ( const std::vector< std::string > &  names)
inlineprotectedvirtualinherited

Reimplemented from bpp::AbstractParametrizable.

Definition at line 252 of file AbstractParameterAliasable.h.

◆ fireParameterChanged()

template<class N>
void bpp::ParametrizableCollection< N >::fireParameterChanged ( const ParameterList parameters)
inlinevirtual

To be called when a parameter has changed. Depending on parameters, this will actualize the corresponding objects in the set.

Parameters
parametersThe modified parameters.

Reimplemented from bpp::AbstractParametrizable.

Definition at line 114 of file ParametrizableCollection.h.

References bpp::ParametrizableCollection< N >::hasObject(), and bpp::ParameterList::size().

◆ getAlias()

vector< string > AbstractParameterAliasable::getAlias ( const std::string &  name) const
virtualinherited
Returns
The list of names of the parameters that are aliased with a given parameter. The implementation is recursive, which means that in the case of A->B->C, getalias(C) will return both A and B.
Parameters
nameThe name of the parameter to look for.

Implements bpp::ParameterAliasable.

Definition at line 204 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, and bpp::VectorTools::append().

Referenced by bpp::AbstractParameterAliasable::getAliases(), and bpp::ParametrizableCollection< N >::removeObject().

◆ getAliasedParameters()

ParameterList AbstractParameterAliasable::getAliasedParameters ( const ParameterList pl) const
inherited

Return the list of the names of the parameters that are aliased (directly or not) to one of the parameters of the list.

Definition at line 244 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getAliases()

std::map< std::string, std::string > AbstractParameterAliasable::getAliases ( ) const
virtualinherited

◆ getFirstKey()

template<class N>
size_t bpp::ParametrizableCollection< N >::getFirstKey ( std::shared_ptr< N >  object) const
inline

Return the first key mapping an object in the map.

Parameters
objectObject in the set.
Returns
the key of the object.

Throw Exception if object not found.

Definition at line 192 of file ParametrizableCollection.h.

◆ getFrom()

string AbstractParameterAliasable::getFrom ( const std::string &  name) const
inherited
Returns
The name of the parameter from which a given parameter is aliased.
Parameters
nameThe name of the parameter to look for.

Definition at line 280 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_.

◆ getFromParameters()

ParameterList AbstractParameterAliasable::getFromParameters ( const ParameterList pl) const
inherited

Return the list of the names of the parameters from which the parameters of the list are aliased (directly or not).

Definition at line 297 of file AbstractParameterAliasable.cpp.

References bpp::ParameterList::addParameter(), bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::ParameterList::hasParameter(), and bpp::AbstractParametrizable::parameter().

◆ getIndependentParameters()

const ParameterList& bpp::AbstractParameterAliasable::getIndependentParameters ( ) const
inlinevirtualinherited

Get the minimal list of parameters to set the model.

If no parameters are aliased, this is the same a getParameters().

Returns
A minimal set of parameters.

Implements bpp::ParameterAliasable.

Definition at line 135 of file AbstractParameterAliasable.h.

◆ getNamespace()

std::string bpp::AbstractParametrizable::getNamespace ( ) const
inlineoverridevirtualinherited

◆ getNumberOfIndependentParameters()

size_t bpp::AbstractParameterAliasable::getNumberOfIndependentParameters ( ) const
inlinevirtualinherited

Get the number of independent parameters.

Returns
The number of independent parameters. If no parameters are aliased, this is equivalent to the getNumberOfParameters() method.

Implements bpp::ParameterAliasable.

Definition at line 137 of file AbstractParameterAliasable.h.

References bpp::AliasParameterListener::getAlias(), bpp::AliasParameterListener::getFrom(), and bpp::ParameterList::size().

◆ getNumberOfObjects()

template<class N>
size_t bpp::ParametrizableCollection< N >::getNumberOfObjects ( ) const
inline
Returns
The current number of distinct discrete objects in this set.

Definition at line 155 of file ParametrizableCollection.h.

◆ getNumberOfParameters()

◆ getParameter() [1/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( const std::string &  name) const
inlineinherited

◆ getParameter() [2/3]

const std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i) const
inlineprotectedinherited
Returns
The shared_ptr parameter at a given position.
Warning
No check is performed on the validity of the index given as input!

Definition at line 211 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter() [3/3]

std::shared_ptr<Parameter>& bpp::AbstractParametrizable::getParameter ( size_t  i)
inlineprotectedinherited

Definition at line 216 of file AbstractParametrizable.h.

References bpp::ParameterList::getParameter().

◆ getParameter_() [1/3]

◆ getParameter_() [2/3]

Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index)
inlineprotectedinherited

Definition at line 190 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameter_() [3/3]

const Parameter& bpp::AbstractParametrizable::getParameter_ ( size_t  index) const
inlineprotectedinherited

Definition at line 197 of file AbstractParametrizable.h.

References bpp::ParameterList::size().

◆ getParameterNameWithoutNamespace()

std::string AbstractParametrizable::getParameterNameWithoutNamespace ( const std::string &  name) const
overridevirtualinherited

Resolves a parameter name according to the current namespace.

Returns
The parameter name without the namespace prefix, if any.

Implements bpp::Parametrizable.

Definition at line 28 of file AbstractParametrizable.cpp.

References bpp::TextTools::startsWith().

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParametrizable::getNamespace(), and bpp::AbstractParameterAliasable::operator=().

◆ getParameters()

const ParameterList& bpp::AbstractParametrizable::getParameters ( ) const
inlineoverridevirtualinherited

◆ getParameters_()

ParameterList& bpp::AbstractParametrizable::getParameters_ ( )
inlineoverrideprotectedvirtualinherited

Get all parameters available.

See also
getIndependentParameters if some parameters are aliased.
Returns
A list with all parameters available.

Implements bpp::Parametrizable.

Definition at line 205 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameters_.

Referenced by bpp::AbstractParameterAliasable::AbstractParameterAliasable(), bpp::AbstractParameterAliasable::aliasParameters(), and bpp::AbstractParameterAliasable::operator=().

◆ getParametersForObject()

template<class N>
ParameterList bpp::ParametrizableCollection< N >::getParametersForObject ( size_t  objectIndex) const
inline

Get the paramters of the Collection corresponding to an object from the set knowing its index.

Parameters
objectIndexIndex of the object in the set.
Returns
A ParameterList

Definition at line 251 of file ParametrizableCollection.h.

References bpp::ParameterList::size(), and bpp::TextTools::toString().

◆ getParameterValue()

◆ getParameterWithNamespace_() [1/2]

Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name)
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 176 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_().

◆ getParameterWithNamespace_() [2/2]

const Parameter& bpp::AbstractParametrizable::getParameterWithNamespace_ ( const std::string &  name) const
inlineprotectedinherited
Parameters
nameThe name of the parameter, including its namespace.
Returns
A reference toward the corresponding parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter with that name is found in the list.

Definition at line 185 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::parameter().

◆ hasChanged()

template<class N>
std::vector<size_t> bpp::ParametrizableCollection< N >::hasChanged ( ) const
inline

◆ hasIndependentParameter()

bool bpp::AbstractParameterAliasable::hasIndependentParameter ( const std::string &  name) const
inlineinherited

Definition at line 133 of file AbstractParameterAliasable.h.

References bpp::ParameterList::hasParameter().

◆ hasObject() [1/2]

template<class N>
bool bpp::ParametrizableCollection< N >::hasObject ( size_t  objectIndex) const
inline

Says if there is a object with a given index.

Parameters
objectIndexIndex of the object in the set.
Returns
true or false.

Definition at line 163 of file ParametrizableCollection.h.

Referenced by bpp::ParametrizableCollection< N >::fireParameterChanged().

◆ hasObject() [2/2]

template<class N>
bool bpp::ParametrizableCollection< N >::hasObject ( std::shared_ptr< N >  object) const
inline

Says if there is an object in the map.

Parameters
objectObject in the set.
Returns
true or false.

Definition at line 174 of file ParametrizableCollection.h.

◆ hasParameter()

bool bpp::AbstractParametrizable::hasParameter ( const std::string &  name) const
inlineoverridevirtualinherited

Tell if there is a parameter with specified name.

Parameters
nameThe name of the parameter to look for.
Returns
y/n.

Implements bpp::Parametrizable.

Definition at line 39 of file AbstractParametrizable.h.

References bpp::ParameterList::hasParameter().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::GammaDiscreteDistribution::fireParameterChanged(), bpp::AbstractParametrizable::getParameter_(), and bpp::AbstractParameterAliasable::unaliasParameters().

◆ includeParameters_()

void bpp::AbstractParameterAliasable::includeParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

◆ keys()

template<class N>
const std::vector<size_t> bpp::ParametrizableCollection< N >::keys ( ) const
inline

Returns the keys of the set.

Definition at line 208 of file ParametrizableCollection.h.

◆ matchParametersValues()

bool bpp::AbstractParametrizable::matchParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

Only common parameters with parameters will be updated.

Parameters
parametersA list of parameters.
Returns
True if at least one parameter value has been changed.
Exceptions
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 76 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), bpp::ParameterList::matchParametersValues(), and bpp::ParameterList::shareSubList().

Referenced by bpp::AbstractParameterAliasable::aliasParameters(), bpp::Simplex::setFrequencies(), bpp::ReparametrizationFunctionWrapper::setParameters(), and bpp::FullHmmTransitionMatrix::setTransitionProbabilities().

◆ operator=()

◆ operator[]() [1/2]

template<class N>
std::shared_ptr<const N> bpp::ParametrizableCollection< N >::operator[] ( size_t  objectIndex) const
inline

Get one object from the set knowing its index.

Parameters
objectIndexIndex of the object in the set.
Returns
A pointer toward the corresponding object.

Definition at line 226 of file ParametrizableCollection.h.

◆ operator[]() [2/2]

template<class N>
std::shared_ptr<N> bpp::ParametrizableCollection< N >::operator[] ( size_t  objectIndex)
inline

Definition at line 235 of file ParametrizableCollection.h.

◆ parameter()

const Parameter& bpp::AbstractParametrizable::parameter ( const std::string &  name) const
inlineoverridevirtualinherited

◆ removeConstraint()

void bpp::AbstractParametrizable::removeConstraint ( const std::string &  name)
inlineoverridevirtualinherited

Remove the constraint associated with one parameter, if any.

Parameters
nameThe name of the parameter to look for.
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 85 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::removeConstraint().

◆ removeObject()

template<class N>
std::shared_ptr<N> bpp::ParametrizableCollection< N >::removeObject ( size_t  objectIndex)
inline

Remove a object from the set, and all corresponding parameters.

Parameters
objectIndexThe index of the object in the set.
Returns
the removed N*.

Definition at line 324 of file ParametrizableCollection.h.

References bpp::AbstractParameterAliasable::deleteParameter_(), bpp::AbstractParameterAliasable::getAlias(), bpp::AbstractParametrizable::getParameters(), bpp::ParameterList::size(), and bpp::AbstractParameterAliasable::unaliasParameters().

Referenced by bpp::ParametrizableCollection< N >::replaceObject().

◆ replaceObject()

template<class N>
std::shared_ptr<N> bpp::ParametrizableCollection< N >::replaceObject ( std::shared_ptr< N >  object,
size_t  objectIndex 
)
inline

Replace a object in the set, and returns the replaced one.

Parameters
objectIndexThe index of the object to be replaced in the set.
objectthe replacing N
Returns
the replaced N*.

Definition at line 370 of file ParametrizableCollection.h.

References bpp::ParametrizableCollection< N >::addObject(), and bpp::ParametrizableCollection< N >::removeObject().

◆ resetParameters_()

void bpp::AbstractParameterAliasable::resetParameters_ ( )
inlineprotectedinherited

◆ setAllParametersValues()

void bpp::AbstractParametrizable::setAllParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Set the parameters values to be equals to those of parameters.

The list must contain exactly the same parameters (ie same names) than the parameters available.

Parameters
parametersA list with all parameters.
Exceptions
ParameterNotFoundExceptionIf a some parameter in the list is not in params.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 58 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setAllParametersValues().

◆ setConstraint()

void bpp::AbstractParametrizable::setConstraint ( const std::string &  name,
std::shared_ptr< ConstraintInterface constraint 
)
inlineoverridevirtualinherited

Set/Change the constraint associated with one parameter.

Parameters
nameThe name of the parameter to look for.
constraintA pointer to the constraint (may be null)
Exceptions
ParameterNotFoundExceptionif no parameter with this name is found.

Implements bpp::Parametrizable.

Definition at line 90 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::getParameter_(), and bpp::Parameter::setConstraint().

Referenced by bpp::SimpleDiscreteDistribution::restrictToConstraint().

◆ setNamespace()

void AbstractParameterAliasable::setNamespace ( const std::string &  prefix)
virtualinherited

Set the namespace for the parameter names.

Parameters
prefixThe 'namespace', that is a prefix to add to all parameter names. If parameter names are already prefixed, the new prefix will be used instead.

Implements bpp::Parametrizable.

Reimplemented in bpp::MixtureOfDiscreteDistributions, and bpp::InvariantMixedDiscreteDistribution.

Definition at line 186 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getNamespace(), bpp::AbstractParametrizable::setNamespace(), and bpp::TextTools::startsWith().

Referenced by bpp::InvariantMixedDiscreteDistribution::setNamespace(), and bpp::MixtureOfDiscreteDistributions::setNamespace().

◆ setParametersValues()

void bpp::AbstractParametrizable::setParametersValues ( const ParameterList parameters)
inlineoverridevirtualinherited

Update the parameters from parameters.

parameters must be a subset of all parameters available.

Parameters
parametersA list containing all parameters to update.
Exceptions
ParameterNotFoundExceptionIf a some parameter in params is not in the list.
ConstraintExceptionIf a value in parameters does not match the constraint in the corresponding parameter in the list.

Implements bpp::Parametrizable.

Definition at line 70 of file AbstractParametrizable.h.

References bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParametersValues().

Referenced by bpp::LowMemoryRescaledHmmLikelihood::setParameters(), bpp::RescaledHmmLikelihood::setParameters(), and bpp::LogsumHmmLikelihood::setParameters().

◆ setParameterValue()

void bpp::AbstractParametrizable::setParameterValue ( const std::string &  name,
double  value 
)
inlineoverridevirtualinherited

Set the value of parameter with name name to be equal to value.

Parameters
namethe name of the parameter to set.
valueThe value of the parameter.
Exceptions
ParameterNotFoundExceptionIf no parameter in the list has the name name.
ConstraintExceptionIf value does not match the constraint associated to parameter name.

Implements bpp::Parametrizable.

Definition at line 64 of file AbstractParametrizable.h.

References bpp::ParameterList::createSubList(), bpp::AbstractParametrizable::fireParameterChanged(), and bpp::ParameterList::setParameterValue().

◆ shareParameter_()

void bpp::AbstractParameterAliasable::shareParameter_ ( const std::shared_ptr< Parameter > &  parameter)
inlineprotectedvirtualinherited

◆ shareParameters_()

void bpp::AbstractParameterAliasable::shareParameters_ ( const ParameterList parameters)
inlineprotectedvirtualinherited

◆ unaliasParameters()

void AbstractParameterAliasable::unaliasParameters ( const std::string &  p1,
const std::string &  p2 
)
virtualinherited

Detach two parameters previously set as 'aliased'.

The values of the two parameters will now be independent.

Parameters
p1Original parameter.
p2Aliased parameter.
Exceptions
ParameterNotFoundExceptionif p1 or p2 do not correspond to existing parameters.
Exceptionwhen trying to perform non-valid dissociation.

Implements bpp::ParameterAliasable.

Definition at line 168 of file AbstractParameterAliasable.cpp.

References bpp::AbstractParameterAliasable::aliasListenersRegister_, bpp::AbstractParametrizable::getParameter(), bpp::AbstractParametrizable::getParameter_(), bpp::AbstractParametrizable::hasParameter(), bpp::AbstractParameterAliasable::independentParameters_, bpp::Parameter::removeParameterListener(), and bpp::ParameterList::shareParameter().

Referenced by bpp::ParametrizableCollection< N >::removeObject().

Member Data Documentation

◆ objectsSet_

template<class N>
std::map<size_t, std::shared_ptr<N> > bpp::ParametrizableCollection< N >::objectsSet_
protected

Contains all objects used.

Definition at line 37 of file ParametrizableCollection.h.

◆ vChanged_

template<class N>
std::vector<size_t> bpp::ParametrizableCollection< N >::vChanged_
protected

A vector of the numbers of objects that have changed during the last fireParameterChanged.

Definition at line 45 of file ParametrizableCollection.h.

Referenced by bpp::ParametrizableCollection< N >::hasChanged().


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