5 #ifndef BPP_NUMERIC_ABSTRACTPARAMETERALIASABLE_H 6 #define BPP_NUMERIC_ABSTRACTPARAMETERALIASABLE_H 39 name_ = (*pl_)[alias].getName();
63 const std::string&
getId()
const {
return id_; }
75 throw Exception(
"AbstractParameterAliasable::AliasParameterListener::parameterValueChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
83 throw Exception(
"AbstractParameterAliasable::AliasParameterListener::parameterConstraintChanged. Error, aliased parameter have change, maybe because it was renamed, or a parameter was removed?");
89 void rename(
const std::string& name) { name_ = name; }
120 independentParameters_(),
121 aliasListenersRegister_()
131 void setNamespace(
const std::string& prefix);
145 void aliasParameters(
const std::string& p1,
const std::string& p2);
147 void unaliasParameters(
const std::string& p1,
const std::string& p2);
157 void aliasParameters(std::map<std::string, std::string>& unparsedParams,
bool verbose);
177 virtual std::vector<std::string>
getAlias(
const std::string& name)
const;
182 virtual std::map<std::string, std::string> getAliases()
const;
188 std::string
getFrom(
const std::string& name)
const;
199 independentParameters_.
shareParameter(getParameter(getParameterNameWithoutNamespace(parameter->
getName())));
206 for (
size_t i = 0; i < parameters.
size(); ++i)
208 independentParameters_.
shareParameter(getParameter(getParameterNameWithoutNamespace(parameters[i].
getName())));
221 for (
size_t i = 0; i < parameters.
size(); ++i)
223 independentParameters_.
shareParameter(getParameter(getParameterNameWithoutNamespace(parameters[i].
getName())));
230 for (
size_t i = 0; i < parameters.
size(); ++i)
232 independentParameters_.
shareParameter(getParameter(getParameterNameWithoutNamespace(parameters[i].
getName())));
239 std::string name = getParameter_(index).getName();
255 for (
size_t i = 0; i < names.size(); ++i)
265 independentParameters_.
reset();
269 #endif // BPP_NUMERIC_ABSTRACTPARAMETERALIASABLE_H The parameter listener interface.
Extend the Parametrizable interface with support for parameter aliases.
const ParameterList & getIndependentParameters() const
Get the minimal list of parameters to set the model.
virtual void reset()
Reset the list: delete all parameters.
A partial implementation of the Parametrizable interface.
virtual void shareParameter(const std::shared_ptr< Parameter > ¶m)
Share a parameter at the end of the list.
This class is designed to facilitate the manipulation of parameters.
void addParameter_(Parameter *parameter)
void shareParameter_(const std::shared_ptr< Parameter > ¶meter)
size_t getNumberOfIndependentParameters() const
Get the number of independent parameters.
virtual void setConstraint(std::shared_ptr< ConstraintInterface > constraint)
Set a constraint to this parameter.
virtual void deleteParameter(const std::string &name)
Delete a parameter from the list.
virtual ~AbstractParameterAliasable()
const std::string & getName() const
void deleteParameter_(size_t index)
const Parameter * parameter() const
The parameter list object.
bool hasIndependentParameter(const std::string &name) const
AliasParameterListener & operator=(const AliasParameterListener &apl)
void shareParameters_(const ParameterList ¶meters)
void deleteParameters_(const std::vector< std::string > &names)
virtual std::shared_ptr< const ConstraintInterface > getConstraint() const
Return the constraint associated to this parameter if there is one.
virtual void setValue(double value)
Set the value of this parameter.
A partial implementation of the Parametrizable interface.
void addParameters_(const ParameterList ¶meters)
const std::string & getFrom() const
AliasParameterListener * clone() const
Create a copy of this object and send a pointer to it.
virtual void includeParameters_(const ParameterList ¶meters)
std::map< std::string, std::shared_ptr< AliasParameterListener > > aliasListenersRegister_
virtual bool hasParameter(const std::string &name) const
const std::string & getId() const
ParameterList independentParameters_
virtual const std::string & getName() const
Get the name of this parameter.
void includeParameters_(const ParameterList ¶meters)
void parameterConstraintChanged(ParameterEvent &event)
Notify a constraint change.
void deleteParameter_(std::string &name)
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
const std::string & getAlias() const
virtual void addParameter_(Parameter *parameter)
void parameterNameChanged(ParameterEvent &event)
Notify a renaming action.
AbstractParameterAliasable(const std::string &prefix)
void parameterValueChanged(ParameterEvent &event)
Notify a value change.
AliasParameterListener(const std::string &id, size_t alias, ParameterList *pl, const std::string &from)
virtual void shareParameter_(const std::shared_ptr< Parameter > ¶meter)
void rename(const std::string &name)
virtual void shareParameters_(const ParameterList ¶meters)
virtual void deleteParameter_(size_t index)
void setParameterList(ParameterList *pl)
Inner listener class used by AbstractParameterAliasable.
virtual void addParameters_(const ParameterList ¶meters)
AliasParameterListener(const AliasParameterListener &apl)