41 #ifndef BPP_NUMERIC_ABSTRACTPARAMETERALIASABLE_H
42 #define BPP_NUMERIC_ABSTRACTPARAMETERALIASABLE_H
75 name_ = (*pl_)[alias].getName();
99 const std::string&
getId()
const {
return id_; }
111 throw Exception(
"AbstractParameterAliasable::AliasParameterListener::parameterValueChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
119 throw Exception(
"AbstractParameterAliasable::AliasParameterListener::parameterConstraintChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
197 void aliasParameters(std::map<std::string, std::string>& unparsedParams,
bool verbose);
222 virtual std::vector<std::string>
getAlias(
const std::string& name)
const;
229 virtual std::map<std::string, std::string>
getAliases()
const;
236 std::string
getFrom(
const std::string& name)
const;
254 for (
size_t i = 0; i < parameters.
size(); i++)
269 for (
size_t i = 0; i < parameters.
size(); i++)
278 for (
size_t i = 0; i < parameters.
size(); i++)
303 for (
size_t i = 0; i < names.size(); i++)
A partial implementation of the Parametrizable interface.
void addParameters_(const ParameterList ¶meters)
size_t getNumberOfIndependentParameters() const
Get the number of independent parameters.
virtual std::vector< std::string > getAlias(const std::string &name) const
virtual ~AbstractParameterAliasable()
const ParameterList & getIndependentParameters() const
Get the minimal list of parameters to set the model.
void unaliasParameters(const std::string &p1, const std::string &p2)
Detach two parameters previously set as 'aliased'.
void shareParameters_(const ParameterList ¶meters)
void deleteParameters_(const std::vector< std::string > &names)
std::string getFrom(const std::string &name) const
void deleteParameter_(size_t index)
void includeParameters_(const ParameterList ¶meters)
void addParameter_(Parameter *parameter)
bool hasIndependentParameter(const std::string &name) const
AbstractParameterAliasable & operator=(const AbstractParameterAliasable &ap)
virtual std::map< std::string, std::string > getAliases() const
AbstractParameterAliasable(const std::string &prefix)
void aliasParameters(const std::string &p1, const std::string &p2)
alias the parameters.
void deleteParameter_(std::string &name)
void shareParameter_(const std::shared_ptr< Parameter > ¶meter)
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 param...
void setNamespace(const std::string &prefix)
Set the namespace for the parameter names.
ParameterList getFromParameters(const ParameterList &pl) const
Return the list of the names of the parameters from which the parameters of the list are aliased (dir...
ParameterList independentParameters_
std::map< std::string, AliasParameterListener * > aliasListenersRegister_
A partial implementation of the Parametrizable interface.
virtual void shareParameters_(const ParameterList ¶meters)
virtual void addParameter_(Parameter *parameter)
virtual void shareParameter_(const std::shared_ptr< Parameter > ¶meter)
virtual void addParameters_(const ParameterList ¶meters)
const std::shared_ptr< Parameter > & getSharedParameter(const std::string &name) const
virtual void includeParameters_(const ParameterList ¶meters)
virtual void deleteParameter_(size_t index)
std::string getNamespace() const
std::string getParameterNameWithoutNamespace(const std::string &name) const
Resolves a parameter name according to the current namespace.
Parameter & getParameter_(const std::string &name)
Inner listener class used by AbstractParameterAliasable.
AliasParameterListener * clone() const
Create a copy of this object and send a pointer to it.
AliasParameterListener & operator=(const AliasParameterListener &apl)
const std::string & getName() const
void parameterValueChanged(ParameterEvent &event)
Notify a value change.
void parameterConstraintChanged(ParameterEvent &event)
Notify a constraint change.
const std::string & getFrom() const
void setParameterList(ParameterList *pl)
AliasParameterListener(const std::string &id, size_t alias, ParameterList *pl, const std::string &from)
void parameterNameChanged(ParameterEvent &event)
Notify a renaming action.
AliasParameterListener(const AliasParameterListener &apl)
const std::string & getId() const
void rename(const std::string &name)
const std::string & getAlias() const
Exception base class. Overload exception constructor (to control the exceptions mechanism)....
Extend the Parametrizable interface with support for parameter aliases.
const Parameter * getParameter() const
The parameter list object.
virtual bool hasParameter(const std::string &name) const
virtual void shareParameter(const std::shared_ptr< Parameter > ¶m)
Share a parameter at the end of the list.
virtual void deleteParameter(const std::string &name)
Delete a parameter from the list.
virtual void reset()
Reset the list: delete all parameters.
The parameter listener interface.
This class is designed to facilitate the manipulation of parameters.
virtual void setValue(double value)
Set the value of this parameter.
virtual const std::shared_ptr< Constraint > getConstraint() const
Return the constraint associated to this parameter if there is one.
virtual void setConstraint(std::shared_ptr< Constraint > constraint)
Set a constraint to this parameter.
virtual const std::string & getName() const
Get the name of this parameter.