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)  

Column.h
Go to the documentation of this file.
1 
11 
30 #ifndef COLUMN_H
31 #define COLUMN_H
32 
33 #include "core/AbstractAspect.h"
35 #include "lib/IntervalAttribute.h"
36 #include "lib/XmlStreamReader.h"
37 
38 #include <memory>
39 
40 class QString;
41 
42 class ColumnStringIO;
43 
45 
58 class Column : public AbstractColumn
59 {
60  Q_OBJECT
61 
62 public:
63  class Private;
64  friend class Private;
66 
70  Column(const QString& name, SciDAVis::ColumnMode mode);
72 
77  template <class D>
78  Column(const QString& name, const D& data,
81  {
82  initPrivate(std::unique_ptr<D>(new D(data)), validity);
83  init();
84  }
85 
86  template <class D>
87  Column(const QString& name, std::unique_ptr<D> data,
90  {
91  initPrivate(std::move(data), validity);
92  init();
93  }
95 
96  ~Column();
97 
99 
100  virtual QIcon icon() const override;
103 
105  SciDAVis::ColumnDataType dataType() const override;
107  bool isReadOnly() const override { return false; };
109 
114  SciDAVis::ColumnMode columnMode() const override;
116 
120  void setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0) override;
122 
128  bool copy(const AbstractColumn * other) override;
130 
139  bool copy(const AbstractColumn * source, int source_start, int dest_start, int num_rows) override;
141 
146  int rowCount() const override;
148  void insertRows(int before, int count) override;
150  void removeRows(int first, int count) override;
156  void clear() override;
158  void notifyReplacement(const AbstractColumn* replacement) override;
160 
167 
169 
170  bool isInvalid(int row) const override;
173  bool isInvalid(Interval<int> i) const override;
175  QList< Interval<int> > invalidIntervals() const override;
177  bool isMasked(int row) const override;
179  bool isMasked(Interval<int> i) const override;
181  QList< Interval<int> > maskedIntervals() const override;
183  void clearValidity() override;
185  void clearMasks() override;
187 
191  void setInvalid(Interval<int> i, bool invalid = true);
193  void setInvalid(int row, bool invalid = true);
195 
199  void setMasked(Interval<int> i, bool mask = true);
201  void setMasked(int row, bool mask = true);
203 
205 
206  QString formula(int row) const override;
209 
220  QList< Interval<int> > formulaIntervals() const override;
222  void setFormula(Interval<int> i, QString formula);
224  void setFormula(int row, QString formula);
226  void clearFormulas() override;
228 
230 
231 
235  QString textAt(int row) const override;
237 
240  void setTextAt(int row, const QString& new_value);
242 
245  void replaceTexts(int first, const QStringList& new_values) override;
247 
250  QDate dateAt(int row) const override;
252 
255  void setDateAt(int row, const QDate& new_value);
257 
260  QTime timeAt(int row) const override;
262 
265  void setTimeAt(int row, const QTime& new_value);
267 
270  QDateTime dateTimeAt(int row) const override;
272 
275  void setDateTimeAt(int row, const QDateTime& new_value);
277 
280  void replaceDateTimes(int first, const QList<QDateTime>& new_values) override;
282  double valueAt(int row) const override;
284 
287  void setValueAt(int row, double new_value);
289 
292  virtual void replaceValues(int first, const QVector<qreal>& new_values) override;
294 
296 
297  void save(QXmlStreamWriter * writer) const override;
300  bool load(XmlStreamReader * reader) override;
301 private:
303  bool XmlReadInputFilter(XmlStreamReader * reader);
305  bool XmlReadOutputFilter(XmlStreamReader * reader);
307  bool XmlReadMask(XmlStreamReader * reader);
309  bool XmlReadFormula(XmlStreamReader * reader);
311  bool XmlReadRow(XmlStreamReader * reader);
313 
314 private slots:
315  void notifyDisplayChange();
316 
317 private:
321 
322  void init();
323  template <class D>
324  void initPrivate(std::unique_ptr<D>, IntervalAttribute<bool>);
325 
326  friend class ColumnStringIO;
327 };
328 
331 {
332  Q_OBJECT
333 
334  public:
335  ColumnStringIO(Column * owner) : AbstractColumn(tr("as string")), d_owner(owner), d_setting(false) {}
336  virtual SciDAVis::ColumnMode columnMode() const { return SciDAVis::Text; }
339  virtual int rowCount() const { return d_owner->rowCount(); }
340  virtual QString textAt(int row) const;
341  virtual void setTextAt(int row, const QString &value);
342  virtual bool isInvalid(int row) const {
343  if (d_setting)
344  return false;
345  else
346  return d_owner->isInvalid(row);
347  }
348  virtual bool copy(const AbstractColumn *other);
349  virtual bool copy(const AbstractColumn *source, int source_start, int dest_start, int num_rows);
350  virtual void replaceTexts(int start_row, const QStringList &texts);
351 
352  private:
354  bool d_setting;
355  QString d_to_set;
356 };
357 
358 #endif
ColumnStringIO::d_owner
Column * d_owner
Definition: Column.h:353
Column::dateTimeAt
QDateTime dateTimeAt(int row) const override
Return the QDateTime in row 'row'.
Definition: Column.cpp:255
Column::asStringColumn
ColumnStringIO * asStringColumn() const
Return a wrapper column object used for String I/O.
Definition: Column.h:166
Column::outputFilter
AbstractSimpleFilter * outputFilter() const
Return the output filter (for data type -> string conversion)
Definition: Column.cpp:593
Column::XmlReadInputFilter
bool XmlReadInputFilter(XmlStreamReader *reader)
Read XML input filter element.
Definition: Column.cpp:462
SciDAVis::TypeQString
@ TypeQString
Definition: globals.h:79
data
Definition: exp_saturation.c:37
Column::invalidIntervals
QList< Interval< int > > invalidIntervals() const override
Return all intervals of invalid rows.
Definition: Column.cpp:608
AbstractFilter
Base class for all analysis operations.
Definition: AbstractFilter.h:77
XmlStreamReader
XML stream parser that supports errors as well as warnings.
Definition: XmlStreamReader.h:42
Column::maskedIntervals
QList< Interval< int > > maskedIntervals() const override
Return all intervals of masked rows.
Definition: Column.cpp:623
ColumnStringIO::rowCount
virtual int rowCount() const
Return the data vector size.
Definition: Column.h:339
ColumnStringIO::d_to_set
QString d_to_set
Definition: Column.h:355
SciDAVis::ColumnDataType
ColumnDataType
Column data type.
Definition: globals.h:77
AbstractSimpleFilter.h
Column
Aspect that manages a column.
Definition: Column.h:59
IntervalAttribute< bool >
A class representing an interval-based attribute (bool version)
Definition: IntervalAttribute.h:198
ColumnStringIO::d_setting
bool d_setting
Definition: Column.h:354
Column::setTimeAt
void setTimeAt(int row, const QTime &new_value)
Set the content of row 'row'.
Definition: Column.cpp:213
Column::timeAt
QTime timeAt(int row) const override
Return the time part of row 'row'.
Definition: Column.cpp:250
Column::formulaIntervals
QList< Interval< int > > formulaIntervals() const override
Return the intervals that have associated formulas.
Definition: Column.cpp:633
Column::replaceDateTimes
void replaceDateTimes(int first, const QList< QDateTime > &new_values) override
Replace a range of values.
Definition: Column.cpp:223
Column::clearValidity
void clearValidity() override
Clear all validity information.
Definition: Column.cpp:152
Column::setColumnMode
void setColumnMode(SciDAVis::ColumnMode mode, AbstractFilter *conversion_filter=0) override
Set the column mode.
Definition: Column.cpp:85
Column::removeRows
void removeRows(int first, int count) override
Remove 'count' rows starting from row 'first'.
Definition: Column.cpp:130
Column::setPlotDesignation
void setPlotDesignation(SciDAVis::PlotDesignation pd)
Set the column plot designation.
Definition: Column.cpp:136
Column::setFormula
void setFormula(Interval< int > i, QString formula)
Set a formula string for an interval of rows.
Definition: Column.cpp:182
SciDAVis::ColumnMode
ColumnMode
The column mode (defines output and input filter for table columns)
Definition: globals.h:66
Column::isInvalid
bool isInvalid(int row) const override
Return whether a certain row contains an invalid value
Definition: Column.cpp:598
Column::d_string_io
ColumnStringIO * d_string_io
Definition: Column.h:320
Column::rowCount
int rowCount() const override
Return the data vector size.
Definition: Column.cpp:583
ColumnStringIO::textAt
virtual QString textAt(int row) const
Return the content of row 'row'.
Definition: Column.cpp:644
IntervalAttribute.h
Column::d_column_private
Private * d_column_private
Pointer to the private data object.
Definition: Column.h:319
Column::clearFormulas
void clearFormulas() override
Clear all formulas.
Definition: Column.cpp:192
Column::clear
void clear() override
Clear the whole column.
Definition: Column.cpp:142
Column::load
bool load(XmlStreamReader *reader) override
Load the column from XML.
Definition: Column.cpp:364
AbstractAspect::name
QString name() const
Definition: AbstractAspect.cpp:229
Column::columnMode
SciDAVis::ColumnMode columnMode() const override
Return the column mode.
Definition: Column.cpp:579
Column::Column
Column(const QString &name, const D &data, IntervalAttribute< bool > validity=IntervalAttribute< bool >())
Ctor.
Definition: Column.h:78
Column::setMasked
void setMasked(Interval< int > i, bool mask=true)
Set an interval masked.
Definition: Column.cpp:172
XmlStreamReader.h
Column::XmlReadFormula
bool XmlReadFormula(XmlStreamReader *reader)
Read XML formula element.
Definition: Column.cpp:501
Column::insertRows
void insertRows(int before, int count) override
Insert some empty (or initialized with zero) rows.
Definition: Column.cpp:124
SciDAVis::Text
@ Text
column contains strings
Definition: globals.h:68
ColumnStringIO::ColumnStringIO
ColumnStringIO(Column *owner)
Definition: Column.h:335
Column::init
void init()
Definition: Column.cpp:70
Column::isMasked
bool isMasked(int row) const override
Return whether a certain row is masked
Definition: Column.cpp:613
Column::dataType
SciDAVis::ColumnDataType dataType() const override
Return the data type of the column.
Definition: Column.cpp:574
Column::~Column
~Column()
Definition: Column.cpp:79
Column::XmlReadRow
bool XmlReadRow(XmlStreamReader *reader)
Read XML row element.
Definition: Column.cpp:519
Column::replaceValues
virtual void replaceValues(int first, const QVector< qreal > &new_values) override
Replace a range of values.
Definition: Column.cpp:234
Column::formula
QString formula(int row) const override
Return the formula associated with row 'row'
Definition: Column.cpp:628
ColumnStringIO::dataType
virtual SciDAVis::ColumnDataType dataType() const
Return the data type of the column.
Definition: Column.h:337
Column::plotDesignation
SciDAVis::PlotDesignation plotDesignation() const override
Return the column plot designation.
Definition: Column.cpp:588
Column::notifyDisplayChange
void notifyDisplayChange()
Definition: Column.cpp:638
ColumnStringIO::plotDesignation
virtual SciDAVis::PlotDesignation plotDesignation() const
Return the column plot designation.
Definition: Column.h:338
Column::Private
Private data class of Column.
Definition: ColumnPrivate.h:44
Column::XmlReadMask
bool XmlReadMask(XmlStreamReader *reader)
Read XML mask element.
Definition: Column.cpp:482
Column::Column
Column(const QString &name, SciDAVis::ColumnMode mode)
Ctor.
Definition: Column.cpp:38
Column::isReadOnly
bool isReadOnly() const override
Return whether the object is read-only.
Definition: Column.h:107
SciDAVis::PlotDesignation
PlotDesignation
Types of plot designations.
Definition: globals.h:55
Column::replaceTexts
void replaceTexts(int first, const QStringList &new_values) override
Replace a range of values.
Definition: Column.cpp:202
ColumnStringIO::setTextAt
virtual void setTextAt(int row, const QString &value)
Definition: Column.cpp:652
Column::clearMasks
void clearMasks() override
Clear all masking information.
Definition: Column.cpp:157
Column::copy
bool copy(const AbstractColumn *other) override
Copy another column of the same type.
Definition: Column.cpp:108
Column::dateAt
QDate dateAt(int row) const override
Return the date part of row 'row'.
Definition: Column.cpp:245
ColumnStringIO::replaceTexts
virtual void replaceTexts(int start_row, const QStringList &texts)
Set the content of row 'row'.
Definition: Column.cpp:677
AbstractSimpleFilter
Simplified filter interface for filters with only one output port.
Definition: AbstractSimpleFilter.h:129
Column::XmlReadOutputFilter
bool XmlReadOutputFilter(XmlStreamReader *reader)
Read XML output filter element.
Definition: Column.cpp:472
Column::icon
virtual QIcon icon() const override
Return an icon to be used for decorating the views and table column headers.
Definition: Column.cpp:265
Column::notifyReplacement
void notifyReplacement(const AbstractColumn *replacement) override
This must be called before the column is replaced by another.
Definition: Column.cpp:147
ColumnStringIO::copy
virtual bool copy(const AbstractColumn *other)
Copy another column of the same type.
Definition: Column.cpp:661
ColumnStringIO
String-IO interface of Column.
Definition: Column.h:331
Column::Column
Column(const QString &name, std::unique_ptr< D > data, IntervalAttribute< bool > validity=IntervalAttribute< bool >())
Definition: Column.h:87
AbstractAspect.h
Interval< int >
Column::save
void save(QXmlStreamWriter *writer) const override
Save the column as XML.
Definition: Column.cpp:279
Column::textAt
QString textAt(int row) const override
Return the content of row 'row'.
Definition: Column.cpp:240
Column::valueAt
double valueAt(int row) const override
Return the double value in row 'row'.
Definition: Column.cpp:260
Column::setTextAt
void setTextAt(int row, const QString &new_value)
Set the content of row 'row'.
Definition: Column.cpp:197
Column::initPrivate
void initPrivate(std::unique_ptr< D >, IntervalAttribute< bool >)
ColumnStringIO::isInvalid
virtual bool isInvalid(int row) const
Return whether a certain row contains an invalid value
Definition: Column.h:342
ColumnStringIO::columnMode
virtual SciDAVis::ColumnMode columnMode() const
Return the column mode.
Definition: Column.h:336
Column::setDateTimeAt
void setDateTimeAt(int row, const QDateTime &new_value)
Set the content of row 'row'.
Definition: Column.cpp:218
Column::setValueAt
void setValueAt(int row, double new_value)
Set the content of row 'row'.
Definition: Column.cpp:229
AbstractColumn
Interface definition for data with column logic.
Definition: AbstractColumn.h:82
Column::setDateAt
void setDateAt(int row, const QDate &new_value)
Set the content of row 'row'.
Definition: Column.cpp:208
Column::setInvalid
void setInvalid(Interval< int > i, bool invalid=true)
Set an interval invalid or valid.
Definition: Column.cpp:162