qwt_interval_data.h

00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_INTERVAL_DATA_H
00011 #define QWT_INTERVAL_DATA_H 1
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_math.h"
00015 #include "qwt_array.h"
00016 #include "qwt_double_interval.h"
00017 #include "qwt_double_rect.h"
00018 
00019 #if defined(_MSC_VER) && (_MSC_VER > 1310)
00020 #include <string.h>
00021 #endif
00022 
00023 #if defined(QWT_TEMPLATEDLL)
00024 // MOC_SKIP_BEGIN
00025 template class QWT_EXPORT QwtArray<QwtDoubleInterval>;
00026 template class QWT_EXPORT QwtArray<double>;
00027 // MOC_SKIP_END
00028 #endif
00029 
00034 class QWT_EXPORT QwtIntervalData
00035 {
00036 public:
00037     QwtIntervalData();
00038     QwtIntervalData(const QwtArray<QwtDoubleInterval> &, 
00039         const QwtArray<double> &);
00040     
00041     void setData(const QwtArray<QwtDoubleInterval> &, 
00042         const QwtArray<double> &);
00043 
00044     size_t size() const;
00045     const QwtDoubleInterval &interval(size_t i) const;
00046     double value(size_t i) const;
00047 
00048     QwtDoubleRect boundingRect() const;
00049 
00050 private:
00051     QwtArray<QwtDoubleInterval> d_intervals;
00052     QwtArray<double> d_values;
00053 };
00054 
00055 inline size_t QwtIntervalData::size() const
00056 {
00057     return qwtMin(d_intervals.size(), d_values.size());
00058 }
00059 
00060 inline const QwtDoubleInterval &QwtIntervalData::interval(size_t i) const
00061 {
00062     return d_intervals[int(i)];
00063 }
00064 
00065 inline double QwtIntervalData::value(size_t i) const
00066 {
00067     return d_values[int(i)];
00068 }
00069 
00070 #endif 

Generated on Mon Feb 26 21:22:36 2007 for Qwt User's Guide by  doxygen 1.4.6