/* * Range.hh * * Created on: 20 nov. 2013 * Author: CS */ #ifndef RANGE_HH_ #define RANGE_HH_ #include #include #include #include namespace plot { class Range { public: Range() : _extend(true), _range(nan(""), nan("")) { } Range(double min, double max) : _extend(true), _range(min, max) { } Range(const Range& pRange) : _extend(pRange._extend), _range(pRange._range) { } virtual ~Range() { } double getMin() const { return _range.first; } double getMax() const { return _range.second; } void setMin(double min) { _range.first = min; } void setMax(double max) { _range.second = max; } bool isSet() { return !std::isnan(_range.first) || !std::isnan(_range.second); } void dump(std::ostream& out, std::string& prefix) { out << prefix << "range.min=" << getMin() << std::endl; out << prefix << "range.max=" << getMax() << std::endl; } bool _extend; private: std::pair _range; }; inline std::ostream& operator <<(std::ostream& out, const Range& range) { out << "[" << range.getMin() << ", " << range.getMax() << "]" << std::endl; return out; } double extend2UpperValue(double lValue); double extend2LowerValue(double lValue); Range extendRange(Range pRange); void fixRange(Range &pRange, bool isLogScale); } /* namespace plot */ #endif /* RANGE_HH_ */