SciDAVis
1.D4
|
Base class for all analysis operations. More...
#include <AbstractFilter.h>
Public Member Functions | |
AbstractFilter (const QString &name) | |
Standard constructor. | |
int | highestConnectedInput () const |
Return the index of the highest input port that is connected. | |
bool | input (int port, const AbstractColumn *source) |
Connect the provided data source to the specified input port. | |
bool | input (const AbstractFilter *sources) |
Connect all outputs of the provided filter to the corresponding inputs of this filter. | |
const AbstractColumn * | input (int port) const |
Return the input currently connected to the specified port, or 0. | |
virtual int | inputCount () const =0 |
Return the number of input ports supported by the filter or -1 if any number of inputs is acceptable. | |
virtual QString | inputLabel (int port) const |
Return the label associated to the given input port. | |
virtual AbstractColumn * | output (int port=0)=0 |
Get the data source associated with the specified output port. | |
virtual const AbstractColumn * | output (int port=0) const =0 |
Overloaded method for const access. | |
virtual int | outputCount () const =0 |
Return the number of output ports provided by the filter. | |
int | portIndexOf (const AbstractColumn *column) |
Return the input port to which the column is connected or -1 if it's not connected. | |
virtual | ~AbstractFilter () |
Destructor. | |
Public Member Functions inherited from AbstractAspect | |
AbstractAspect (const QString &name) | |
void | addChild (AbstractAspect *child) |
Add the given Aspect to my list of children. | |
QString | caption () const |
QString | captionSpec () const |
Return the specification string used for constructing the caption(). | |
AbstractAspect * | child (int index) const |
Get a child by its position in my list of children. | |
int | childCount () const |
Return the number of child Aspects. | |
QString | comment () const |
virtual QMenu * | createContextMenu () const |
Return a new context menu. | |
QDateTime | creationTime () const |
QList< AbstractAspect * > | descendantsThatInherit (const char *class_name) |
Get all descendents that inherit the given class. | |
future::Folder * | folder () |
Return the folder the Aspect is contained in or 0 if not. | |
virtual QIcon | icon () const |
Return an icon to be used for decorating my views. | |
void | importV0x0001XXCreationTime (const QString &str) |
int | index () const |
Return my position in my parent's list of children. | |
int | indexOfChild (const AbstractAspect *child) const |
Return the position of child in my list of children. | |
void | insertChild (AbstractAspect *child, int index) |
Insert the given Aspect at a specific position in my list of children. | |
bool | isDescendantOf (AbstractAspect *other) |
Return whether the there is a path upwards to the given aspect. | |
void | moveChild (int from, int to) |
Change the positon of a child in my list of children. | |
QString | name () const |
AbstractAspect * | parentAspect () const |
Return my parent Aspect or 0 if I currently don't have one. | |
virtual QString | path () const |
Return the path that leads from the top-most Aspect (usually a Project) to me. | |
virtual const Project * | project () const |
Return the Project this Aspect belongs to, or 0 if it is currently not part of one. | |
virtual Project * | project () |
Return the Project this Aspect belongs to, or 0 if it is currently not part of one. | |
virtual void | removeAllChildAspects () |
Remove all child aspects. | |
void | removeChild (AbstractAspect *child, bool detach=false) |
Remove the given Aspect from my list of children. | |
void | removeChild (int index) |
Remove the Aspect at the given index from my list of children. | |
void | reparentChild (AbstractAspect *new_parent, AbstractAspect *child, int d_new_index) |
Move a child to another aspect and transfer ownership. | |
void | reparentChild (AbstractAspect *new_parent, AbstractAspect *child) |
Move a child to another aspect and transfer ownership. | |
virtual | ~AbstractAspect () |
virtual QUndoStack * | undoStack () const |
Return the undo stack of the Project, or 0 if this Aspect is not part of a Project. | |
void | exec (QUndoCommand *command) |
Execute the given command, pushing it on the undoStack() if available. | |
void | beginMacro (const QString &text) |
Begin an undo stack macro (series of commands) | |
void | endMacro () |
End the undo stack macro. | |
virtual void | save (QXmlStreamWriter *) const |
Save as XML. | |
virtual bool | load (XmlStreamReader *) |
Load from XML. |
Protected Slots | |
signal handlers | |
virtual void | inputDescriptionAboutToChange (const AbstractColumn *source) |
Name and/or comment of an input will be changed. | |
void | inputDescriptionAboutToChange (const AbstractAspect *aspect) |
virtual void | inputDescriptionChanged (const AbstractColumn *source) |
Name and/or comment of an input changed. | |
void | inputDescriptionChanged (const AbstractAspect *aspect) |
virtual void | inputPlotDesignationAboutToChange (const AbstractColumn *source) |
The plot designation of an input is about to change. | |
virtual void | inputPlotDesignationChanged (const AbstractColumn *source) |
The plot designation of an input changed. | |
virtual void | inputModeAboutToChange (const AbstractColumn *source) |
The display mode and possibly the data type of an input is about to change. | |
virtual void | inputModeChanged (const AbstractColumn *source) |
The display mode and possibly the data type has changed. | |
virtual void | inputDataAboutToChange (const AbstractColumn *source) |
The data of an input is about to change. | |
virtual void | inputDataChanged (const AbstractColumn *source) |
The data of an input has changed. | |
virtual void | inputAboutToBeReplaced (const AbstractColumn *source, const AbstractColumn *replacement) |
An input is about to be replaced. | |
virtual void | inputRowsAboutToBeInserted (const AbstractColumn *source, int before, int count) |
virtual void | inputRowsInserted (const AbstractColumn *source, int before, int count) |
virtual void | inputRowsAboutToBeRemoved (const AbstractColumn *source, int first, int count) |
virtual void | inputRowsRemoved (const AbstractColumn *source, int first, int count) |
virtual void | inputMaskingAboutToChange (const AbstractColumn *source) |
virtual void | inputMaskingChanged (const AbstractColumn *source) |
void | inputAboutToBeDestroyed (const AbstractColumn *source) |
Protected Member Functions | |
virtual void | inputAboutToBeDisconnected (const AbstractColumn *source) |
Called whenever an input is disconnected or deleted. | |
virtual bool | inputAcceptable (int port, const AbstractColumn *source) |
Give implementations a chance to reject connections to their input ports. | |
Protected Member Functions inherited from AbstractAspect | |
virtual void | completeAspectInsertion (AbstractAspect *aspect, int index) |
Called after a new child has been inserted or added. | |
void | info (const QString &text) |
Implementations should call this whenever status information should be given to the user. | |
virtual void | prepareAspectRemoval (AbstractAspect *aspect) |
Called before a child is removed. | |
void | setCreationTime (const QDateTime &time) |
Set the creation time. | |
bool | readBasicAttributes (XmlStreamReader *reader) |
Load name, creation time and caption spec from XML. | |
void | writeBasicAttributes (QXmlStreamWriter *writer) const |
Save name, creation time and caption spec to XML. | |
void | writeCommentElement (QXmlStreamWriter *writer) const |
Save the comment to XML. | |
bool | readCommentElement (XmlStreamReader *reader) |
Load comment from an XML element. |
Protected Attributes | |
QVector< const AbstractColumn * > | d_inputs |
The data sources connected to my input ports. |
Additional Inherited Members | |
Public Slots inherited from AbstractAspect | |
virtual void | remove () |
Remove me from my parent's list of children. | |
void | setCaptionSpec (const QString &value) |
Set the specification string used for constructing the caption(). | |
void | setComment (const QString &value) |
void | setName (const QString &value) |
QString | uniqueNameFor (const QString ¤t_name) const |
Make the specified name unique among my children by incrementing a trailing number. | |
Signals inherited from AbstractAspect | |
void | aspectAboutToBeAdded (const AbstractAspect *parent, int index) |
Emit this when a parent aspect is about to get a new child inserted. | |
void | aspectAboutToBeRemoved (const AbstractAspect *aspect) |
Emit this from an aspect about to be removed from its parent's children. | |
void | aspectAboutToBeRemoved (const AbstractAspect *parent, int index) |
Emit this from a parent before removing its child. | |
void | aspectAdded (const AbstractAspect *aspect) |
Emit this from a newly added aspect. | |
void | aspectAdded (const AbstractAspect *parent, int index) |
Emit this from a parent after adding a new child to it. | |
void | aspectDescriptionAboutToChange (const AbstractAspect *aspect) |
Emit this before the name, comment or caption spec is changed. | |
void | aspectDescriptionChanged (const AbstractAspect *aspect) |
Emit this when the name, comment or caption spec changed. | |
void | aspectRemoved (const AbstractAspect *parent, int index) |
Emit this from the parent after removing a child. | |
void | statusInfo (const QString &text) |
Emit this to give status information to the user. | |
Static Public Member Functions inherited from AbstractAspect | |
static QVariant | global (const QString &key) |
Retrieve a global setting. | |
static void | setGlobal (const QString &key, const QVariant &value) |
Update a global setting. | |
static void | setGlobalDefault (const QString &key, const QVariant &value) |
Set default value for a global setting. |
Base class for all analysis operations.
AbstractFilter provides an abstraction for analysis operations. It is modelled on an electronic filtering circuit: From the outside, a filter appears as a black box with a number of input and output ports (obviously, those numbers do not necessarily agree).
You can connect one AbstractColumn to each input port using input(int port, AbstractColumn* source). Every output(int port) is realized again by an AbstractColumn, which you can connect to as many other filters, tables or plots as you like. Ownership of the data sources always stays with the class which is providing the data, that is, neither input() nor output() transfer ownership.
Furthermore, you can use inputCount() and outputCount() to query the number of input and output ports, respectively and you can obtain label strings for inputs (via inputLabel()) and outputs (via AbstractColumn::label()). This allows generic filter handling routines to be written, which is important for using filters provided by plugins.
Its simplicity of use notwithstanding, AbstractFilter provides a powerful and versatile basis also for analysis operations that would not commonly be referred to as "filter". An example of such a more advanced filter implementation is StatisticsFilter.
The main design goal was to make implementing new filters as easy as possible. Filters with only one output port can subclass AbstractSimpleFilter, which is even easier to use. Filters with more than one output port have to subclass AbstractFilter directly, which is slightly more involved, because in addition to data transfer between these classes the signals defined by AbstractColumn have to be handled on both inputs and outputs. Signals from data sources connected to the input ports are automatically connected to a matching set of virtual methods, which can be reimplemented by subclasses to handle these events.
While AbstractFilter handles the tedious part of connecting a data source to an input port, its subclasses are given a chance to reject such connections (e.g., based on the data type of the source) by reimplementing inputAcceptable().
|
inline |
Standard constructor.
|
inlinevirtual |
Destructor.
|
inline |
Return the index of the highest input port that is connected.
Note that this is different from both the number of ports that could be connected, inputCount(), and the number of ports that actually have been connected, which are not necessarily sequential. In conjunction with input(int), this method can be used to traverse the connected inputs.
References d_inputs.
bool AbstractFilter::input | ( | int | port, |
const AbstractColumn * | source | ||
) |
Connect the provided data source to the specified input port.
port | the port number to which to connect |
source | the data source to connect to the input port |
The port number is checked for validity against inputCount() and both port number and data source are passed to inputAcceptable() for review. If both checks succeed,the source is recorded in d_inputs. If applicable, the previously connected data source is disconnected before replacing it.
You can also use this method to disconnect an input without replacing it with a new one by calling it with source=0.
References AbstractAspect::aspectDescriptionAboutToChange(), AbstractAspect::aspectDescriptionChanged(), AbstractColumn::columnMode(), d_inputs, inputAboutToBeDestroyed(), inputAboutToBeDisconnected(), inputAboutToBeReplaced(), inputAcceptable(), inputCount(), inputDataAboutToChange(), inputDataChanged(), inputDescriptionAboutToChange(), inputDescriptionChanged(), inputMaskingAboutToChange(), inputMaskingChanged(), inputModeAboutToChange(), inputModeChanged(), inputPlotDesignationAboutToChange(), inputPlotDesignationChanged(), inputRowsAboutToBeInserted(), inputRowsAboutToBeRemoved(), inputRowsInserted(), and inputRowsRemoved().
Referenced by Column::Column(), Table::importASCII(), AsciiTableImportFilter::importAspect(), input(), inputAboutToBeDestroyed(), inputAboutToBeReplaced(), Column::Private::replaceModeData(), Column::Private::setColumnMode(), Column::setColumnMode(), and future::Table::text().
bool AbstractFilter::input | ( | const AbstractFilter * | sources | ) |
Connect all outputs of the provided filter to the corresponding inputs of this filter.
Overloaded method provided for convenience.
References input(), output(), and outputCount().
|
inline |
Return the input currently connected to the specified port, or 0.
References d_inputs.
|
inlineprotectedslot |
References input(), and portIndexOf().
Referenced by input().
|
inlineprotectedvirtual |
Called whenever an input is disconnected or deleted.
This is only to notify implementations of the event, the default implementation is a no-op.
Referenced by input().
|
protectedvirtualslot |
An input is about to be replaced.
This signal is handled by AbstractFilter and mapped to input(int,AbstractColumn*), which calls inputDescriptionAboutToChange(), inputPlotDesignationAboutToChange(), inputDataAboutToChange(), inputMaskingAboutToChange(), inputDescripionChanged(), inputMaskingChanged() inputPlotDesignationChanged() and inputDataChanged(). inputModeAboutToChange() and inputModeChanged() are called if the new column has a different mode (and thereby possibly data type). Thus, filter implementations won't have to bother with it most of the time.
References input(), and portIndexOf().
Referenced by input().
|
inlineprotectedvirtual |
Give implementations a chance to reject connections to their input ports.
If not reimplemented, all connections to ports within [0, inputCount()-1] will be accepted.
Reimplemented in String2DayOfWeekFilter, String2DateTimeFilter, String2MonthFilter, DateTime2StringFilter, String2DoubleFilter, Double2StringFilter, Double2DateTimeFilter, SimpleCopyThroughFilter, Double2MonthFilter, Double2DayOfWeekFilter, DateTime2DoubleFilter, Month2DoubleFilter, and DayOfWeek2DoubleFilter.
Referenced by input().
|
pure virtual |
Return the number of input ports supported by the filter or -1 if any number of inputs is acceptable.
Implemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The data of an input is about to change.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The data of an input has changed.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Name and/or comment of an input will be changed.
source | is always the this pointer of the column that emitted the signal. |
Referenced by input(), and inputDescriptionAboutToChange().
|
inlineprotectedslot |
References inputDescriptionAboutToChange().
|
inlineprotectedvirtualslot |
Name and/or comment of an input changed.
source | is always the this pointer of the column that emitted the signal. |
Referenced by input(), and inputDescriptionChanged().
|
inlineprotectedslot |
References d_inputs, and inputDescriptionChanged().
|
virtual |
Return the label associated to the given input port.
Default labels are In1, In2, ... (or translated equivalents), but implementations can reimplement this method to produce more meaningful labels.
Output ports are implicitly labeled through AbstractAspect::name().
|
inlineprotectedvirtualslot |
Reimplemented in SimpleCopyThroughFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Reimplemented in SimpleCopyThroughFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The display mode and possibly the data type of an input is about to change.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The display mode and possibly the data type has changed.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The plot designation of an input is about to change.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
The plot designation of an input changed.
source | is always the this pointer of the column that emitted the signal. |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
inlineprotectedvirtualslot |
Reimplemented in AbstractSimpleFilter.
Referenced by input().
|
pure virtual |
Get the data source associated with the specified output port.
The returned pointer may be 0 even for valid port numbers, for example if not all required input ports have been connected.
Implemented in AbstractSimpleFilter.
Referenced by input(), and Column::Private::setColumnMode().
|
pure virtual |
Overloaded method for const access.
Implemented in AbstractSimpleFilter.
|
pure virtual |
Return the number of output ports provided by the filter.
Note that this number need not be static, but can be dynamically determined, for example based on the inputs provided to the filter.
Implemented in AbstractSimpleFilter.
Referenced by input().
|
inline |
Return the input port to which the column is connected or -1 if it's not connected.
References d_inputs.
Referenced by inputAboutToBeDestroyed(), and inputAboutToBeReplaced().
|
protected |
The data sources connected to my input ports.
Referenced by AbstractSimpleFilter::columnMode(), AbstractSimpleFilter::dataType(), Double2DayOfWeekFilter::dateAt(), AbstractSimpleFilter::dateAt(), Double2MonthFilter::dateTimeAt(), String2MonthFilter::dateTimeAt(), String2DayOfWeekFilter::dateTimeAt(), Double2DateTimeFilter::dateTimeAt(), String2DateTimeFilter::dateTimeAt(), AbstractSimpleFilter::dateTimeAt(), highestConnectedInput(), input(), inputDescriptionChanged(), String2DoubleFilter::invalidIntervals(), String2MonthFilter::invalidIntervals(), String2DateTimeFilter::invalidIntervals(), String2DayOfWeekFilter::invalidIntervals(), AbstractSimpleFilter::invalidIntervals(), String2DoubleFilter::isInvalid(), String2MonthFilter::isInvalid(), String2DateTimeFilter::isInvalid(), String2DayOfWeekFilter::isInvalid(), AbstractSimpleFilter::isInvalid(), SimpleCopyThroughFilter::isMasked(), SimpleCopyThroughFilter::maskedIntervals(), AbstractSimpleFilter::plotDesignation(), portIndexOf(), AbstractSimpleFilter::rowCount(), DateTime2StringFilter::textAt(), Double2StringFilter::textAt(), AbstractSimpleFilter::textAt(), AbstractSimpleFilter::timeAt(), DayOfWeek2DoubleFilter::valueAt(), DateTime2DoubleFilter::valueAt(), Month2DoubleFilter::valueAt(), String2DoubleFilter::valueAt(), and AbstractSimpleFilter::valueAt().