OpenMS
TOPPASVertex Class Referenceabstract

The base class of the different vertex classes. More...

#include <OpenMS/VISUAL/TOPPASVertex.h>

Inheritance diagram for TOPPASVertex:
[legend]
Collaboration diagram for TOPPASVertex:
[legend]

Classes

class  TOPPASFilenames
 
struct  VertexRoundPackage
 Info for one edge and round, to be passed to next node. More...
 

Public Types

enum  DFS_COLOR { DFS_WHITE , DFS_GRAY , DFS_BLACK }
 The color of a vertex during depth-first search. More...
 
enum  SUBSTREESTATUS { TV_ALLFINISHED , TV_UNFINISHED , TV_UNFINISHED_INBRANCH }
 The color of a vertex during depth-first search. More...
 
typedef QList< TOPPASEdge * > EdgeContainer
 The container for in/out edges. More...
 
typedef EdgeContainer::iterator EdgeIterator
 A mutable iterator for in/out edges. More...
 
typedef EdgeContainer::const_iterator ConstEdgeIterator
 A const iterator for in/out edges. More...
 
typedef std::map< Int, VertexRoundPackageRoundPackage
 
typedef RoundPackage::const_iterator RoundPackageConstIt
 
typedef RoundPackage::iterator RoundPackageIt
 
typedef std::vector< RoundPackageRoundPackages
 all information a node needs to process all rounds More...
 

Public Slots

virtual void inEdgeHasChanged ()
 Called by an incoming edge when it has changed. More...
 
virtual void outEdgeHasChanged ()
 Called by an outgoing edge when it has changed. More...
 

Signals

void clicked ()
 Emitted when this item is clicked. More...
 
void released ()
 Emitted when this item is released. More...
 
void hoveringEdgePosChanged (const QPointF &new_pos)
 Emitted when the position of the hovering edge changes. More...
 
void newHoveringEdge (const QPointF &pos)
 Emitted when a new out edge is supposed to be created. More...
 
void finishHoveringEdge ()
 Emitted when the mouse is released after having dragged a new edge somewhere. More...
 
void somethingHasChanged ()
 Emitted when something has changed. More...
 
void itemDragged (qreal dx, qreal dy)
 Emitted when the item is dragged. More...
 
void parameterChanged (const bool invalidates_running_pipeline)
 

Public Member Functions

 TOPPASVertex ()
 Default Constructor. More...
 
 TOPPASVertex (const TOPPASVertex &rhs)
 Copy constructor. More...
 
 ~TOPPASVertex () override=default
 Destructor. More...
 
TOPPASVertexoperator= (const TOPPASVertex &rhs)
 Assignment operator. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *, bool round_shape=true)
 base paint method for all derived classes. should be called first in child-class paint More...
 
bool buildRoundPackages (RoundPackages &pkg, String &error_msg)
 
bool isUpstreamFinished () const
 check if all upstream nodes are ready to go ( 'finished_' is true) More...
 
QRectF boundingRect () const override=0
 Returns the bounding rectangle of this item. More...
 
QPainterPath shape () const final
 Returns a more precise shape. More...
 
ConstEdgeIterator outEdgesBegin () const
 Returns begin() iterator of outgoing edges. More...
 
ConstEdgeIterator outEdgesEnd () const
 Returns end() iterator of outgoing edges. More...
 
ConstEdgeIterator inEdgesBegin () const
 Returns begin() iterator of incoming edges. More...
 
ConstEdgeIterator inEdgesEnd () const
 Returns end() iterator of incoming edges. More...
 
Size incomingEdgesCount ()
 Returns the number of incoming edges. More...
 
Size outgoingEdgesCount ()
 Returns the number of outgoing edges. More...
 
void addInEdge (TOPPASEdge *edge)
 Adds an incoming edge. More...
 
void addOutEdge (TOPPASEdge *edge)
 Adds an outgoing edge. More...
 
void removeInEdge (TOPPASEdge *edge)
 Removes an incoming edge. More...
 
void removeOutEdge (TOPPASEdge *edge)
 Removes an outgoing edge. More...
 
DFS_COLOR getDFSColor ()
 Returns the DFS color of this node. More...
 
void setDFSColor (DFS_COLOR color)
 Sets the DFS color of this node. More...
 
TOPPASVertex::SUBSTREESTATUS getSubtreeStatus () const
 Checks if all tools in the subtree below this node are finished. More...
 
bool isTopoSortMarked () const
 Returns whether the vertex has been marked already (during topological sort) More...
 
void setTopoSortMarked (bool b)
 (Un)marks the vertex (during topological sort) More...
 
UInt getTopoNr () const
 Returns the topological sort number. More...
 
virtual void setTopoNr (UInt nr)
 Sets the topological sort number (overridden in tool and output vertices) More...
 
virtual void reset (bool reset_all_files=false)
 
virtual void markUnreachable ()
 Marks this node (and everything further downstream) as unreachable. Overridden behavior in mergers. More...
 
bool isReachable () const
 Returns whether this node is reachable. More...
 
bool isFinished () const
 Returns whether this node has already been processed during the current pipeline execution. More...
 
virtual void run ()
 
virtual bool invertRecylingMode ()
 invert status of recycling More...
 
bool isRecyclingEnabled () const
 get status of recycling More...
 
void setRecycling (const bool is_enabled)
 set status of recycling More...
 
virtual String getName () const =0
 
QStringList getFileNames (int param_index, int round) const
 gets filenames for a certain output parameter (from this vertex), for a certain TOPPAS round More...
 
QStringList getFileNames () const
 get all output files for all parameters for all rounds More...
 
const RoundPackagesgetOutputFiles () const
 
bool allInputsReady () const
 check if all upstream nodes are finished More...
 

Protected Member Functions

reimplemented Qt events
void mouseReleaseEvent (QGraphicsSceneMouseEvent *e) override
 
void mousePressEvent (QGraphicsSceneMouseEvent *e) override
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *e) override
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *e) override
 
void contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override
 
virtual void moveNewEdgeTo_ (const QPointF &pos)
 Moves the target pos of the edge which is just being created to pos. More...
 
String get3CharsNumber_ (UInt number) const
 Returns a three character string (i.e. 001 instead of 1) for the given number. More...
 
void debugOut_ (const String &) const
 Displays the debug output message, if TOPPAS_DEBUG is defined. More...
 

Protected Attributes

EdgeContainer in_edges_
 The list of incoming edges. More...
 
EdgeContainer out_edges_
 The list of outgoing edges. More...
 
bool edge_being_created_ {false}
 Indicates whether a new out edge is currently being created. More...
 
QColor pen_color_ {Qt::black}
 The color of the pen. More...
 
QColor brush_color_ { Qt::lightGray}
 The color of the brush. More...
 
DFS_COLOR dfs_color_ {DFS_WHITE}
 The DFS color of this node. More...
 
bool topo_sort_marked_ {false}
 "marked" flag for topological sort More...
 
UInt topo_nr_
 The number in a topological sort of the entire graph. More...
 
RoundPackages output_files_
 Stores the current output file names for each output parameter. More...
 
int round_total_ {-1}
 number of rounds this node will do ('Merge All' nodes will pass everything, thus do only one round) More...
 
int round_counter_ {0}
 currently finished number of rounds (TODO: do we need that?) More...
 
bool finished_ {false}
 Stores whether this node has already been processed during the current pipeline execution. More...
 
bool reachable_ {true}
 Indicates whether this node is reachable (i.e. there is an input node somewhere further upstream) More...
 
bool allow_output_recycling_ {false}
 shall subsequent tools be allowed to recycle the output of this node to match the number of rounds imposed by other parent nodes? More...
 

Detailed Description

The base class of the different vertex classes.

This class contains the common functionality (such as event handling for mouse clicks and drags) and holds the common members of all different kinds of vertices (e.g., containers for all in and out edges, the vertex ID, the number of a topological sort of the whole graph, etc.)


Class Documentation

◆ OpenMS::TOPPASVertex::VertexRoundPackage

struct OpenMS::TOPPASVertex::VertexRoundPackage

Info for one edge and round, to be passed to next node.

Collaboration diagram for TOPPASVertex::VertexRoundPackage:
[legend]
Class Members
TOPPASEdge * edge edge that connects the upstream node to the current one
TOPPASFilenames filenames filenames passed from upstream node in this round

Member Typedef Documentation

◆ ConstEdgeIterator

typedef EdgeContainer::const_iterator ConstEdgeIterator

A const iterator for in/out edges.

◆ EdgeContainer

typedef QList<TOPPASEdge *> EdgeContainer

The container for in/out edges.

◆ EdgeIterator

typedef EdgeContainer::iterator EdgeIterator

A mutable iterator for in/out edges.

◆ RoundPackage

typedef std::map<Int, VertexRoundPackage> RoundPackage

all infos to process one round for a vertex (from all incoming vertices) indexing via "parameter_index" of adjacent edge (could later be param_name) -> filenames Index for input and output edges is (-1) implicitly, thus we need signed type warning: the index refers to either input OR output (depending on if this structure is used for input files storage or output files storage)

◆ RoundPackageConstIt

typedef RoundPackage::const_iterator RoundPackageConstIt

◆ RoundPackageIt

typedef RoundPackage::iterator RoundPackageIt

◆ RoundPackages

typedef std::vector<RoundPackage> RoundPackages

all information a node needs to process all rounds

Member Enumeration Documentation

◆ DFS_COLOR

enum DFS_COLOR

The color of a vertex during depth-first search.

Enumerator
DFS_WHITE 
DFS_GRAY 
DFS_BLACK 

◆ SUBSTREESTATUS

The color of a vertex during depth-first search.

Enumerator
TV_ALLFINISHED 

all downstream nodes are done (including the ones which are feed by a parallel subtree)

TV_UNFINISHED 

some direct downstream node is not done

TV_UNFINISHED_INBRANCH 

a parallel subtree which merged with some downstream node A was not done (which prevented processing of the node A)

Constructor & Destructor Documentation

◆ TOPPASVertex() [1/2]

Default Constructor.

◆ TOPPASVertex() [2/2]

TOPPASVertex ( const TOPPASVertex rhs)

Copy constructor.

◆ ~TOPPASVertex()

~TOPPASVertex ( )
overridedefault

Destructor.

Member Function Documentation

◆ addInEdge()

void addInEdge ( TOPPASEdge edge)

Adds an incoming edge.

◆ addOutEdge()

void addOutEdge ( TOPPASEdge edge)

Adds an outgoing edge.

◆ allInputsReady()

bool allInputsReady ( ) const

check if all upstream nodes are finished

◆ boundingRect()

QRectF boundingRect ( ) const
overridepure virtual

Returns the bounding rectangle of this item.

Implemented in TOPPASToolVertex, TOPPASSplitterVertex, TOPPASOutputFileListVertex, TOPPASMergerVertex, and TOPPASInputFileListVertex.

◆ buildRoundPackages()

bool buildRoundPackages ( RoundPackages pkg,
String error_msg 
)

get the round package for this node from upstream – indices in 'RoundPackage' mapping are thus referring to incoming edges of this node returns false on failure

◆ clicked

void clicked ( )
signal

Emitted when this item is clicked.

◆ contextMenuEvent()

void contextMenuEvent ( QGraphicsSceneContextMenuEvent *  event)
overrideprotected

◆ debugOut_()

void debugOut_ ( const String ) const
inlineprotected

Displays the debug output message, if TOPPAS_DEBUG is defined.

◆ finishHoveringEdge

void finishHoveringEdge ( )
signal

Emitted when the mouse is released after having dragged a new edge somewhere.

◆ get3CharsNumber_()

String get3CharsNumber_ ( UInt  number) const
protected

Returns a three character string (i.e. 001 instead of 1) for the given number.

◆ getDFSColor()

DFS_COLOR getDFSColor ( )

Returns the DFS color of this node.

◆ getFileNames() [1/2]

QStringList getFileNames ( ) const

get all output files for all parameters for all rounds

◆ getFileNames() [2/2]

QStringList getFileNames ( int  param_index,
int  round 
) const

gets filenames for a certain output parameter (from this vertex), for a certain TOPPAS round

◆ getName()

◆ getOutputFiles()

const RoundPackages& getOutputFiles ( ) const

◆ getSubtreeStatus()

TOPPASVertex::SUBSTREESTATUS getSubtreeStatus ( ) const

Checks if all tools in the subtree below this node are finished.

◆ getTopoNr()

UInt getTopoNr ( ) const

Returns the topological sort number.

Referenced by TOPPASBase::toolStarted().

◆ hoveringEdgePosChanged

void hoveringEdgePosChanged ( const QPointF &  new_pos)
signal

Emitted when the position of the hovering edge changes.

◆ incomingEdgesCount()

Size incomingEdgesCount ( )

Returns the number of incoming edges.

◆ inEdgeHasChanged

virtual void inEdgeHasChanged ( )
virtualslot

Called by an incoming edge when it has changed.

◆ inEdgesBegin()

ConstEdgeIterator inEdgesBegin ( ) const

Returns begin() iterator of incoming edges.

◆ inEdgesEnd()

ConstEdgeIterator inEdgesEnd ( ) const

Returns end() iterator of incoming edges.

◆ invertRecylingMode()

virtual bool invertRecylingMode ( )
virtual

invert status of recycling

Reimplemented in TOPPASToolVertex.

◆ isFinished()

bool isFinished ( ) const

Returns whether this node has already been processed during the current pipeline execution.

◆ isReachable()

bool isReachable ( ) const

Returns whether this node is reachable.

◆ isRecyclingEnabled()

bool isRecyclingEnabled ( ) const

get status of recycling

◆ isTopoSortMarked()

bool isTopoSortMarked ( ) const

Returns whether the vertex has been marked already (during topological sort)

◆ isUpstreamFinished()

bool isUpstreamFinished ( ) const

check if all upstream nodes are ready to go ( 'finished_' is true)

◆ itemDragged

void itemDragged ( qreal  dx,
qreal  dy 
)
signal

Emitted when the item is dragged.

◆ markUnreachable()

virtual void markUnreachable ( )
virtual

Marks this node (and everything further downstream) as unreachable. Overridden behavior in mergers.

Reimplemented in TOPPASSplitterVertex, and TOPPASMergerVertex.

◆ mouseDoubleClickEvent()

void mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  e)
overrideprotected

◆ mouseMoveEvent()

void mouseMoveEvent ( QGraphicsSceneMouseEvent *  e)
overrideprotected

◆ mousePressEvent()

void mousePressEvent ( QGraphicsSceneMouseEvent *  e)
overrideprotected

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QGraphicsSceneMouseEvent *  e)
overrideprotected

◆ moveNewEdgeTo_()

virtual void moveNewEdgeTo_ ( const QPointF &  pos)
protectedvirtual

Moves the target pos of the edge which is just being created to pos.

◆ newHoveringEdge

void newHoveringEdge ( const QPointF &  pos)
signal

Emitted when a new out edge is supposed to be created.

◆ operator=()

TOPPASVertex& operator= ( const TOPPASVertex rhs)

Assignment operator.

◆ outEdgeHasChanged

virtual void outEdgeHasChanged ( )
virtualslot

Called by an outgoing edge when it has changed.

◆ outEdgesBegin()

ConstEdgeIterator outEdgesBegin ( ) const

Returns begin() iterator of outgoing edges.

◆ outEdgesEnd()

ConstEdgeIterator outEdgesEnd ( ) const

Returns end() iterator of outgoing edges.

◆ outgoingEdgesCount()

Size outgoingEdgesCount ( )

Returns the number of outgoing edges.

◆ paint()

void paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  ,
QWidget ,
bool  round_shape = true 
)

base paint method for all derived classes. should be called first in child-class paint

◆ parameterChanged

void parameterChanged ( const bool  invalidates_running_pipeline)
signal

Emitted if an INI parameter or recycling mode or whatever was edited by the user - depending on the current state of the tool an action is taken each node type decides itself if this will invalidate the pipeline, depending on its internal status

◆ released

void released ( )
signal

Emitted when this item is released.

◆ removeInEdge()

void removeInEdge ( TOPPASEdge edge)

Removes an incoming edge.

◆ removeOutEdge()

void removeOutEdge ( TOPPASEdge edge)

Removes an outgoing edge.

◆ reset()

virtual void reset ( bool  reset_all_files = false)
virtual

Resets the status

Parameters
reset_all_filesNot used in this implementation, but in derived classes

Reimplemented in TOPPASToolVertex, and TOPPASOutputFileListVertex.

◆ run()

virtual void run ( )
virtual

run the tool (either ToolVertex, Merger, or OutputNode)

Exceptions
NotImplemented

Reimplemented in TOPPASToolVertex, TOPPASSplitterVertex, TOPPASOutputFileListVertex, TOPPASMergerVertex, and TOPPASInputFileListVertex.

◆ setDFSColor()

void setDFSColor ( DFS_COLOR  color)

Sets the DFS color of this node.

◆ setRecycling()

void setRecycling ( const bool  is_enabled)

set status of recycling

◆ setTopoNr()

virtual void setTopoNr ( UInt  nr)
virtual

Sets the topological sort number (overridden in tool and output vertices)

Reimplemented in TOPPASToolVertex, and TOPPASOutputFileListVertex.

◆ setTopoSortMarked()

void setTopoSortMarked ( bool  b)

(Un)marks the vertex (during topological sort)

◆ shape()

QPainterPath shape ( ) const
final

Returns a more precise shape.

◆ somethingHasChanged

void somethingHasChanged ( )
signal

Emitted when something has changed.

Member Data Documentation

◆ allow_output_recycling_

bool allow_output_recycling_ {false}
protected

shall subsequent tools be allowed to recycle the output of this node to match the number of rounds imposed by other parent nodes?

◆ brush_color_

QColor brush_color_ { Qt::lightGray}
protected

The color of the brush.

◆ dfs_color_

DFS_COLOR dfs_color_ {DFS_WHITE}
protected

The DFS color of this node.

◆ edge_being_created_

bool edge_being_created_ {false}
protected

Indicates whether a new out edge is currently being created.

◆ finished_

bool finished_ {false}
protected

Stores whether this node has already been processed during the current pipeline execution.

◆ in_edges_

EdgeContainer in_edges_
protected

The list of incoming edges.

◆ out_edges_

EdgeContainer out_edges_
protected

The list of outgoing edges.

◆ output_files_

RoundPackages output_files_
protected

Stores the current output file names for each output parameter.

◆ pen_color_

QColor pen_color_ {Qt::black}
protected

The color of the pen.

◆ reachable_

bool reachable_ {true}
protected

Indicates whether this node is reachable (i.e. there is an input node somewhere further upstream)

◆ round_counter_

int round_counter_ {0}
protected

currently finished number of rounds (TODO: do we need that?)

◆ round_total_

int round_total_ {-1}
protected

number of rounds this node will do ('Merge All' nodes will pass everything, thus do only one round)

◆ topo_nr_

UInt topo_nr_
protected

The number in a topological sort of the entire graph.

◆ topo_sort_marked_

bool topo_sort_marked_ {false}
protected

"marked" flag for topological sort