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)  

AbstractFilter.h
Go to the documentation of this file.
1 
11 
29 #ifndef ABSTRACT_FILTER_H
30 #define ABSTRACT_FILTER_H
31 
32 #include "AbstractAspect.h"
33 #include "AbstractColumn.h"
34 #include <QVector>
35 
77 {
78  Q_OBJECT
79 
80  public:
82  AbstractFilter(const QString& name) : AbstractAspect(name) {}
84  virtual ~AbstractFilter() {}
85 
87  virtual int inputCount() const = 0;
94  virtual int outputCount() const = 0;
103  int highestConnectedInput() const { return d_inputs.count() - 1; }
120  bool input(int port, const AbstractColumn* source);
127  bool input(const AbstractFilter* sources);
129  const AbstractColumn *input(int port) const { return d_inputs.value(port); }
138  virtual QString inputLabel(int port) const;
145  virtual AbstractColumn* output(int port=0) = 0;
147  virtual const AbstractColumn* output(int port=0) const = 0;
148 
150  int portIndexOf(const AbstractColumn * column)
151  {
152  for(int i=0; i<d_inputs.size(); i++)
153  if(d_inputs.at(i) == column) return i;
154  return -1;
155  }
156 
157  protected:
163  virtual bool inputAcceptable(int port, const AbstractColumn *source) {
164  Q_UNUSED(port); Q_UNUSED(source); return true;
165  }
172  virtual void inputAboutToBeDisconnected(const AbstractColumn * source) { Q_UNUSED(source); }
173 
174  protected slots:
175 
177 
178 
183  virtual void inputDescriptionAboutToChange(const AbstractColumn * source) { Q_UNUSED(source); }
185  const AbstractColumn * col = qobject_cast<const AbstractColumn*>(aspect);
186  if (col) inputDescriptionAboutToChange(col);
187  }
189 
194  virtual void inputDescriptionChanged(const AbstractColumn * source) { Q_UNUSED(source); }
196  const AbstractColumn * col = qobject_cast<const AbstractColumn*>(aspect);
197  if (col && d_inputs.contains(col)) inputDescriptionChanged(col);
198  }
204  virtual void inputPlotDesignationAboutToChange(const AbstractColumn * source) { Q_UNUSED(source); }
205 ;
211  virtual void inputPlotDesignationChanged(const AbstractColumn * source) { Q_UNUSED(source); }
217  virtual void inputModeAboutToChange(const AbstractColumn * source) { Q_UNUSED(source); }
223  virtual void inputModeChanged(const AbstractColumn * source) { Q_UNUSED(source); }
229  virtual void inputDataAboutToChange(const AbstractColumn * source) { Q_UNUSED(source); }
235  virtual void inputDataChanged(const AbstractColumn * source) { Q_UNUSED(source); }
248  virtual void inputAboutToBeReplaced(const AbstractColumn * source, const AbstractColumn* replacement);
249 
250  virtual void inputRowsAboutToBeInserted(const AbstractColumn * source, int before, int count) {
251  Q_UNUSED(source); Q_UNUSED(before); Q_UNUSED(count);
252  }
253  virtual void inputRowsInserted(const AbstractColumn * source, int before, int count) {
254  Q_UNUSED(source); Q_UNUSED(before); Q_UNUSED(count);
255  }
256  virtual void inputRowsAboutToBeRemoved(const AbstractColumn * source, int first, int count) {
257  Q_UNUSED(source); Q_UNUSED(first); Q_UNUSED(count);
258  }
259  virtual void inputRowsRemoved(const AbstractColumn * source, int first, int count) {
260  Q_UNUSED(source); Q_UNUSED(first); Q_UNUSED(count);
261  }
262  virtual void inputMaskingAboutToChange(const AbstractColumn * source) {
263  Q_UNUSED(source);
264  }
265  virtual void inputMaskingChanged(const AbstractColumn * source) {
266  Q_UNUSED(source);
267  }
269  input(portIndexOf(source), 0);
270  }
272 
273  protected:
275  QVector<const AbstractColumn*> d_inputs;
276 };
277 
278 #endif // ifndef ABSTRACT_FILTER_H
279 
AbstractFilter::input
bool input(int port, const AbstractColumn *source)
Connect the provided data source to the specified input port.
Definition: AbstractFilter.cpp:31
AbstractFilter::highestConnectedInput
int highestConnectedInput() const
Return the index of the highest input port that is connected.
Definition: AbstractFilter.h:103
AbstractFilter::inputPlotDesignationAboutToChange
virtual void inputPlotDesignationAboutToChange(const AbstractColumn *source)
The plot designation of an input is about to change.
Definition: AbstractFilter.h:204
AbstractFilter::inputDescriptionAboutToChange
void inputDescriptionAboutToChange(const AbstractAspect *aspect)
Definition: AbstractFilter.h:184
AbstractFilter::inputRowsRemoved
virtual void inputRowsRemoved(const AbstractColumn *source, int first, int count)
Definition: AbstractFilter.h:259
AbstractFilter
Base class for all analysis operations.
Definition: AbstractFilter.h:77
AbstractFilter::output
virtual const AbstractColumn * output(int port=0) const =0
Overloaded method for const access.
AbstractFilter::inputMaskingAboutToChange
virtual void inputMaskingAboutToChange(const AbstractColumn *source)
Definition: AbstractFilter.h:262
AbstractFilter::inputDataChanged
virtual void inputDataChanged(const AbstractColumn *source)
The data of an input has changed.
Definition: AbstractFilter.h:235
AbstractFilter::inputDescriptionAboutToChange
virtual void inputDescriptionAboutToChange(const AbstractColumn *source)
Name and/or comment of an input will be changed.
Definition: AbstractFilter.h:183
AbstractFilter::inputRowsAboutToBeRemoved
virtual void inputRowsAboutToBeRemoved(const AbstractColumn *source, int first, int count)
Definition: AbstractFilter.h:256
AbstractFilter::inputMaskingChanged
virtual void inputMaskingChanged(const AbstractColumn *source)
Definition: AbstractFilter.h:265
AbstractFilter::inputAcceptable
virtual bool inputAcceptable(int port, const AbstractColumn *source)
Give implementations a chance to reject connections to their input ports.
Definition: AbstractFilter.h:163
AbstractFilter::inputDataAboutToChange
virtual void inputDataAboutToChange(const AbstractColumn *source)
The data of an input is about to change.
Definition: AbstractFilter.h:229
AbstractFilter::inputModeAboutToChange
virtual void inputModeAboutToChange(const AbstractColumn *source)
The display mode and possibly the data type of an input is about to change.
Definition: AbstractFilter.h:217
AbstractFilter::~AbstractFilter
virtual ~AbstractFilter()
Destructor.
Definition: AbstractFilter.h:84
AbstractFilter::inputRowsAboutToBeInserted
virtual void inputRowsAboutToBeInserted(const AbstractColumn *source, int before, int count)
Definition: AbstractFilter.h:250
AbstractFilter::inputDescriptionChanged
void inputDescriptionChanged(const AbstractAspect *aspect)
Definition: AbstractFilter.h:195
AbstractFilter::inputRowsInserted
virtual void inputRowsInserted(const AbstractColumn *source, int before, int count)
Definition: AbstractFilter.h:253
AbstractFilter::inputLabel
virtual QString inputLabel(int port) const
Return the label associated to the given input port.
Definition: AbstractFilter.cpp:119
AbstractFilter::AbstractFilter
AbstractFilter(const QString &name)
Standard constructor.
Definition: AbstractFilter.h:82
AbstractFilter::inputAboutToBeDestroyed
void inputAboutToBeDestroyed(const AbstractColumn *source)
Definition: AbstractFilter.h:268
AbstractAspect::name
QString name() const
Definition: AbstractAspect.cpp:229
AbstractFilter::inputDescriptionChanged
virtual void inputDescriptionChanged(const AbstractColumn *source)
Name and/or comment of an input changed.
Definition: AbstractFilter.h:194
AbstractFilter::inputCount
virtual int inputCount() const =0
Return the number of input ports supported by the filter or -1 if any number of inputs is acceptable.
AbstractFilter::portIndexOf
int portIndexOf(const AbstractColumn *column)
Return the input port to which the column is connected or -1 if it's not connected.
Definition: AbstractFilter.h:150
AbstractFilter::inputPlotDesignationChanged
virtual void inputPlotDesignationChanged(const AbstractColumn *source)
The plot designation of an input changed.
Definition: AbstractFilter.h:211
AbstractColumn.h
AbstractFilter::outputCount
virtual int outputCount() const =0
Return the number of output ports provided by the filter.
AbstractFilter::output
virtual AbstractColumn * output(int port=0)=0
Get the data source associated with the specified output port.
AbstractFilter::inputModeChanged
virtual void inputModeChanged(const AbstractColumn *source)
The display mode and possibly the data type has changed.
Definition: AbstractFilter.h:223
AbstractFilter::input
const AbstractColumn * input(int port) const
Return the input currently connected to the specified port, or 0.
Definition: AbstractFilter.h:129
AbstractAspect.h
AbstractFilter::inputAboutToBeReplaced
virtual void inputAboutToBeReplaced(const AbstractColumn *source, const AbstractColumn *replacement)
An input is about to be replaced.
Definition: AbstractFilter.cpp:124
AbstractFilter::d_inputs
QVector< const AbstractColumn * > d_inputs
The data sources connected to my input ports.
Definition: AbstractFilter.h:275
AbstractFilter::inputAboutToBeDisconnected
virtual void inputAboutToBeDisconnected(const AbstractColumn *source)
Called whenever an input is disconnected or deleted.
Definition: AbstractFilter.h:172
AbstractAspect
Base class of all persistent objects in a Project.
Definition: AbstractAspect.h:86
AbstractColumn
Interface definition for data with column logic.
Definition: AbstractColumn.h:82