scidavis  2.3.0
About: SciDAVis is a free application for Scientific Data Analysis and Visualization (a fork off of QtiPlot).
  Fossies Dox: scidavis-2.3.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

AbstractColumn.h
Go to the documentation of this file.
1 
11 
30 #ifndef ABSTRACTCOLUMN_H
31 #define ABSTRACTCOLUMN_H
32 
33 #include <QList>
34 #include <QString>
35 #include <QDateTime>
36 #include <QDate>
37 #include <QTime>
38 #include "lib/Interval.h"
39 #include "globals.h"
40 #include "core/AbstractAspect.h"
41 
42 class Column;
44 class QStringList;
45 class AbstractFilter;
46 
48 
82 {
83  Q_OBJECT
84 
85  public:
87  AbstractColumn(const QString& name) : AbstractAspect(name) {}
89  virtual ~AbstractColumn() { aboutToBeDestroyed(this);}
90 
92  virtual SciDAVis::ColumnDataType dataType() const = 0;
94  virtual bool isReadOnly() const { return true; };
96  /*
97  * This function is most used by tables but can also be used
98  * by plots. The column mode specifies how to interpret
99  * the values in the column additional to the data type.
100  */
101  virtual SciDAVis::ColumnMode columnMode() const = 0;
103 
107  virtual void setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0)
108  { Q_UNUSED(mode); Q_UNUSED(conversion_filter);};
110 
116  virtual bool copy(const AbstractColumn * other) { Q_UNUSED(other) return false; };
118 
127  virtual bool copy(const AbstractColumn * source, int source_start, int dest_start, int num_rows)
128  {
129  Q_UNUSED(source)
130  Q_UNUSED(source_start)
131  Q_UNUSED(dest_start)
132  Q_UNUSED(num_rows)
133  return false;
134  };
135 
137  virtual int rowCount() const = 0;
139  virtual void insertRows(int before, int count) { Q_UNUSED(before) Q_UNUSED(count) };
141  virtual void removeRows(int first, int count) { Q_UNUSED(first) Q_UNUSED(count) };
145  //virtual void setPlotDesignation(SciDAVis::PlotDesignation pd) { Q_UNUSED(pd) };
147  virtual void clear() {};
149  virtual void notifyReplacement(const AbstractColumn *replacement) { aboutToBeReplaced(this, replacement); }
150 
152 
153  virtual bool isInvalid(int row) const { return !Interval<int>(0, rowCount()-1).contains(row); }
156  virtual bool isInvalid(Interval<int> i) const { return !Interval<int>(0, rowCount()-1).contains(i); }
158  virtual QList< Interval<int> > invalidIntervals() const { return QList< Interval<int> >(); }
160  virtual bool isMasked(int row) const { Q_UNUSED(row); return false; }
162  virtual bool isMasked(Interval<int> i) const { Q_UNUSED(i); return false; }
164  virtual QList< Interval<int> > maskedIntervals() const { return QList< Interval<int> >(); }
166  virtual void clearValidity() {};
168  virtual void clearMasks() {};
170 
174  //virtual void setInvalid(Interval<int> i, bool invalid = true) { Q_UNUSED(i) Q_UNUSED(invalid) };
176  //virtual void setInvalid(int row, bool invalid = true) { Q_UNUSED(row) Q_UNUSED(invalid) };
178 
182  //virtual void setMasked(Interval<int> i, bool mask = true) { Q_UNUSED(i) Q_UNUSED(mask) };
184  //virtual void setMasked(int row, bool mask = true) { Q_UNUSED(row) Q_UNUSED(mask) };
186 
188 
189  virtual QString formula(int row) const { Q_UNUSED(row); return QString(); }
192 
203  virtual QList< Interval<int> > formulaIntervals() const { return QList< Interval<int> >(); }
205  //virtual void setFormula(Interval<int> i, QString formula) { Q_UNUSED(i) Q_UNUSED(formula) };
207  //virtual void setFormula(int row, QString formula) { Q_UNUSED(row) Q_UNUSED(formula) };
209  virtual void clearFormulas() {};
211 
213 
214 
218  virtual QString textAt(int row) const { Q_UNUSED(row); return ""; }
220 
223  //virtual void setTextAt(int row, const QString& new_value) { Q_UNUSED(row) Q_UNUSED(new_value) };
225 
228  virtual void replaceTexts(int first, const QStringList& new_values) { Q_UNUSED(first) Q_UNUSED(new_values) };
230 
233  virtual QDate dateAt(int row) const { Q_UNUSED(row); return QDate(); };
235 
238  //virtual void setDateAt(int row, const QDate& new_value) { Q_UNUSED(row) Q_UNUSED(new_value) };
240 
243  virtual QTime timeAt(int row) const { Q_UNUSED(row); return QTime(); };
245 
248  //virtual void setTimeAt(int row, const QTime& new_value) { Q_UNUSED(row) Q_UNUSED(new_value) };
250 
253  virtual QDateTime dateTimeAt(int row) const { Q_UNUSED(row); return QDateTime(); };
255 
258  //virtual void setDateTimeAt(int row, const QDateTime& new_value) { Q_UNUSED(row) Q_UNUSED(new_value) };
260 
263  virtual void replaceDateTimes(int first, const QList<QDateTime>& new_values) { Q_UNUSED(first) Q_UNUSED(new_values) };
265 
268  virtual double valueAt(int row) const { Q_UNUSED(row); return 0; };
270 
273  //virtual void setValueAt(int row, double new_value) { Q_UNUSED(row) Q_UNUSED(new_value) };
275 
278  virtual void replaceValues(int first, const QVector<qreal>& new_values) { Q_UNUSED(first) Q_UNUSED(new_values) };
280 
281  signals:
283 
290 
295  void plotDesignationChanged(const AbstractColumn * source);
297 
302  void modeAboutToChange(const AbstractColumn * source);
304 
309  void modeChanged(const AbstractColumn * source);
311 
316  void dataAboutToChange(const AbstractColumn * source);
318 
326  void dataChanged(const AbstractColumn * source);
328 
338  void aboutToBeReplaced(const AbstractColumn * source, const AbstractColumn* new_col);
340 
345  void rowsAboutToBeInserted(const AbstractColumn * source, int before, int count);
347 
352  void rowsInserted(const AbstractColumn * source, int before, int count);
354 
359  void rowsAboutToBeRemoved(const AbstractColumn * source, int first, int count);
361 
366  void rowsRemoved(const AbstractColumn * source, int first, int count);
368  void maskingAboutToChange(const AbstractColumn * source);
370  void maskingChanged(const AbstractColumn * source);
371  // TODO: Check whether aboutToBeDestroyed is needed
373 
378  void aboutToBeDestroyed(const AbstractColumn * source);
379 
380  friend class ColumnPrivate;
381  friend class AbstractSimpleFilter;
382  friend class SimpleMappingFilter;
384 };
385 
386 #endif
AbstractColumn::dataAboutToChange
void dataAboutToChange(const AbstractColumn *source)
Data (including validity) of the column will be changed.
AbstractColumn::modeChanged
void modeChanged(const AbstractColumn *source)
Column mode (possibly also the data type) changed.
AbstractColumn::plotDesignationChanged
void plotDesignationChanged(const AbstractColumn *source)
Column plot designation changed.
AbstractColumn::replaceValues
virtual void replaceValues(int first, const QVector< qreal > &new_values)
Set the content of row 'row'.
Definition: AbstractColumn.h:278
AbstractColumn::insertRows
virtual void insertRows(int before, int count)
Insert some empty (or initialized with zero) rows.
Definition: AbstractColumn.h:139
AbstractColumn::textAt
virtual QString textAt(int row) const
Return the content of row 'row'.
Definition: AbstractColumn.h:218
AbstractColumn::aboutToBeDestroyed
void aboutToBeDestroyed(const AbstractColumn *source)
Emitted shortly before this data source is deleted.
AbstractColumn::formulaIntervals
virtual QList< Interval< int > > formulaIntervals() const
Return the intervals that have associated formulas.
Definition: AbstractColumn.h:203
AbstractColumn::removeRows
virtual void removeRows(int first, int count)
Remove 'count' rows starting from row 'first'.
Definition: AbstractColumn.h:141
AbstractFilter
Base class for all analysis operations.
Definition: AbstractFilter.h:77
SciDAVis::ColumnDataType
ColumnDataType
Column data type.
Definition: globals.h:77
AbstractColumn::SimpleMappingFilter
friend class SimpleMappingFilter
Definition: AbstractColumn.h:382
AbstractColumn::maskingChanged
void maskingChanged(const AbstractColumn *source)
IntervalAttribute related signal.
Column
Aspect that manages a column.
Definition: Column.h:59
AbstractColumn::AbstractColumn
AbstractColumn(const QString &name)
Ctor.
Definition: AbstractColumn.h:87
AbstractColumn::dataType
virtual SciDAVis::ColumnDataType dataType() const =0
Return the data type of the column.
AbstractColumn::rowsInserted
void rowsInserted(const AbstractColumn *source, int before, int count)
Rows have been inserted.
AbstractColumn::columnMode
virtual SciDAVis::ColumnMode columnMode() const =0
Return the column mode.
AbstractColumn::~AbstractColumn
virtual ~AbstractColumn()
Dtor.
Definition: AbstractColumn.h:89
AbstractColumn::rowCount
virtual int rowCount() const =0
Return the data vector size.
AbstractColumn::maskingAboutToChange
void maskingAboutToChange(const AbstractColumn *source)
IntervalAttribute related signal.
AbstractColumn::valueAt
virtual double valueAt(int row) const
Return the double value in row 'row'.
Definition: AbstractColumn.h:268
SciDAVis::ColumnMode
ColumnMode
The column mode (defines output and input filter for table columns)
Definition: globals.h:66
globals.h
AbstractColumn::replaceDateTimes
virtual void replaceDateTimes(int first, const QList< QDateTime > &new_values)
Set the content of row 'row'.
Definition: AbstractColumn.h:263
AbstractColumn::maskedIntervals
virtual QList< Interval< int > > maskedIntervals() const
Return all intervals of masked rows.
Definition: AbstractColumn.h:164
AbstractColumn::ColumnPrivate
friend class ColumnPrivate
Definition: AbstractColumn.h:380
AbstractColumn::dateAt
virtual QDate dateAt(int row) const
Return the date part of row 'row'.
Definition: AbstractColumn.h:233
AbstractColumn::timeAt
virtual QTime timeAt(int row) const
Set the content of row 'row'.
Definition: AbstractColumn.h:243
AbstractColumn::rowsRemoved
void rowsRemoved(const AbstractColumn *source, int first, int count)
Rows have been deleted.
AbstractColumn::modeAboutToChange
void modeAboutToChange(const AbstractColumn *source)
Column mode (possibly also the data type) will be changed.
AbstractAspect::name
QString name() const
Definition: AbstractAspect.cpp:229
AbstractColumn::dateTimeAt
virtual QDateTime dateTimeAt(int row) const
Set the content of row 'row'.
Definition: AbstractColumn.h:253
AbstractColumn::clearMasks
virtual void clearMasks()
Clear all masking information.
Definition: AbstractColumn.h:168
AbstractColumn::rowsAboutToBeInserted
void rowsAboutToBeInserted(const AbstractColumn *source, int before, int count)
Rows will be inserted.
AbstractColumn::isMasked
virtual bool isMasked(Interval< int > i) const
Return whether a certain interval of rows rows is fully masked
Definition: AbstractColumn.h:162
AbstractColumn::copy
virtual bool copy(const AbstractColumn *other)
Copy another column of the same type.
Definition: AbstractColumn.h:116
AbstractColumn::isMasked
virtual bool isMasked(int row) const
Return whether a certain row is masked
Definition: AbstractColumn.h:160
AbstractColumn::invalidIntervals
virtual QList< Interval< int > > invalidIntervals() const
Return all intervals of invalid rows.
Definition: AbstractColumn.h:158
AbstractColumn::setColumnMode
virtual void setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0)
Set the column mode.
Definition: AbstractColumn.h:107
AbstractColumn::aboutToBeReplaced
void aboutToBeReplaced(const AbstractColumn *source, const AbstractColumn *new_col)
The column will be replaced.
AbstractColumn::isInvalid
virtual bool isInvalid(Interval< int > i) const
Return whether a certain interval of rows contains only invalid values
Definition: AbstractColumn.h:156
AbstractColumn::clear
virtual void clear()
Set the column plot designation.
Definition: AbstractColumn.h:147
AbstractColumn::copy
virtual bool copy(const AbstractColumn *source, int source_start, int dest_start, int num_rows)
Copies part of another column of the same type.
Definition: AbstractColumn.h:127
AbstractColumn::formula
virtual QString formula(int row) const
Return the formula associated with row 'row'
Definition: AbstractColumn.h:190
SciDAVis::PlotDesignation
PlotDesignation
Types of plot designations.
Definition: globals.h:55
SimpleCopyThroughFilter
Filter which copies the provided input unaltered to the output.
Definition: SimpleCopyThroughFilter.h:48
AbstractColumn::notifyReplacement
virtual void notifyReplacement(const AbstractColumn *replacement)
This must be called before the column is replaced by another.
Definition: AbstractColumn.h:149
AbstractSimpleFilter
Simplified filter interface for filters with only one output port.
Definition: AbstractSimpleFilter.h:129
AbstractColumn::rowsAboutToBeRemoved
void rowsAboutToBeRemoved(const AbstractColumn *source, int first, int count)
Rows will be deleted.
AbstractColumn::isReadOnly
virtual bool isReadOnly() const
Return whether the object is read-only.
Definition: AbstractColumn.h:94
AbstractColumn::replaceTexts
virtual void replaceTexts(int first, const QStringList &new_values)
Set the content of row 'row'.
Definition: AbstractColumn.h:228
AbstractColumn::isInvalid
virtual bool isInvalid(int row) const
Return whether a certain row contains an invalid value
Definition: AbstractColumn.h:154
AbstractAspect.h
AbstractColumn::clearValidity
virtual void clearValidity()
Clear all validity information.
Definition: AbstractColumn.h:166
Interval< int >
AbstractColumn::plotDesignation
virtual SciDAVis::PlotDesignation plotDesignation() const =0
Return the column plot designation.
AbstractColumn::dataChanged
void dataChanged(const AbstractColumn *source)
Data (including validity) of the column has changed.
AbstractAspect
Base class of all persistent objects in a Project.
Definition: AbstractAspect.h:86
AbstractColumn::plotDesignationAboutToChange
void plotDesignationAboutToChange(const AbstractColumn *source)
Column plot designation will be changed.
Interval.h
AbstractColumn
Interface definition for data with column logic.
Definition: AbstractColumn.h:82
AbstractColumn::clearFormulas
virtual void clearFormulas()
Set a formula string for an interval of rows.
Definition: AbstractColumn.h:209