qwt_series_store.h
Go to the documentation of this file.
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_SERIES_STORE_H
11 #define QWT_SERIES_STORE_H
12 
13 #include "qwt_global.h"
14 #include "qwt_series_data.h"
15 
25 {
26 protected:
29 
30 #ifndef QWT_PYTHON_WRAPPER
31  virtual void dataChanged() = 0;
33 
38  virtual void setRectOfInterest( const QRectF & ) = 0;
39 
41  virtual QRectF dataRect() const = 0;
42 
44  virtual size_t dataSize() const = 0;
45 #else
46  // Needed for generating the python bindings, but not for using them !
47  virtual void dataChanged() {}
48  virtual void setRectOfInterest( const QRectF & ) {}
49  virtual QRectF dataRect() const { return QRectF( 0.0, 0.0, -1.0, -1.0 ); }
50  virtual size_t dataSize() const { return 0; }
51 #endif
52 };
53 
64 template <typename T>
66 {
67 public:
72  explicit QwtSeriesStore<T>();
73 
76 
84  void setData( QwtSeriesData<T> *series );
85 
88 
90  const QwtSeriesData<T> *data() const;
91 
96  T sample( int index ) const;
97 
102  virtual size_t dataSize() const;
103 
110  virtual QRectF dataRect() const;
111 
118  virtual void setRectOfInterest( const QRectF &rect );
119 
126  QwtSeriesData<T> *swapData( QwtSeriesData<T> *series );
127 
128 private:
130 };
131 
132 template <typename T>
134  d_series( NULL )
135 {
136 }
137 
138 template <typename T>
140 {
141  delete d_series;
142 }
143 
144 template <typename T>
146 {
147  return d_series;
148 }
149 
150 template <typename T>
152 {
153  return d_series;
154 }
155 
156 template <typename T>
157 inline T QwtSeriesStore<T>::sample( int index ) const
158 {
159  return d_series ? d_series->sample( index ) : T();
160 }
161 
162 template <typename T>
164 {
165  if ( d_series != series )
166  {
167  delete d_series;
168  d_series = series;
169  dataChanged();
170  }
171 }
172 
173 template <typename T>
175 {
176  if ( d_series == NULL )
177  return 0;
178 
179  return d_series->size();
180 }
181 
182 template <typename T>
184 {
185  if ( d_series == NULL )
186  return QRectF( 1.0, 1.0, -2.0, -2.0 ); // invalid
187 
188  return d_series->boundingRect();
189 }
190 
191 template <typename T>
192 void QwtSeriesStore<T>::setRectOfInterest( const QRectF &rect )
193 {
194  if ( d_series )
195  d_series->setRectOfInterest( rect );
196 }
197 
198 template <typename T>
200 {
201  QwtSeriesData<T> * swappedSeries = d_series;
202  d_series = series;
203 
204  return swappedSeries;
205 }
206 
207 #endif
QwtSeriesData< T > * d_series
virtual size_t dataSize() const
Abstract interface for iterating over samples.
QwtSeriesStore()
Constructor The store contains no series.
virtual void setRectOfInterest(const QRectF &rect)
void setData(QwtSeriesData< T > *series)
~QwtSeriesStore()
Destructor.
QwtSeriesData< T > * data()
virtual void dataChanged()=0
dataChanged() indicates, that the series has been changed.
virtual void setRectOfInterest(const QRectF &)=0
Class storing a QwtSeriesData object.
Bridge between QwtSeriesStore and QwtPlotSeriesItem.
virtual QRectF dataRect() const
T sample(int index) const
virtual ~QwtAbstractSeriesStore()
Destructor.
virtual size_t dataSize() const =0
QwtSeriesData< T > * swapData(QwtSeriesData< T > *series)
empty_struct data[sizeof(T)/sizeof(empty_struct)]
virtual QRectF dataRect() const =0


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17