/* * 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 "CodePatterns/Range.hpp" #include "CodePatterns/toString.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 std::string _value) const; const std::string get() const; void set(const std::string _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; // internal functions alike to ValueInterface bool isValidValue(const T &_value) const; void setValue(const T &_value); const T &getValue() const; private: //!> Internal converter from string to internal type static ConvertTo Converter; //!> 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_ */