Inviwo  0.9.10.1
Inviwo documentation
inviwo::ProcessorNetwork Class Reference

#include <processornetwork.h>

+ Inheritance diagram for inviwo::ProcessorNetwork:

Public Types

using ProcessorMap = std::unordered_map< std::string, Processor * >
 
using PortConnections = std::unordered_set< PortConnection >
 
using PropertyLinks = std::unordered_set< PropertyLink >
 

Public Member Functions

 ProcessorNetwork (InviwoApplication *application)
 
ProcessoraddProcessor (std::unique_ptr< Processor > processor)
 
bool addProcessor (Processor *processor)
 
void removeProcessor (Processor *processor)
 
void removeAndDeleteProcessor (Processor *processor)
 
ProcessorgetProcessorByIdentifier (std::string identifier) const
 
template<class T >
std::vector< T * > getProcessorsByType () const
 
std::vector< Processor * > getProcessors () const
 
template<typename C >
void forEachProcessor (C callback)
 
void addConnection (Outport *sourcePort, Inport *destPort)
 
void addConnection (const PortConnection &connection)
 
bool canConnect (const Outport *sourcePort, const Inport *destPort) const
 
void removeConnection (Outport *sourcePort, Inport *destPort)
 
void removeConnection (const PortConnection &connection)
 
bool isConnected (Outport *sourcePort, Inport *destPort) const
 
bool isConnected (const PortConnection &connection) const
 
const std::vector< PortConnection > & getConnections () const
 
template<typename C >
void forEachConnection (C callback)
 
bool isPortInNetwork (Port *port) const
 
void addLink (Property *source, Property *destination)
 
void addLink (const PropertyLink &link)
 
bool canLink (const Property *source, const Property *destination) const
 
void removeLink (Property *source, Property *destination)
 
void removeLink (const PropertyLink &link)
 
bool isLinked (Property *source, Property *destination) const
 
bool isLinked (const PropertyLink &link) const
 
std::vector< PropertyLinkgetLinks () const
 
template<typename C >
void forEachLink (C callback)
 
bool isLinkedBidirectional (Property *source, Property *destination)
 
std::vector< Property * > getPropertiesLinkedTo (Property *property)
 
std::vector< PropertyLinkgetLinksBetweenProcessors (Processor *p1, Processor *p2)
 
PropertygetProperty (std::vector< std::string > path) const
 
bool isPropertyInNetwork (Property *prop) const
 
InviwoApplicationgetApplication () const
 
int getVersion () const
 
void evaluateLinksFromProperty (Property *)
 
bool isEmpty () const
 
bool isInvalidating () const
 
bool isLinking () const
 
void lock ()
 
void unlock ()
 
bool islocked () const
 
virtual void serialize (Serializer &s) const override
 
virtual void deserialize (Deserializer &d) override
 
bool isDeserializing () const
 
void clear ()
 
- Public Member Functions inherited from inviwo::ProcessorNetworkObservable
void notifyObserversProcessorNetworkChanged ()
 
void notifyObserversProcessorNetworkEvaluateRequest ()
 
void notifyObserversProcessorNetworkUnlocked ()
 
void notifyObserversProcessorNetworkWillAddProcessor (Processor *processor)
 
void notifyObserversProcessorNetworkDidAddProcessor (Processor *processor)
 
void notifyObserversProcessorNetworkWillRemoveProcessor (Processor *processor)
 
void notifyObserversProcessorNetworkDidRemoveProcessor (Processor *processor)
 
void notifyObserversProcessorNetworkWillAddConnection (const PortConnection &connection)
 
void notifyObserversProcessorNetworkDidAddConnection (const PortConnection &connection)
 
void notifyObserversProcessorNetworkWillRemoveConnection (const PortConnection &connection)
 
void notifyObserversProcessorNetworkDidRemoveConnection (const PortConnection &connection)
 
void notifyObserversProcessorNetworkWillAddLink (const PropertyLink &propertyLink)
 
void notifyObserversProcessorNetworkDidAddLink (const PropertyLink &propertyLink)
 
void notifyObserversProcessorNetworkWillRemoveLink (const PropertyLink &propertyLink)
 
void notifyObserversProcessorNetworkDidRemoveLink (const PropertyLink &propertyLink)
 
- Public Member Functions inherited from inviwo::Observable< ProcessorNetworkObserver >
 Observable (const Observable< ProcessorNetworkObserver > &other)
 
 Observable (Observable< ProcessorNetworkObserver > &&other)
 
Observable< ProcessorNetworkObserver > & operator= (const Observable< ProcessorNetworkObserver > &other)
 
Observable< ProcessorNetworkObserver > & operator= (Observable< ProcessorNetworkObserver > &&other)
 
void addObserver (ProcessorNetworkObserver *observer)
 
void removeObserver (ProcessorNetworkObserver *observer)
 
virtual void startBlockingNotifications () override final
 
virtual void stopBlockingNotifications () override final
 
- Public Member Functions inherited from inviwo::ProcessorObserver
virtual void onProcessorDisplayNameChanged (Processor *, const std::string &)
 
virtual void onProcessorPortAdded (Processor *, Port *)
 
virtual void onProcessorAboutToProcess (Processor *)
 
virtual void onProcessorFinishedProcess (Processor *)
 
virtual void onProcessorSourceChanged (Processor *)
 
virtual void onProcessorSinkChanged (Processor *)
 
virtual void onProcessorReadyChanged (Processor *)
 
- Public Member Functions inherited from inviwo::Observer
 Observer (const Observer &other)
 
 Observer (Observer &&other)
 
Observeroperator= (Observer &&other)
 
Observeroperator= (const Observer &other)
 
virtual ~Observer ()
 
void removeObservation (ObservableInterface *observable)
 
void removeObservations ()
 
- Public Member Functions inherited from inviwo::PropertyOwnerObserver
virtual void onWillAddProperty (Property *property, size_t index)
 
virtual void onDidAddProperty (Property *property, size_t index)
 
virtual void onDidRemoveProperty (Property *property, size_t index)
 

Additional Inherited Members

- Public Attributes inherited from inviwo::ProcessorObserver
friend ProcessorObservable
 
- Public Attributes inherited from inviwo::PropertyOwnerObserver
friend PropertyOwnerObservable
 
- Protected Types inherited from inviwo::Observer
using ObservableSet = std::unordered_set< ObservableInterface * >
 
- Protected Member Functions inherited from inviwo::Observable< ProcessorNetworkObserver >
void forEachObserver (C callback)
 
- Protected Member Functions inherited from inviwo::ObservableInterface
void addObservationHelper (Observer *observer)
 
void removeObservationHelper (Observer *observer)
 
- Protected Member Functions inherited from inviwo::Observer
void addObservation (ObservableInterface *observable)
 
- Protected Attributes inherited from inviwo::Observer
ObservableSet observables_
 

Detailed Description

This class manages the current processor network. It can be thought of as a container of Processor instances, which Port instances are connected through PortConnection instances, and which Property instances are linked through ProcessorLink instances. To manage Processors, PortConnections and ProcessorLinks, add and remove methods are available for all these entities. The network should be only modified by using these methods. Typically, these methods are called by the NetworkEditor, which enables the user to edit ProcessorNetworks.

When the ProcessorNetwork has been changed, it is flagged as modified. This mechanism is used by the ProcessorNetworkEvaluator to identify if the ProcessorNetwork needs to be analyzed before processing.

In the model view controller design pattern, the ProcessorNetwork represents the model, which means that no graphical representations are generated for the added entities. Adding and removing of the graphical representations is done in the NetworkEditor.

Member Function Documentation

◆ addConnection()

void inviwo::ProcessorNetwork::addConnection ( Outport sourcePort,
Inport destPort 
)

Adds a PortConnection to the ProcessorNetwork. This involves creating the connection between the two specified ports, as well as adding this connection to the ProcessorNetwork.

Parameters
[in]sourcePortThe outport.
[in]destPortThe inport.
See also
removeConnection()

◆ addLink()

void inviwo::ProcessorNetwork::addLink ( Property source,
Property destination 
)

Create and add Property Link to the network Adds a link between two properties, that are owned by processor network.

Parameters
[in]sourceProperty at which link starts
[in]destinationProperty at which link ends
Returns
PropertyLink* Newly added link

◆ addProcessor() [1/2]

Processor * inviwo::ProcessorNetwork::addProcessor ( std::unique_ptr< Processor processor)

Adds a Processor to the ProcessorNetwork. The identifiers of all processors in the ProcessorNetwork should be unique.

Parameters
[in]processorThe Processor to be added.
See also
removeProcessor(), Processor::setIdentifier()

◆ addProcessor() [2/2]

bool inviwo::ProcessorNetwork::addProcessor ( Processor processor)

Adds a Processor to the ProcessorNetwork. The identifiers of all processors in the ProcessorNetwork should be unique.

Parameters
[in]processorThe Processor to be added. The network will take ownership.
See also
removeProcessor(), Processor::setIdentifier()

◆ canConnect()

bool inviwo::ProcessorNetwork::canConnect ( const Outport sourcePort,
const Inport destPort 
) const

Check if sourcePort can be connected to destPort

◆ canLink()

bool inviwo::ProcessorNetwork::canLink ( const Property source,
const Property destination 
) const

Check if source can be linked to destination

◆ clear()

void inviwo::ProcessorNetwork::clear ( )

Clears the network objects processors, port connections, property links etc.,

◆ getProcessorByIdentifier()

Processor * inviwo::ProcessorNetwork::getProcessorByIdentifier ( std::string  identifier) const

Returns the Processor from the ProcessorNetwork, which has the given identifier. In case no Processor with the given identifier is contained in the network, a null pointer is returned.

Parameters
identifierIdentifier of the Processor to be accessed.
See also
getProcessorsByType(), Processor::setIdentifier(), Processor::getIdentifier()

◆ getProcessorsByType()

template<class T >
std::vector< T * > inviwo::ProcessorNetwork::getProcessorsByType ( ) const

Returns a vector of Processors which are of type T. In case no Processors match T an empty vector is returned.

See also
getProcessorByIdentifier()

◆ isConnected()

bool inviwo::ProcessorNetwork::isConnected ( Outport sourcePort,
Inport destPort 
) const

Checks weather two port are connected

Parameters
[in]sourcePortThe outport.
[in]destPortThe inport.
Returns
Weather the two port are connected
See also
addConnection()

◆ isLinked()

bool inviwo::ProcessorNetwork::isLinked ( Property source,
Property destination 
) const

Check whether Property Link exists Checks if there is a link between two properties, that are owned by processor network.

Parameters
[in]sourceProperty at which link starts
[in]destinationProperty at which link ends
Returns
bool true if link exists otherwise returns false

◆ isLinkedBidirectional()

bool inviwo::ProcessorNetwork::isLinkedBidirectional ( Property source,
Property destination 
)

Is Property Link bidirectional Searches for bidirectional link between start and end properties In other words property that goes from end to start

Parameters
[in]sourceProperty at which link starts
[in]destinationProperty at which link ends
Returns
void

◆ removeAndDeleteProcessor()

void inviwo::ProcessorNetwork::removeAndDeleteProcessor ( Processor processor)

Removes and deletes a Processor from the ProcessorNetwork. To ensure that the network does not end up in a corrupt state, this method first removes and deletes all PortConnections and ProcessorLinks, which are related to the Processor to be removed.

Parameters
[in]processorThe Processor to be removed.
See also
addProcessor()

◆ removeConnection()

void inviwo::ProcessorNetwork::removeConnection ( Outport sourcePort,
Inport destPort 
)

Removes and deletes a PortConnection from the ProcessorNetwork. This involves resolving the connection between the two specified Ports, as well as removing this connection from the ProcessorNetwork.

Parameters
[in]sourcePortThe outport.
[in]destPortThe inport.
See also
addConnection()

◆ removeLink()

void inviwo::ProcessorNetwork::removeLink ( Property source,
Property destination 
)

Remove and delete Property Link from the network Removes a link between two properties, that are owned by processor network.

Parameters
[in]sourceProperty at which link starts
[in]destinationProperty at which link ends
Returns
void

◆ removeProcessor()

void inviwo::ProcessorNetwork::removeProcessor ( Processor processor)

Removes a Processor from the ProcessorNetwork. To ensure that the network does not end up in a corrupt state, this method first removes and deletes all PortConnections and ProcessorLinks, which are related to the Processor to be removed.

Parameters
[in]processorThe Processor to be removed.
See also
addProcessor()

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