44 #include "../Text/TextTools.h" 59 name_(name), value_(0), precision_(0), constraint_(constraint), attach_(attachConstraint), listeners_(), listenerAttach_()
63 setPrecision(precision);
68 name_(name), value_(0), precision_(0), constraint_(constraint ? constraint->clone() : 0), attach_(
true), listeners_(), listenerAttach_()
72 setPrecision(precision);
78 precision_(p.precision_),
81 listeners_(p.listeners_),
82 listenerAttach_(p.listenerAttach_)
105 for (
size_t i = 0; i <
listeners_.size(); i++)
116 for (
size_t i = 0; i <
listeners_.size(); i++)
125 if (std::abs(value-value_)>precision_/2){
126 if (constraint_ && !constraint_->isCorrect(value))
130 fireParameterValueChanged(event);
174 for (
unsigned int i = 0; i <
listeners_.size(); i++)
189 for (
unsigned int i = 0; i <
listeners_.size(); i++)
The parameter listener interface.
static const IntervalConstraint R_MINUS_STAR
virtual const Constraint * removeConstraint()
Remove the constraint associated to this parameter.
Parameter()
Default contructor. Creates a parameter with no name, no constraint, and a value of 0...
ParameterEvent(Parameter *parameter)
An interval, either bounded or not, which can also have infinite bounds.
This class allows to perform a correspondence analysis.
std::vector< ParameterListener * > listeners_
static const IntervalConstraint PROP_CONSTRAINT_EX
This class is designed to facilitate the manipulation of parameters.
static const IntervalConstraint R_PLUS_STAR
void setPrecision(double precision)
Set the precision of this parameter.
virtual bool isCorrect(double value) const =0
Tell if a given value is correct.
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 IntervalConstraint R_MINUS
virtual void setConstraint(Constraint *constraint, bool attach=false)
Set a constraint to this parameter.
Constraint * clone() const =0
Create a copy of this object and send a pointer to it.
The constraint interface.
virtual bool hasParameterListener(const std::string &listenerId)
Tell is there is a listener with a given id from this parameter.
static const IntervalConstraint PROP_CONSTRAINT_IN
Exception thrown when a value do not match a given constraint.
std::vector< bool > listenerAttach_
static const IntervalConstraint R_PLUS
Parameter & operator=(const Parameter ¶m)
Assignment operator.