/* * ContinuousValue.hpp * * Created on: Sep 28, 2011 * Author: heber */ #ifndef CONTINUOUSVALUE_HPP_ #define CONTINUOUSVALUE_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include "Range.hpp" #include "ValueInterface.hpp" class ContinuousValueTest; /** This class represents a discrete value, it implements ValueInterface. * */ template class ContinuousValue : virtual public ValueInterface { //!> unit test needs to have access to internal values friend class ContinuousValueTest; public: ContinuousValue(); ContinuousValue(const range &_ValidRange); virtual ~ContinuousValue(); // functions for ValueInterface bool isValid(const T & _value) const; const T & get() const; void set(const T & _value); // comfortable setter void operator=(const T &_value) { set(_value); } // comparator bool operator==(const ContinuousValue &_instance) const; bool operator!=(const ContinuousValue &_instance) const { return !((*this)==(_instance)); } // getter/setter for valid ranges void setValidRange(const range &_range); const range & getValidRange() const; // string functions for ValueInterface bool isValidAsString(const std::string _value) const; const std::string getAsString() const; void setAsString(const std::string _value); private: //!> whether \a value has been set bool ValueSet; //!> contained value T value; //!> whether \a min, i.e. a minimal value, has been set range ValidRangeSet; //!> valid range of values range ValidRange; }; #include "ContinuousValue_impl.hpp" #endif /* CONTINUOUSVALUE_HPP_ */