itom
Loading...
Searching...
No Matches
ito::AbstractNode Class Referenceabstract

Every plot designer plugin in itom, that should be able to open dependent sub-plots (e.g. a 1d line cut is a subplot of its 2d parent plot), must be inherited from this class AbstractNode. However, AbstractNode is no widget class of Qt. Therefore it is also possible to create non-visible classes derived from AbstractNode. This allows creating a directed net of nodes where changes of some input parameters are propagated through all relevant sub-nodes. More...

#include <AbstractNode.h>

Inheritance diagram for ito::AbstractNode:
ito::AbstractFigure ito::AbstractDObjFigure ito::AbstractDObjPclFigure

Public Types

typedef QPair< QString, QString > ParamNamePair
 

Public Member Functions

 AbstractNode ()
 constructor
 
virtual ~AbstractNode ()
 destructor
 
virtual RetVal applyUpdate (void)=0
 
virtual RetVal update (void)=0
 update of this node if the values of all changed input channels are propagated to the corresponding input parameters of this node
 
RetVal createChannel (const QString &senderParamName, AbstractNode *receiver, const QString &receiverParamName, bool replaceChannelIfExists=false)
 creates a new channel from this node as sender and a specific sender parameter (output) to a receiver node and its specific receiver (input) parameter.
 
RetVal removeChannel (QSharedPointer< Channel > channel)
 
RetVal removeAllChannelsToReceiver (const AbstractNode *receiver, QList< ParamNamePair > excludedConnections=QList< ParamNamePair >())
 
QList< QSharedPointer< Channel > > getConnectedInputChannels (const QString &inputParamName) const
 
QList< QSharedPointer< Channel > > getConnectedInputChannels (const ito::Param *inputParam) const
 
QList< QSharedPointer< Channel > > getConnectedOutputChannels (const QString &outputParamName) const
 
QList< QSharedPointer< Channel > > getConnectedOutputChannels (const ito::Param *outputParam) const
 
RetVal updateChannelData (QSharedPointer< Channel > updatedChannel)
 
RetVal setUpdatePending (QSharedPointer< ito::Channel > singleOutputChannel=QSharedPointer< ito::Channel >())
 >propagates information about a soon, future update to all (or one selected) output channel(s) of this node
 
ito::ParamgetInputParam (const QString &paramName) const
 returns the input parameter whose name is equal to paramName or returns NULL if the parameter is not found.
 
ito::ParamgetOutputParam (const QString &paramName) const
 returns the output parameter whose name is equal to paramName or returns NULL if the parameter is not found.
 
RetVal addOutputParam (ito::Param *param)
 adds the given parameter to the list of output parameters of this node.
 
RetVal removeAndDeleteOutputParam (const QString &paramName)
 
RetVal addInputParam (ito::Param *param)
 adds the given parameter to the list of input parameters of this node.
 
RetVal removeAndDeleteInputParam (const QString &paramName)
 
RetVal updateChannels (const QList< QString > &outputParamNames)
 triggers updates of all channels that are connected to the given output parameter names of the sender.
 
rttiNodeType getType () const
 returns the type of this node
 
bool isConnected () const
 returns true if at least one channel is connected to this node
 
unsigned int getUniqueID (void) const
 return a unique, auto-incremented UID of this node (beginning with 1)
 

Protected Member Functions

RetVal detachChannel (QSharedPointer< Channel > channel)
 removes the given channel from the list of chnanels of this node.
 
RetVal attachChannel (QSharedPointer< Channel > channel)
 
RetVal inputParamChanged (const ito::ParamBase *updatedInputParam)
 

Static Protected Attributes

static unsigned int UID = 1
 highest used UID of any node. This value is auto-incremented upon every
 

Private Member Functions

 Q_DECLARE_PRIVATE (AbstractNode)
 

Private Attributes

QScopedPointer< AbstractNodePrivated_ptr
 

Detailed Description

Every plot designer plugin in itom, that should be able to open dependent sub-plots (e.g. a 1d line cut is a subplot of its 2d parent plot), must be inherited from this class AbstractNode. However, AbstractNode is no widget class of Qt. Therefore it is also possible to create non-visible classes derived from AbstractNode. This allows creating a directed net of nodes where changes of some input parameters are propagated through all relevant sub-nodes.

Every node has a set of input parameters (as list of ito::Param) and a set of output parameters. One output parameter of one node can be connected with another input parameter of another node, using the class ito::Channel (see methods createChannel, removeChannel, ...). Whenever one or multiple output parameters of one node are changed, the changes are propagated through all connected channels to the corresponding parameters of the receiver node(s).

Since the real update of the view of a plot needs some computing power, a mechanism (called 'pending update') is integrated in the channels, such that the view update is done as soon as the announced changes of all affected input channels have been propagated to all affected input parameters of one node.

This is realized by a two-step update mechanism: If one or multiple output parameters have been changed, an update of all possible channels is triggered, which are connected to these output parameters. Then the states of these channels is set to Channel::StateUpdatePending. This is repeated recursively in all receiving nodes of these affected channels, such that all output channels of these receivers are also notified about the upcoming update (update pending).

If the pending update is reported recursively through the entire sub-tree below the changed initial parameters, the changed parameters are started to be copied from sender to receiver in every affected channel. Once done, the state of the channel switches from Channel::StateUpdatePending to Channel::StateUpdateReceived. As soon as the last input channel of a receiver node switched its state from StateUpdatePending to StateUpdateReceived, the real update() method of the node is called, which calls the pure virtual method applyUpdate, that calculates the real view update of the plot (or similar node element).

Member Function Documentation

◆ attachChannel()

RetVal ito::AbstractNode::attachChannel ( QSharedPointer< Channel > channel)
protected

‍attaches the given channel to the list of channels (either input or output, depending if this is sender or receiver)

◆ createChannel()

RetVal ito::AbstractNode::createChannel ( const QString & senderParamName,
AbstractNode * receiver,
const QString & receiverParamName,
bool replaceChannelIfExists = false )

creates a new channel from this node as sender and a specific sender parameter (output) to a receiver node and its specific receiver (input) parameter.

‍Calls applyUpdate() and updates all children

◆ getConnectedInputChannels() [1/2]

QList< QSharedPointer< Channel > > ito::AbstractNode::getConnectedInputChannels ( const ito::Param * inputParam) const

‍returns a list of channels, that are connected to a given input parameter. This node must be the receiver of the returned channels.

◆ getConnectedInputChannels() [2/2]

QList< QSharedPointer< Channel > > ito::AbstractNode::getConnectedInputChannels ( const QString & inputParamName) const

‍returns a list of channels, that are connected to an input param with a given name. This node must be the receiver of the returned channels.

◆ getConnectedOutputChannels() [1/2]

QList< QSharedPointer< Channel > > ito::AbstractNode::getConnectedOutputChannels ( const ito::Param * outputParam) const

‍returns a list of channels, that are connected to a given output parameter. This node must be the sender of the returned channels.

◆ getConnectedOutputChannels() [2/2]

QList< QSharedPointer< Channel > > ito::AbstractNode::getConnectedOutputChannels ( const QString & outputParamName) const

‍returns a list of channels, that are connected to an output param with a given name. This node must be the sender of the returned channels.

◆ inputParamChanged()

RetVal ito::AbstractNode::inputParamChanged ( const ito::ParamBase * updatedInputParam)
protected

‍indicates that an input parameter of the node has been changed and initializes the update pipeline to child nodes if necessary. This is the source of an update.

◆ Q_DECLARE_PRIVATE()

ito::AbstractNode::Q_DECLARE_PRIVATE ( AbstractNode )
private

‍self-managed pointer to the private class container (deletes itself if d_ptr is destroyed). pointer to private class of AbstractNode defined in AbstractNode.cpp. This container is used to allow flexible changes in the interface without destroying the binary compatibility

◆ removeAllChannelsToReceiver()

RetVal ito::AbstractNode::removeAllChannelsToReceiver ( const AbstractNode * receiver,
QList< ParamNamePair > excludedConnections = QList<ParamNamePair>() )

◆ removeAndDeleteInputParam()

RetVal ito::AbstractNode::removeAndDeleteInputParam ( const QString & paramName)

‍removes the parameter 'paramName' from the list of output parameters and deletes it (if it exists). Also removes all channels that have this output parameter as sender.

◆ removeAndDeleteOutputParam()

RetVal ito::AbstractNode::removeAndDeleteOutputParam ( const QString & paramName)

‍removes the parameter 'paramName' from the list of output parameters and deletes it (if it exists). Also removes all channels that have this output parameter as sender.

◆ removeChannel()

RetVal ito::AbstractNode::removeChannel ( QSharedPointer< Channel > channel)

‍removes the channel from the list of channels, forces the partner node to detach the channel and destroys the channel object

◆ update()

virtual RetVal ito::AbstractNode::update ( void )
pure virtual

update of this node if the values of all changed input channels are propagated to the corresponding input parameters of this node

‍Performs the in INTERNAL operations necessary in updating the node and displaying the data. This has to implemented in each final successor in the inheritance structure. Anyway the "displayed" parameter MUST be filled adequately as this can only be done by the node itself.

Implemented in ito::AbstractDObjFigure, ito::AbstractDObjPclFigure, and ito::AbstractFigure.

◆ updateChannelData()

RetVal ito::AbstractNode::updateChannelData ( QSharedPointer< Channel > updatedChannel)

‍This method is called, if the sender parameter of the channel changed its value.

Member Data Documentation

◆ UID

unsigned int ito::AbstractNode::UID = 1
staticprotected

highest used UID of any node. This value is auto-incremented upon every

‍Updates the input param of the associated node and attempts to propagate the update down the node tree. It DOES NOT/CANNOT, however, ensure that the output parameters of the node are updated correctly, this functionality has to be a part of update().


The documentation for this class was generated from the following files: