~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt-5.1.1/src/qwt_interval_data.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-05-26 10:26:31 UTC
  • mfrom: (1.1.3 upstream) (2.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080526102631-bp95mfccnrb957nx
Tags: 5.1.1-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
 
2
 * Qwt Widget Library
 
3
 * Copyright (C) 1997   Josef Wilgen
 
4
 * Copyright (C) 2002   Uwe Rathmann
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the Qwt License, Version 1.0
 
8
 *****************************************************************************/
 
9
 
 
10
#ifndef QWT_INTERVAL_DATA_H
 
11
#define QWT_INTERVAL_DATA_H 1
 
12
 
 
13
#include "qwt_global.h"
 
14
#include "qwt_math.h"
 
15
#include "qwt_array.h"
 
16
#include "qwt_double_interval.h"
 
17
#include "qwt_double_rect.h"
 
18
 
 
19
#if defined(_MSC_VER) && (_MSC_VER > 1310)
 
20
#include <string.h>
 
21
#endif
 
22
 
 
23
#if defined(QWT_TEMPLATEDLL)
 
24
// MOC_SKIP_BEGIN
 
25
template class QWT_EXPORT QwtArray<QwtDoubleInterval>;
 
26
template class QWT_EXPORT QwtArray<double>;
 
27
// MOC_SKIP_END
 
28
#endif
 
29
 
 
30
/*!
 
31
  \brief Interval data class.
 
32
 
 
33
*/
 
34
class QWT_EXPORT QwtIntervalData
 
35
{
 
36
public:
 
37
    QwtIntervalData();
 
38
    QwtIntervalData(const QwtArray<QwtDoubleInterval> &, 
 
39
        const QwtArray<double> &);
 
40
    
 
41
    void setData(const QwtArray<QwtDoubleInterval> &, 
 
42
        const QwtArray<double> &);
 
43
 
 
44
    size_t size() const;
 
45
    const QwtDoubleInterval &interval(size_t i) const;
 
46
    double value(size_t i) const;
 
47
 
 
48
    QwtDoubleRect boundingRect() const;
 
49
 
 
50
private:
 
51
    QwtArray<QwtDoubleInterval> d_intervals;
 
52
    QwtArray<double> d_values;
 
53
};
 
54
 
 
55
inline size_t QwtIntervalData::size() const
 
56
{
 
57
    return qwtMin(d_intervals.size(), d_values.size());
 
58
}
 
59
 
 
60
inline const QwtDoubleInterval &QwtIntervalData::interval(size_t i) const
 
61
{
 
62
    return d_intervals[int(i)];
 
63
}
 
64
 
 
65
inline double QwtIntervalData::value(size_t i) const
 
66
{
 
67
    return d_values[int(i)];
 
68
}
 
69
 
 
70
#endif