11 #include "../Text/TextTools.h" 24 Parameter::Parameter(
const std::string& name,
double value, std::shared_ptr<ConstraintInterface> constraint,
double precision) :
25 name_(name), value_(0), precision_(0), constraint_(constraint), listeners_()
78 if (constraint !=
nullptr && !constraint->isCorrect(
value_))
97 [&listenerId](std::shared_ptr<ParameterListener>& pl) {
98 return pl->getId() == listenerId;
108 if (listener->getId() == listenerId)
static const std::shared_ptr< IntervalConstraint > R_PLUS
Parameter()
Default contructor. Creates a parameter with no name, no constraint, and a value of 0...
std::vector< std::shared_ptr< ParameterListener > > listeners_
ParameterEvent(Parameter *parameter)
An interval, either bounded or not, which can also have infinite bounds.
void fireParameterValueChanged(ParameterEvent &event)
This class is designed to facilitate the manipulation of parameters.
virtual void setConstraint(std::shared_ptr< ConstraintInterface > constraint)
Set a constraint to this parameter.
void setPrecision(double precision)
Set the precision of this parameter.
virtual void removeParameterListener(const std::string &listenerId)
Remove all listeners with a given id from this parameter.
virtual void setValue(double value)
Set the value of this parameter.
static const std::shared_ptr< IntervalConstraint > R_MINUS
static const std::shared_ptr< IntervalConstraint > R_MINUS_STAR
static const std::shared_ptr< IntervalConstraint > PROP_CONSTRAINT_EX
static const std::shared_ptr< IntervalConstraint > PROP_CONSTRAINT_IN
virtual bool hasParameterListener(const std::string &listenerId)
Tell is there is a listener with a given id from this parameter.
std::shared_ptr< ConstraintInterface > constraint_
Exception thrown when a value do not match a given constraint.
virtual const ConstraintInterface & constraint() const
Return the constraint associated to this parameter if there is one.
Parameter & operator=(const Parameter ¶m)
Assignment operator.
virtual std::shared_ptr< ConstraintInterface > removeConstraint()
Remove the constraint associated to this parameter.
static const std::shared_ptr< IntervalConstraint > R_PLUS_STAR