Workspace 6.21.5
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
Workspace Class Reference

Container for all workspace elements (operations, connections, etc.). More...

#include <Workspace/DataExecution/Operations/workspace.h>

Inheritance diagram for Workspace:
[legend]

Public Member Functions

 Workspace ()
 
 ~Workspace () override
 
QUuid addAnchor (const AnchorData &d)
 
void addAnchor (const QUuid &id, const AnchorData &d)
 
void addConnection (Connection &connection)
 
QUuid addMiniOperationRack (const MiniOperationRackData &data)
 
void addMiniOperationRack (const QUuid &id, const MiniOperationRackData &data)
 
QUuid addNoteItem (const NoteItemData &d)
 
void addNoteItem (const QUuid &id, const NoteItemData &d)
 
void addOperation (Operation &operation)
 
void addOperation (Operation &operation, const QString &id)
 
void addToUpdateSet (Updatable &updatable)
 
virtual bool canChangeAtomicUpdate () const
 
void checkRequestersForStatus ()
 
void clear ()
 
Workspaceclone ()
 
bool comesFromExternal () const override
 
bool completeDelayedLoad ()
 
bool containsOperationWithLabel (const QString &label, bool descendIntoNestedItems=false)
 
Presentation::CustomOperationPropertiescreateCustomPropertiesHandler () override
 
void ensureHasData () override
 
bool execute () override
 
void findNestedSourceUrls (QStringList &urlList, bool recursive=true) const
 
AnchorDatagetAnchorData (const QUuid &id)
 
const AnchorDatagetAnchorData (const QUuid &id) const
 
QList< QUuid > getAnchorIds () const
 
const QString & getCatalogueName () const
 
const QString & getCataloguePath () const
 
ConnectiongetConnection (size_type i)
 
const ConnectiongetConnection (size_type i) const
 
QString getDefaultIconPath () const override
 
QList< Connection * > getDisabledConnections (bool nestedWorkspaces)
 
UpdatablegetErrorSource ()
 
void getGlobalNames (QStringList &globalNames, QStringList &globalNameDescriptions) const
 
const InputScalargetInputForOperation (const WorkspaceInput &source) const
 
InputScalargetInputForOperation (WorkspaceInput &source)
 
MiniOperationRackDatagetMiniOperationRackData (const QUuid &id)
 
const MiniOperationRackDatagetMiniOperationRackData (const QUuid &id) const
 
QUuid getMiniOperationRackId (const Operation &operation) const
 
QList< QUuid > getMiniOperationRackIds () const
 
bool getMustRun () const
 
const QString & getNamespace () const
 
NoteItemDatagetNoteItemData (const QUuid &id)
 
const NoteItemDatagetNoteItemData (const QUuid &id) const
 
QList< QUuid > getNoteItemIds () const
 
const QString & getNotes () const
 
size_type getNumConnections () const
 
size_type getNumOperations () const
 
OperationgetOperation (size_type i)
 
const OperationgetOperation (size_type i) const
 
OperationgetOperationFromId (const QUuid &id)
 
const OperationgetOperationFromId (const QUuid &id) const
 
WorkspaceInputgetOperationFromInput (InputScalar &in) const
 
WorkspaceOutputgetOperationFromOutput (const Output &out) const
 
size_type getOperationIndex (const Operation &op) const
 
QList< Operation * > getOperationsWithFeature (const SchedulerFeature &feature, bool descendIntoNestedItems=false)
 
QList< Operation * > getOperationsWithLabel (const QString &label, bool descendIntoNestedItems=false)
 
OperationgetOperationWithGlobalName (const QString &globalName, bool descendIntoNestedItems=false)
 
OperationgetOperationWithLabel (const QString &label)
 
const OutputgetOutputForOperation (const WorkspaceOutput &requester) const
 
OutputgetOutputForOperation (WorkspaceOutput &requester)
 
SchedulerFeatures getRequiredSchedulerFeatures () const override
 
const WorkspacegetRootWorkspace () const override
 
WorkspacegetRootWorkspace () override
 
const QString & getSerializedText () const
 
QString getSourceDir () const
 
const QString & getSourceUrl () const
 
bool getSupportsRemoteExecution () const
 
const QString & getSyncSerializedWorkflow () const
 
UpdatergetUpdater ()
 
const QString & getUuid ()
 
QList< Variable * > getVariableOperations ()
 
QList< const Variable * > getVariableOperations () const
 
QList< WorkspaceInput * > getWorkspaceInputOperations ()
 
QList< const WorkspaceInput * > getWorkspaceInputOperations () const
 
QList< WorkspaceOutput * > getWorkspaceOutputOperations ()
 
QList< const WorkspaceOutput * > getWorkspaceOutputOperations () const
 
QList< Workspace * > getWorkspaces ()
 
QList< const Workspace * > getWorkspaces () const
 
QList< Workspace * > getWorkspacesWithSourceUrl (const QString &sourceUrl, bool descendIntoNestedItems=false)
 
bool hasDisabledConnections () const
 
bool hasStarted ()
 
bool hasStopped ()
 
bool haveAnchor (const QUuid &id) const
 
bool haveMiniOperationRack (const QUuid &id) const
 
bool haveNoteItem (const QUuid &id) const
 
void idPathChanged () override
 
void inputDataTypeChanged (WorkspaceInput &source)
 
bool isAsynchronous () const override
 
bool isAsynchronousProcess () const override
 
bool isAtomicUpdate () const override
 
bool isConnectedToAsynchronous () const override
 
bool isDelayedLoad () const
 
bool isPaused ()
 
bool isRoot () const
 
bool isRunning ()
 
bool isRunningAsynchronously () const override
 
bool isScheduled ()
 
bool isValid () const
 
bool isWaitingForAsynchronousUpdate () const override
 
bool load (const SerializedItem &item) override
 
bool loadFromFile (const QString &fileName, bool loadPlaceholdersOnly=false, bool updateWsResourcePath=true)
 
bool loadMetaData (const QString &serializedText)
 
bool loadWithoutOverwrite (const SerializedItem &item)
 
void logText (const QString &msg)
 
void modifyAnchor (const QUuid &id, const AnchorData &d)
 
void modifyNoteItem (const QUuid &id, const NoteItemData &d)
 
bool nestedHaveDisabledConnections () const
 
void outputDataTypeChanged (WorkspaceOutput &requester)
 
void pauseUpdate ()
 
void processUpdateSet ()
 
void regenerateOperationIds ()
 
bool removeAnchor (const QUuid &id)
 
bool removeConnection (Connection &connection)
 
void removeFromUpdateSet (Updatable &updatable)
 
bool removeMiniOperationFromRack (const QUuid &opId, const QUuid &rackId)
 
bool removeMiniOperationRack (const QUuid &id)
 
bool removeNoteItem (const QUuid &id)
 
bool removeOperation (Operation &operation)
 
void requestContinuousUpdate ()
 
void requestSingleShotUpdate (const QJsonDocument &schedulerSettings)
 
void requestSingleShotUpdate (const QStringList &notifyMailRecipients=QStringList())
 
void requestStop ()
 
void resetExecutionDependencies () override
 
bool saveToFile (const QString &fileName, bool saveData=false, bool saveAllOutputs=true)
 
bool saveToFileConst (const QString &fileName, bool saveData=false) const
 
bool saveWithData (SerializedItem &item) const override
 
bool saveWithData (SerializedItem &item, bool saveAllOutputs) const
 
void setAtomicUpdate (bool atomic) override
 
void setCatalogueName (const QString &name)
 
void setCataloguePath (const QString &path)
 
template<typename T >
bool setGlobalNameValue (const QString &globalName, const T &value)
 
void setIdPathCachingEnabled (bool b) override
 
void setInputNotUpToDate (InputScalar &input) override
 
void setIsAsynchronous (bool asynchronous) override
 
void setIsAsynchronousProcess (bool) override
 
void setIsRunningAsynchronously (bool running) override
 
void setIsScheduled (bool scheduled)
 
void setManualLoadSourceUrl (const QString &url)
 
void setMustRun (bool)
 
void setNamespace (const QString &name)
 
void setNotes (const QString &notes)
 
void setOutputNotUpToDate (Output &output) override
 
void setOutputUpToDate (WorkspaceOutput &requester, bool b)
 
void setSourceUrl (const QString &url)
 
void setSupportsRemoteExecution (bool val)
 
void setSynchronisationSource (Workspace &)
 
void setSyncSerializedWorkflow (const QString &serializedWorkflow)
 
void setUpToDate (bool b) override
 
void setUuid (const QString &)
 
void setWasRunning (bool b)
 
void stopAndWaitUntilFinishedRunning ()
 
bool synchronize ()
 
void terminate ()
 
bool update (Updater *updater=nullptr) override
 
bool wasRunning ()
 
void workspaceChanged (Workspace *oldWorkspace) override
 
- Public Member Functions inherited from Operation
 ~Operation () override
 
bool addInput (Input &input, bool modifiedInPlace=false)
 
bool addOutput (Output &output)
 
template<typename T >
bool assignInput (const QString &inputName, const T &value)
 
bool canSerialize () const override
 
bool connectProgressEvents (QProgressBar *progressBar)
 
virtual Presentation::CustomOperationPropertiescreateCustomPropertiesHandler ()
 
virtual void ensureHasData ()
 
bool getBroadcastUpdateEvents () const
 
QColor getColor () const
 
virtual QString getDefaultIconPath () const
 
QString getDefaultUiPath () const
 
QString getDeprecationMessage () const
 
const QString & getDescription () const
 
SerializedItem getExtras ()
 
const OperationFactorygetFactory () const
 
OperationgetFromPath (const QString &path, Workspace &relativeTo, QStringList &errors) const override
 
virtual GraphicsSize getGraphicsSize () const
 
virtual QString getHelpPage () const
 
QString getIconPath () const
 
const QUuid & getId () const
 
QString getIdPath (bool scoped=true) const override
 
QString getIdPath (const Workspace &relativeTo) const
 
difference_type getIndex (const Input &input, IndexCountingOptions options=SkipNone) const
 
difference_type getIndex (const Output &output, IndexCountingOptions options=SkipNone) const
 
void getIndexPair (InputScalar &input, difference_type &mainIndex, difference_type &arrayIndex)
 
InputgetInput (const QString &name)
 
const InputgetInput (const QString &name) const
 
InputgetInput (size_type index)
 
const InputgetInput (size_type index) const
 
InputArraygetInputArray (const QString &name)
 
const InputArraygetInputArray (const QString &name) const
 
IOBaseIteratorRange< Input, false > getInputs ()
 
IOBaseIteratorRange< Input, true > getInputs () const
 
InputScalargetInputScalar (const QString &name)
 
const InputScalargetInputScalar (const QString &name) const
 
template<typename T >
T & getInputValue (const QString &inputName)
 
template<typename T >
const T & getInputValue (const QString &inputName) const
 
const QString & getLabel () const
 
QString getLabelRelativeToRoot () const
 
OutputgetOutput (const QString &name)
 
const OutputgetOutput (const QString &name) const
 
OutputgetOutput (size_type index)
 
const OutputgetOutput (size_type index) const
 
IOBaseIteratorRange< Output, false > getOutputs ()
 
IOBaseIteratorRange< Output, true > getOutputs () const
 
template<typename T >
T & getOutputValue (const QString &outputName)
 
template<typename T >
const T & getOutputValue (const QString &outputName) const
 
bool getProfilingEnabled () const
 
int getProgress () const
 
int getProgressContribution () const
 
bool getProgressResetByNotUpToDate () const
 
virtual SchedulerFeatures getRequiredSchedulerFeatures () const
 
InputScalargetScalarInput (size_type mainIndex, difference_type arrayIndex)
 
QString getShortLabel () const
 
QString getTagName () const
 
bool getTerminateExecution () const
 
QString getUiPath () const
 
bool getUpToDate () const override
 
virtual bool hasRequiredSchedulerFeatures () const
 
void idPathChanged () override
 
virtual bool inputRebuilt (InputScalar &input)
 
virtual bool isAsynchronous () const
 
virtual bool isAsynchronousProcess () const
 
virtual bool isAtomicUpdate () const
 
bool isConnectedToAsynchronous () const override
 
bool isDeprecated () const
 
bool isEditable () const
 
bool isIdPathCachingEnabled () const
 
virtual bool isPolymorphicType () const
 
virtual bool isRunningAsynchronously () const
 
virtual bool isThreadSafe () const
 
template<typename T >
bool isType () const
 
bool isType (const OperationFactory &type) const
 
bool isUpdating () const
 
virtual bool isUserConfigurable ()
 
bool isUsingDefaultColor () const
 
bool isUsingDefaultIconPath () const
 
bool isUsingDefaultUiPath () const
 
bool isWaitingForAsynchronousUpdate () const override
 
bool isWorkspaceType () const
 
bool load (const SerializedItem &item) override
 
void markUpToDateWhereSafe ()
 
bool matchesType (const Operation &otherOperation) const
 
size_type numInputs (IndexCountingOptions=SkipNone) const
 
size_type numOutputs (IndexCountingOptions=SkipNone) const
 
bool removeInput (const QString &name)
 
bool removeInput (Input &input)
 
bool removeOutput (const QString &name)
 
bool removeOutput (Output &output)
 
virtual void resetExecutionDependencies ()
 
bool save (SerializedItem &item) const override
 
virtual bool saveWithData (SerializedItem &item) const
 
virtual void setAtomicUpdate (bool atomic)
 
void setBroadcastUpdateEvents (bool enable)
 
void setColor (const QColor &c)
 
void setDescription (const QString &description)
 
void setEditable (bool b)
 
void setIconPath (const QString &path)
 
void setId (const QUuid &id)
 
virtual void setIdPathCachingEnabled (bool b)
 
virtual void setInputNotUpToDate (InputScalar &input)
 
virtual void setIsAsynchronous (bool asynchronous)
 
virtual void setIsAsynchronousProcess (bool)
 
virtual void setIsRunningAsynchronously (bool asynchronous)
 
void setLabel (const QString &label)
 
virtual void setOutputNotUpToDate (Output &output)
 
void setProfilingEnabled (bool enable)
 
virtual void setProgress (int percent)
 
void setProgressContribution (int percent)
 
void setProgressResetByNotUpToDate (bool b)
 
virtual void setRequiredSchedulerFeatures (const SchedulerFeatures &)
 
void setTerminateExecution (bool b)
 
void setUiPath (const QString &path)
 
void setUpToDate (bool b) override
 
bool update (Updater *updater=nullptr) override
 
- Public Member Functions inherited from WorkspaceElement
 ~WorkspaceElement () override
 
const WorkspacegetWorkspace () const override
 
WorkspacegetWorkspace () override
 
virtual void workspaceChanged (Workspace *oldWorkspace)
 
- Public Member Functions inherited from Updatable
 ~Updatable () override
 
virtual bool comesFromExternal () const
 
QString getEnclosingScope () const
 
virtual UpdatablegetFromPath (const QString &path, Workspace &relativeTo, QStringList &errors) const =0
 
const QString & getGlobalName () const
 
virtual QString getIdPath (bool scoped=true) const =0
 
virtual WorkspacegetRootWorkspace ()
 
virtual const WorkspacegetRootWorkspace () const
 
QString getScopedGlobalName () const
 
virtual bool getUpToDate () const =0
 
virtual const WorkspacegetWorkspace () const =0
 
virtual WorkspacegetWorkspace ()=0
 
virtual void idPathChanged ()
 
virtual bool isConnectedToAsynchronous () const =0
 
virtual bool isWaitingForAsynchronousUpdate () const =0
 
void setGlobalName (const QString &name)
 
virtual void setUpToDate (bool b)=0
 
virtual bool update (Updater *updater=nullptr)=0
 
- Public Member Functions inherited from Observable
virtual ~Observable ()
 
void attachObserver (Observer &observer)
 
void destroy ()
 
void detachObserver (Observer &observer)
 
void notifyEvent (const ObservableEvent &event)
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 
- Public Member Functions inherited from TextLogger
 TextLogger ()
 
 TextLogger (const DataExecution::IOBase &io)
 
 TextLogger (const DataExecution::Operation &operation)
 
 TextLogger (const TextLogger &logger)
 
 TextLogger (TextLogger &&logger)
 
virtual ~TextLogger ()
 
void logLine (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logLine (const QString &msg) const
 
void logText (const Application::LogManager::MessageCategory &category, const QString &msg) const
 
void logText (const QString &msg) const
 
TextLoggeroperator= (TextLogger)
 

Static Public Member Functions

static QList< Operation * > getDownstreamOperations (const Operation &source, const OperationFactory *opType=nullptr)
 
static QList< Operation * > getUpstreamOperations (const Operation &source, const OperationFactory *opType=nullptr)
 
static void setIgnoreAliasedOperations (bool value)
 
static bool synchronize (Workspace &, Workspace &)
 
- Static Public Member Functions inherited from Updatable
static InputScalarfindInputScalarGlobalName (const QString &scopedGlobalName, Workspace &relativeTo)
 
static IOBasefindIOBaseGlobalName (const QString &scopedGlobalName, Workspace &relativeTo)
 
static OperationfindOperationGlobalName (const QString &scopedGlobalName, Workspace &relativeTo)
 

Static Public Attributes

static const QString WORKSPACE_SEARCH_PATH_PREFIX
 

Protected Member Functions

 Workspace (const OperationFactory &factory, const QString &label)
 
void cancelExecution (bool b) override
 
void decrementUseCount ()
 
bool finishInputsOutputsAfterLoad (const SerializedItem &item) override
 
void incrementUseCount ()
 
void markOutputsUpToDate () override
 
void onWorkspaceAbortedUpdate ()
 
void onWorkspaceFinishedExecution ()
 
void onWorkspaceFinishedUpdate ()
 
bool postSave (SerializedItem &item) const override
 
bool prepareInputsOutputsForLoad (const SerializedItem &item) override
 
bool shouldPutInExtras (const QString &tagName) const override
 
- Protected Member Functions inherited from Operation
 Operation (const OperationFactory &factory, const QString &label)
 
bool bringArrayOfInputsUpToDate (Input *&array, size_type arraySize)
 
bool bringArrayOfInputsUpToDate (std::vector< Input * > &array)
 
virtual bool bringInputsUpToDate ()
 
bool bringInputUpToDate (Input &input)
 
virtual void cancelExecution (bool b)
 
virtual bool execute ()=0
 
virtual bool finishInputsOutputsAfterLoad (const SerializedItem &item)
 
UpdatergetCurrentUpdater ()
 
virtual const InputgetRenamedInput (const QString &name) const
 
virtual const OutputgetRenamedOutput (const QString &name) const
 
virtual bool inputsAreUpToDate () const
 
virtual bool makeOutputsValid ()
 
virtual void markOutputsUpToDate ()
 
void pauseUpdate ()
 
virtual bool postSave (SerializedItem &item) const
 
virtual bool prepareInputsOutputsForLoad (const SerializedItem &item)
 
void saveExtras (SerializedItem &item) const
 
virtual bool shouldPutInExtras (const QString &tagName) const
 
- Protected Member Functions inherited from WorkspaceElement
 WorkspaceElement ()
 
- Protected Member Functions inherited from Updatable
 Updatable ()
 
 Updatable (const Updatable &up)
 
void notifyUpdated ()
 
Updatableoperator= (const Updatable &up)
 
- Protected Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 

Additional Inherited Members

- Public Types inherited from Operation
enum  ConfigStatus { GoodConfig = 0x00 , UnknownConfig = 0x01 , InvalidConfig = 0x02 }
 
using difference_type = ptrdiff_t
 
enum  GraphicsSize { Default = 100 , Small = 65 }
 Options for the graphical size of an operation, able to be changed by derived classes. Values are percentages. More...
 
enum  IndexCountingOption { SkipNone = 0x0 , SkipInvisible = 0x1 , SkipDependencies = 0x2 }
 
using size_type = size_t
 

Detailed Description

A Workspace is the central component of the whole system. It contains the operations and connections that together form an executable network. The workspace is responsible for loading and saving the things it contains, and it is itself an operation, so workspaces can be nested to any level.

The workspace assumes it owns all operations and connections contained in it. When a workspace is deleted, it will first delete all its connections and then all its operations. This can be a problem if client code is still holding a reference to one of them, so client code may find it useful to create observers for RemoveOperationEvent and RemoveConnectionEvent on the workspace. If a client wants to preserve an operation beyond the life of the workspace, the only way is to remove the operation from the workspace before the workspace is deleted. Removing an operation with removeOperation() does not delete it, it just removes it from the list of operations the workspace contains. Removing the operation but keeping it in existence effectively makes the operation invisible, but still active. Doing the same thing with connections is less straightforward, since even if a connection is removed from a workspace with removeConnection(), it can still be deleted if the operation at either end of the connection is destroyed. It should also be noted that destroying an operation with its operation factory or destroying a connection with its Connection::destroy() function will remove it from the workspace as well (ie no special action is required to do this).

All operations in a workspace are consecutively numbered, starting from 1. This requirement is enforced by all Workspace functions, even for a workspace read in from an external file (the operations are renumbered).

It is allowable for a workspace to create a recursive external reference, meaning it relies on itself through externally sourced workspaces. When this occurs, the loading of a workspace will be delayed until it is actually needed for execution. Note, however, that once loaded, a recursive workspace is not unloaded again when finished, so the memory it uses will not be released until the top level workspace is closed or the application is finished. Therefore, a heavily recursive workspace arrangement is not advisable. It is not possible to create recursive workspaces without references to external workspace files.

See also
WorkspaceInput, WorkspaceOutput

Constructor & Destructor Documentation

◆ Workspace() [1/2]

Workspace ( const OperationFactory factory,
const QString &  label 
)
protected

Allows subclasses to specify their factory and label. These are passed through unchanged to the Operation constructor.

◆ Workspace() [2/2]

Workspace ( )

By default, workspaces are constructed with the label "Workspace" and with no operations or any other workspace elements present.

◆ ~Workspace()

~Workspace ( )
override

Clean up private implementation.

Member Function Documentation

◆ addAnchor() [1/2]

QUuid addAnchor ( const AnchorData d)

◆ addAnchor() [2/2]

void addAnchor ( const QUuid &  id,
const AnchorData d 
)

◆ addConnection()

void addConnection ( Connection connection)
Parameters
connectionThe connection to add to the workspace.

An AddConnectionEvent notification is raised as the last thing this function does.

Note
The workspace takes ownership of the connection. If the workspace is deleted, the connection will also be destroyed. Therefore, if you need to retain the connection beyond the life of the workspace, you must call removeConnection before the workspace is deleted. All operations and connections are deleted when a workspace is loaded too, so care must be exercised when adding a connection to a workspace with this function. Most clients should not need to use this function.

◆ addMiniOperationRack() [1/2]

QUuid addMiniOperationRack ( const MiniOperationRackData data)

◆ addMiniOperationRack() [2/2]

void addMiniOperationRack ( const QUuid &  id,
const MiniOperationRackData data 
)

◆ addNoteItem() [1/2]

QUuid addNoteItem ( const NoteItemData d)

◆ addNoteItem() [2/2]

void addNoteItem ( const QUuid &  id,
const NoteItemData d 
)

◆ addOperation() [1/2]

void addOperation ( Operation operation)
Parameters
operationThe operation to add to the workspace.

An AddOperationEvent notification is raised as the last thing this function does.

Note
The workspace takes ownership of the operation. If the workspace is deleted, the operation will also be destroyed. Therefore, if you need to retain the operation beyond the life of the workspace, you must call removeOperation before the workspace is deleted. All operations and connections are deleted when a workspace is loaded too, so care must be exercised when adding an operation to a workspace with this function. Client code should only call this function with an operation that was created by an operation factory. Do not pass in an operation created on the stack, nor one created directly by operator new. The workspace assumes an operation factory created operation and will use that factory to delete it as appropriate. Note also that an operation can be deleted and recreated in certain instances, so obey the rule of always using the operation factory to create and destroy!

◆ addOperation() [2/2]

void addOperation ( Operation operation,
const QString &  id 
)
Parameters
operationThe operation to add to the workspace.
idThe desired ID string to use for the operation. If this ID is not used within the workspace, it will be assigned to the operation and the operation will be added to it.

When the operation is added to the workspace using this method a check is performed on whether the workspace already has an operation with the same ID as operation. If it does, then the ID for operation is changed to some other number which is unique within that workspace. If the ID for operation is already unique, it is left unchanged.

An AddOperationEvent notification is raised as the last thing this function does.

Note
The workspace takes ownership of the operation. If the workspace is deleted, the operation will also be destroyed. Therefore, if you need to retain the operation beyond the life of the workspace, you must call removeOperation before the workspace is deleted. All operations and connections are deleted when a workspace is loaded too, so care must be exercised when adding an operation to a workspace with this function. Client code should only call this function with an operation that was created by an operation factory. Do not pass in an operation created on the stack, nor one created directly by operator new. The workspace assumes an operation factory created operation and will use that factory to delete it as appropriate. Note also that an operation can be deleted and recreated in certain instances, so obey the rule of always using the operation factory to create and destroy!

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ addToUpdateSet()

void addToUpdateSet ( Updatable updatable)

◆ cancelExecution()

void cancelExecution ( bool  b)
overrideprotectedvirtual
Parameters
bIf true, then execution should be cancelled. If false, the function should reset any internal data from a previous reset. A false parameter must be passed to this function at some point after a cancelled execution so that subclasses have a chance to reset any internal data used to implement the last cancellation.

It is not compulsory for operations to support a specific cancel event. They can choose to do nothing in this function (which is the default implementation) or they can override this function to take some action to enact the cancellation during execution. If the function does nothing, then the operation will finish any currently running call to update(), but any subsequent calls to update() will fail. This is controlled by the workspace execution system and need not be implemented in subclasses.

If the cancellation might take some time to happen, then something should be done to indicate to the currently running update() and cancelExecution() should then return immediately without waiting for the cancellation to finish. In other words, cancelExecution() should "schedule" the cancellation rather than block waiting for it to happen.

Subclass implementors should note that the call to cancelExecution() is very likely to come from a different thread, so special care needs to be taken to avoid race conditions. It should also be noted that this function may be called when an operation is not actually executing, in which case it should do nothing.

See also
setTerminateExecution()

Reimplemented from Operation.

◆ canChangeAtomicUpdate()

bool canChangeAtomicUpdate ( ) const
virtual
Returns
true if this Workspace is capable of changing between update modes. Not all derived classes need to support doing this.

Reimplemented in ZeroMQReplyLoop, ZeroMQSubscribeLoop, ConditionalLoop, FileLoop, ForLoop, ObjectArrayLoop, and TranslateObjectDictionary.

◆ checkRequestersForStatus()

void checkRequestersForStatus ( )

Clients should not call this function directly. It is used by WorkspaceOutput to tell a Workspace it is in that it should check to see if that Workspace can now be marked as up to date. This is done whenever a WorkspaceOutput is itself marked as up to date.

◆ clear()

void clear ( )

Discards all connections and operations from the workspace.

◆ clone()

Workspace * clone ( )

Returns a copy of this workspace

◆ comesFromExternal()

bool comesFromExternal ( ) const
overridevirtual
Returns
True if this object is from a workspace that was loaded from an external reference. This is normally used to determine if the item should be saved along with its parent workspace or if the object can be modified interactively by the user (workspace execution is always allowed to modify objects regardless of where they came from).

Reimplemented from Updatable.

◆ completeDelayedLoad()

bool completeDelayedLoad ( )

If the workspace is currently in a delayed-load state (see isDelayedLoad), this function will complete the load so that the workspace can be executed. For fully loaded workspaces, this function does nothing. This would generally only be called by core workspace code to handle nested workspaces.

Returns
True if the workspace was able to be fully loaded or if the workspace was already fully loaded. The function will return false if there was a problem preventing the load from completing successfully, such as encountering file system errors, networking errors, etc.

◆ containsOperationWithLabel()

bool containsOperationWithLabel ( const QString &  label,
bool  descendIntoNestedItems = false 
)

◆ createCustomPropertiesHandler()

Presentation::CustomOperationProperties * createCustomPropertiesHandler ( )
overridevirtual
Returns
An object that can be used to add custom properties to a dialog and to create undoable commands to apply changes to those custom properties. If the operation has no custom properties, a null pointer will be returned Since most operations won't have custom properties, the default implementation simply returns a null pointer.

Reimplemented from Operation.

◆ decrementUseCount()

void decrementUseCount ( )
protected

Decrements the workspace's reference count.

◆ ensureHasData()

void ensureHasData ( )
overridevirtual

This function is for convenience only. Its purpose is to ensure that all the inputs to the operation have valid data objects. This can be useful, for example, just before saving the workspace to which the operation belongs, since it would ensure that values are saved for each input. If there is no valid data object, no value is saved for an input. Subclasses are permitted to override this function if they need to do specialised processing, but this would not normally be necessary. If they do, they must obey the post condition.

Postcondition
All operation inputs that are not connected to something will have valid data objects. If they have internal Operation objects (eg such as for Workspace objects), those operation's inputs should also have valid data objects. This pattern is recursive, such that all Operations nested to any level must have valid data objects at the completion of this call.

Reimplemented from Operation.

◆ execute()

bool execute ( )
overridevirtual

Subclasses need to implement this function to do the actual processing of the operation. Clients should not call this function directly, but should instead call the update() function, since it ensures all inputs are updated first and all outputs have setUpToDate called on each one.

Precondition
When called, this function can assume that all of its required inputs have already been brought up to date.
Postcondition
When this function exits, all of the operation's outputs need to have had their values set. It is not required that setUpToDate be called for each output, since this is done by the update() function after execute() returns.
Returns
True if the operation was able to execute successfully.

Implements Operation.

Reimplemented in IteratingWorkspaceBase< ConditionalLoop, false >, IteratingWorkspaceBase< FileLoop, true >, IteratingWorkspaceBase< ForLoop, true >, IteratingWorkspaceBase< Derived, false >, IteratingWorkspaceBase< ObjectArrayLoop, false >, IteratingWorkspaceBase< Derived, true >, IteratingWorkspaceBase< TranslateObjectDictionary, true >, IteratingWorkspaceBase< ZeroMQReplyLoop, false >, and IteratingWorkspaceBase< ZeroMQSubscribeLoop, false >.

◆ findNestedSourceUrls()

void findNestedSourceUrls ( QStringList urlList,
bool  recursive = true 
) const

Generates a list of all urls leading to external workflows.

Parameters
urlListA list of unique urls leading to external workflows.
recursiveResult will contain external workflows refrenced by external workflows

◆ finishInputsOutputsAfterLoad()

bool finishInputsOutputsAfterLoad ( const SerializedItem item)
overrideprotectedvirtual
Parameters
itemThe serialized item that will be loaded.

This function is called just before load() returns (if no errors were encountered during loading). The default implementation simply returns true to indicate that loading completed successfully. Subclasses may override this function to perform any required tasks that must be done after all other loading tasks have completed. Typical uses usually revolve around tasks that rename inputs or outputs, such as setting the data name of data sources or requesters.

Most subclasses will not need to override this function.

Returns
True if the function was successful, false otherwise.

Reimplemented from Operation.

Reimplemented in IteratingWorkspaceBase< ConditionalLoop, false >, IteratingWorkspaceBase< FileLoop, true >, IteratingWorkspaceBase< ForLoop, true >, IteratingWorkspaceBase< Derived, false >, IteratingWorkspaceBase< ObjectArrayLoop, false >, IteratingWorkspaceBase< Derived, true >, IteratingWorkspaceBase< TranslateObjectDictionary, true >, IteratingWorkspaceBase< ZeroMQReplyLoop, false >, and IteratingWorkspaceBase< ZeroMQSubscribeLoop, false >.

◆ getAnchorData() [1/2]

AnchorData & getAnchorData ( const QUuid &  id)

◆ getAnchorData() [2/2]

const AnchorData & getAnchorData ( const QUuid &  id) const

◆ getAnchorIds()

QList< QUuid > getAnchorIds ( ) const

◆ getCatalogueName()

const QString & getCatalogueName ( ) const
Returns
The name to use for this workspace if it is added to a workspace collection. This is the name that will be shown for it in the operation catalogue.
See also
setCatalogueName(), getCataloguePath()

◆ getCataloguePath()

const QString & getCataloguePath ( ) const
Returns
The path to use for this workspace if it is added to a workspace collection. This is the tree path under which it will appear in the operation catalogue. Forward slashes separate levels of the tree.
See also
setCataloguePath(), getCatalogueName()

◆ getConnection() [1/2]

Connection * getConnection ( size_type  i)
Parameters
iThe index of the connection to retrieve.
Returns
The Connection at index i within the array of connections held by this workspace. Note that this can change if a Connection is added to or removed from the Workspace.
Note
This is the only reliable way to iterate over all connections in a workspace. Get the number of connections using getNumConnections() and then use getConnection() to get each one.

◆ getConnection() [2/2]

const Connection * getConnection ( size_type  i) const
Parameters
iThe index of the connection to retrieve.
Returns
The Connection at index i within the array of connections held by this workspace. Note that this can change if a Connection is added to or removed from the Workspace.
Note
This is the only reliable way to iterate over all connections in a workspace. Get the number of connections using getNumConnections() and then use getConnection() to get each one.

◆ getDefaultIconPath()

QString getDefaultIconPath ( ) const
overridevirtual
Returns
The default icon path for this type of operation. Whenever a new operation is created, it will be given this icon path as a default. Clients can still override the icon used for an operation if they so wish by calling setIconPath().

It is not required that getDefaultIconPath() always returns the same value. In fact, it can be a useful way of showing visual differences based on some property of the operation. For example, the Workspace class overrides this function and provides two different icons; one for regular workspaces and different icon for when the workspace comes from an external source.

See also
setIconPath(), getIconPath(), isUsingDefaultIconPath()

Reimplemented from Operation.

◆ getDisabledConnections()

QList< Connection * > getDisabledConnections ( bool  nestedWorkspaces)

Returns a list of currently disabled connections.

Parameters
nestedWorkspacesWeather to also return all of the disabled connections in nested workspaces (true) or not (false).
Returns
A list of pointers to all of the connections in the workspace that are currently disabled.

◆ getDownstreamOperations()

QList< Operation * > getDownstreamOperations ( const Operation source,
const OperationFactory opType = nullptr 
)
static
Parameters
sourceThe source operation from which to search downstream from.
opTypeOptional type filter. If nullptr, all downstream operations will be returned.

Returns operations down-stream of this operation (i.e. consequent in terms of execution order). Optionally accepts an operation factory which is used to filter the operations by type. Operations will be topologically sorted to align with the order in which they will be executed.

Returns
A list of operations up-stream of this operation.

◆ getErrorSource()

Updatable * getErrorSource ( )

◆ getGlobalNames()

void getGlobalNames ( QStringList globalNames,
QStringList globalNameDescriptions 
) const

◆ getInputForOperation() [1/2]

const InputScalar * getInputForOperation ( const WorkspaceInput source) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getInputForOperation() [2/2]

InputScalar * getInputForOperation ( WorkspaceInput source)
Parameters
sourceA WorkspaceInput operation which is assumed to be in this workspace. An exception will be thrown if it is not.
Returns
The input for this workspace which corresponds to source, or a null pointer if source does not (yet) have an associated input for this workspace.
See also
WorkspaceInput::getWorkspaceInput()

◆ getMiniOperationRackData() [1/2]

MiniOperationRackData & getMiniOperationRackData ( const QUuid &  id)

◆ getMiniOperationRackData() [2/2]

const MiniOperationRackData & getMiniOperationRackData ( const QUuid &  id) const

◆ getMiniOperationRackId()

QUuid getMiniOperationRackId ( const Operation operation) const
Parameters
operation
Returns
The id of the mini operation rack containing this operation

◆ getMiniOperationRackIds()

QList< QUuid > getMiniOperationRackIds ( ) const

◆ getMustRun()

bool getMustRun ( ) const
Returns
True if the Workspace must run irrespective of any concurrency limit.
See also
setMustRun()

◆ getNamespace()

const QString & getNamespace ( ) const

◆ getNoteItemData() [1/2]

NoteItemData & getNoteItemData ( const QUuid &  id)

◆ getNoteItemData() [2/2]

const NoteItemData & getNoteItemData ( const QUuid &  id) const

◆ getNoteItemIds()

QList< QUuid > getNoteItemIds ( ) const

◆ getNotes()

const QString & getNotes ( ) const

◆ getNumConnections()

Operation::size_type getNumConnections ( ) const
Returns
The number of connections held by this workspace.
See also
getConnection()

◆ getNumOperations()

Operation::size_type getNumOperations ( ) const
Returns
The number of operations held by this workspace.
See also
getOperation(), getOperationFromId()

◆ getOperation() [1/2]

Operation * getOperation ( size_type  i)
Parameters
iThe index of the operation to retrieve.
Returns
The Operation at index i within the array of operations held by this workspace. Note that this is different to the operation's ID, since ID's stay the same regardless of how operations are added to and removed from a Workspace, but the index can be affected by such changes.

This is the only reliable way to iterate over all operations in a workspace. Get the number of operations using getNumOperations() and then use getOperation() to get each one.

Note
The index of the operation can change during common scenarios such as another operation being added or removed. To retrieve a specific operation, it is advisable to use getOperationFromId() instead.
See also
getOperationFromId(), getOperationIndex()

◆ getOperation() [2/2]

const Operation * getOperation ( size_type  i) const
Parameters
iThe index of the operation to retrieve.
Returns
The Operation at index i within the array of operations held by this workspace. Note that this is most different to the operation's ID, since ID's stay the same regardless of how operations are added to and removed from a Workspace, but the index can be affected by such changes.

This is the only reliable way to iterate over all operations in a workspace. Get the number of operations using getNumOperations() and then use getOperation() to get each one.

Note
The index of the operation can change during common scenarios such as another operation being added or removed. To retrieve a specific operation, it is advisable to use getOperationFromId() instead.
See also
getOperationFromId(), getOperationIndex()

◆ getOperationFromId() [1/2]

Operation * getOperationFromId ( const QUuid &  id)
Parameters
idThe id of the operation to retrieve.
Returns
The Operation with the specified id, or a null pointer if no operation with the specified id is held by this workspace.

This function searches through the list of operations held by the workspace, so avoid using this function in performance-sensitive code. In the worst case, it will visit every operation in the workspace to check its id.

See also
getOperation()

◆ getOperationFromId() [2/2]

const Operation * getOperationFromId ( const QUuid &  id) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getOperationFromInput()

WorkspaceInput * getOperationFromInput ( InputScalar in) const

Each input of the actual Workspace operation corresponds to a WorkspaceInput operation within that Workspace through which some other nested operation will be passing its data through.

Parameters
inThe input on this Workspace operation
Returns
The corresponding WorkspaceInput operation

◆ getOperationFromOutput()

WorkspaceOutput * getOperationFromOutput ( const Output out) const

Each output of the actual Workspace operation corresponds to a WorkspaceOutput operation within that Workspace through which some other nested operation will be passing its data through.

Parameters
outThe output on this Workspace operation
Returns
The corresponding WorkspaceOutput operation

◆ getOperationIndex()

Operation::size_type getOperationIndex ( const Operation op) const
Parameters
opThe operation for which we wish to return its index.
Returns
The index of the operation in question if it exists, -1 if it doesn't.

◆ getOperationsWithFeature()

QList< Operation * > getOperationsWithFeature ( const SchedulerFeature feature,
bool  descendIntoNestedItems = false 
)
Returns
A list of operations that have the feature requested in input feature.
Parameters
featureFeature an Operation must have to be in the returned list
descendIntoNestedItemsIf true, any WorkspaceType operations (Workspace, ForLoop etc.) will be parsed as well

◆ getOperationsWithLabel()

QList< Operation * > getOperationsWithLabel ( const QString &  label,
bool  descendIntoNestedItems = false 
)
Returns
A list of operations that have identical labels to the supplied input label.
Parameters
labelOperation label that will be searched for.
descendIntoNestedItemsIf true, any WorkspaceType operations (Workspace, ForLoop etc.) will be parsed as well

◆ getOperationWithGlobalName()

CSIRO::DataExecution::Operation * getOperationWithGlobalName ( const QString &  globalName,
bool  descendIntoNestedItems = false 
)

◆ getOperationWithLabel()

Operation * getOperationWithLabel ( const QString &  label)

◆ getOutputForOperation() [1/2]

const Output * getOutputForOperation ( const WorkspaceOutput requester) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ getOutputForOperation() [2/2]

Output * getOutputForOperation ( WorkspaceOutput requester)
Parameters
requesterA WorkspaceOutput operation which is assumed to be in this workspace. An exception will be thrown if it is not.
Returns
The output for this workspace which corresponds to requester.
See also
WorkspaceOutput::getWorkspaceOutput()

◆ getRequiredSchedulerFeatures()

SchedulerFeatures getRequiredSchedulerFeatures ( ) const
overridevirtual
Returns
The features required in order to run this operation.

Reimplemented from Operation.

◆ getRootWorkspace() [1/2]

const Workspace * getRootWorkspace ( ) const
overridevirtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from Updatable.

◆ getRootWorkspace() [2/2]

Workspace * getRootWorkspace ( )
overridevirtual
Returns
The root workspace this updatable object resides in or a null pointer if it is not part of a workspace.
Note
A workspace always has to have a root workspace, since even if it has no parent then it will itself be the root. Therefore this function always returns a non-null pointer when called on a Workspace object.

Reimplemented from Updatable.

◆ getSerializedText()

const QString & getSerializedText ( ) const

◆ getSourceDir()

QString getSourceDir ( ) const
Returns
The absolute directory that stores the workspace. If the workspace itself is an embedded workspace but not an external workspace, returns the sourceDir of its parent workspace.
See also
getSourceUrl(), setSourceUrl()

◆ getSourceUrl()

const QString & getSourceUrl ( ) const
Returns
The URL this workspace should act as a wrapper for. If an empty string is returned, the workspace is not acting as a wrapper.
See also
setSourceUrl()

◆ getSupportsRemoteExecution()

bool getSupportsRemoteExecution ( ) const

◆ getSyncSerializedWorkflow()

const QString & getSyncSerializedWorkflow ( ) const

Return the sync'ed source Workspace that was saved as a serialized text. This workflow was saved as a serialized text before it was meant to be deserialized later.

See also
setSynchronisationsource

◆ getUpdater()

Updater & getUpdater ( )
Returns
The execution thread controlling execution for this workspace.

◆ getUpstreamOperations()

QList< Operation * > getUpstreamOperations ( const Operation source,
const OperationFactory opType = nullptr 
)
static

◆ getUuid()

const QString & getUuid ( )

This UUID is only used for distributed scheduling purposes and will probably be removed in future. Use getId() for the actual operation QUuid.

◆ getVariableOperations() [1/2]

QList< Variable * > getVariableOperations ( )

◆ getVariableOperations() [2/2]

QList< const Variable * > getVariableOperations ( ) const

◆ getWorkspaceInputOperations() [1/2]

QList< WorkspaceInput * > getWorkspaceInputOperations ( )

◆ getWorkspaceInputOperations() [2/2]

QList< const WorkspaceInput * > getWorkspaceInputOperations ( ) const

◆ getWorkspaceOutputOperations() [1/2]

QList< WorkspaceOutput * > getWorkspaceOutputOperations ( )

◆ getWorkspaceOutputOperations() [2/2]

QList< const WorkspaceOutput * > getWorkspaceOutputOperations ( ) const

◆ getWorkspaces() [1/2]

QList< Workspace * > getWorkspaces ( )

◆ getWorkspaces() [2/2]

QList< const Workspace * > getWorkspaces ( ) const

◆ getWorkspacesWithSourceUrl()

QList< Workspace * > getWorkspacesWithSourceUrl ( const QString &  sourceUrl,
bool  descendIntoNestedItems = false 
)
Returns
A list of Workspaces that have the source URL requested in input sourceUrl.
Parameters
sourceUrlSource URL an Operation must have to be in the returned list
descendIntoNestedItemsIf true, any WorkspaceType operations (Workspace, ForLoop etc.) will be parsed as well

◆ hasDisabledConnections()

bool hasDisabledConnections ( ) const

Determines whether this workspace has any disabled connections.

Returns
Whether any connections are disabled (true) or not (false).

◆ hasStarted()

bool hasStarted ( )

Returns true if the workspace has started executing

◆ hasStopped()

bool hasStopped ( )

Returns true if the workspace has stopped executing

◆ haveAnchor()

bool haveAnchor ( const QUuid &  id) const

◆ haveMiniOperationRack()

bool haveMiniOperationRack ( const QUuid &  id) const

◆ haveNoteItem()

bool haveNoteItem ( const QUuid &  id) const

◆ idPathChanged()

void idPathChanged ( )
overridevirtual

Sub-classes should override this if they want to control notifications in response to ancestry changes.

Reimplemented from Operation.

◆ incrementUseCount()

void incrementUseCount ( )
protected

Increments the workspace's reference count.

◆ inputDataTypeChanged()

void inputDataTypeChanged ( WorkspaceInput source)

◆ isAsynchronous()

bool isAsynchronous ( ) const
overridevirtual
Returns
True if this workspace should run asynchronously
See also
setIsAsynchronous()

Reimplemented from Operation.

◆ isAsynchronousProcess()

bool isAsynchronousProcess ( ) const
overridevirtual
Returns
True if this workspace should run asynchronously in a dedicated process
See also
setIsAsynchronousProcess()

Reimplemented from Operation.

◆ isAtomicUpdate()

bool isAtomicUpdate ( ) const
overridevirtual
Returns
True if this workspace behaves as a single atomic operation from an execution point of view. If this is the case any input or output that is set out of date will set all other outputs out of date regardless of the connections within the workspace.
See also
setAtomicUpdate()

Reimplemented from Operation.

◆ isConnectedToAsynchronous()

bool isConnectedToAsynchronous ( ) const
overridevirtual
Returns
True if this Operation is connected to an asynchronous operation.

Reimplemented from Operation.

◆ isDelayedLoad()

bool isDelayedLoad ( ) const
Returns
True if the workspace is currently in a delayed load state.

A delayed load state is when a workspace has been loaded from an external location, but doing so caused a recursive definition of the workspace. To allow the workspace to still be valid, the actual loading of it is delayed until something actually requires it to be executed. Only the workspace's inputs and outputs are created, and the loading of all other operations it contains is delayed. The rest of the operations are loaded when something triggers the workspace's outputs to be updated.

This allows recursion to an arbitrary level by only creating as many recursion levels as needed.

◆ isPaused()

bool isPaused ( )

◆ isRoot()

bool isRoot ( ) const
Returns
True When this Workspace is the Root Workspace.

◆ isRunning()

bool isRunning ( )

◆ isRunningAsynchronously()

bool isRunningAsynchronously ( ) const
overridevirtual
Returns
True if this workspace is running asynchronously
See also
setIsAsynchronous()

Reimplemented from Operation.

◆ isScheduled()

bool isScheduled ( )

◆ isValid()

bool isValid ( ) const

Recurses through the workspace's contents to determine whether the workspace is valid, and therefore, whether it is able to be executed. Returns true when there are no invalid connections (i.e. connections between incompatible types), and no operations of type Placeholder.

Note
Generally, a workspace will only be invalid if it is being loaded from file, and the operation(s) that the workspace depends upon have had updates to their interface, or removed entirely (or located in a plugin that has not been loaded).

◆ isWaitingForAsynchronousUpdate()

bool isWaitingForAsynchronousUpdate ( ) const
overridevirtual
Returns
True if the updatable object is waiting for an asynchronous update.
See also
update()

Reimplemented from Operation.

◆ load()

bool load ( const SerializedItem item)
overridevirtual
Parameters
itemThe serialized data to load into the Workspace.

Loads the serialized item, expecting it to be a structured Workspace DOM. This function is exactly the same as operation, except that it sets the active OperationIdRegistry to help ensure that any legacy ids are converted into uuids.

Reimplemented from Operation.

◆ loadFromFile()

bool loadFromFile ( const QString &  fileName,
bool  loadPlaceholdersOnly = false,
bool  updateWsResourcePath = true 
)
Parameters
fileNameThe file that contains the serialized Workspace to be loaded.
loadPlaceholdersOnlyIf true, load all operations as placeholders, with the exception of nested Workspaces, WorkspaceInput and WorkspaceOutput operations.
updateWsResourcePathIf true, update the WS: resource path to correspond to the directory containing fileName.

If fileName is a relative path, then two locations will be searched for a file to read. The first location is the same directory as where the parent workspace came from (if there is a parent workspace). This is controlled by the most immediate parent in the workspace hierarchy that has its source URL or manual load source URL set. If either of these are also relative, the final location is built up by checking further up the workspace hierarchy until a non-relative path can be formed. If no file is found to exist at the first location, then fileName is taken to be relative to the current directory. If no file is found at that location either, the call fails.

If the fileName is not a relative path (ie it is an absolute path or a Qt resource path), it is used as is without modification. Note that a Qt resource path can never be relative.

Calling this function also sets the manual load source URL. Any previous contents of the workspace will have been cleared before loading in the new contents from the specified file.

Returns
True if the Workspace was loaded successfully, false otherwise.
See also
saveToFile(), setManualLoadSourceUrl()

◆ loadMetaData()

bool loadMetaData ( const QString &  serializedText)

This function only loads some meta data of the workflow from its saved serialized text. A use case is when workspace-server receives the workflow (as serialized text via the network) and needs the workflow meta data for its scheduling but does not and cannot load the entire workflow. In this case the entire workflow with all inputs outputs data will be loaded later from its saved serialized text by workspace-batch.

Returns
True if the meta data is loaded successfully, false otherwise.

◆ loadWithoutOverwrite()

bool loadWithoutOverwrite ( const SerializedItem item)
Parameters
itemThe item to load into this workspace. It is assumed that item is a Workspace description, so only the children of item are added to this workspace.

The difference between loadWithoutOverwrite() and load() is that load() will clear the existing contents first, whereas loadWithoutOverwrite() will not. As a result of this, to make sure that there are no id conflicts, the function will regenerate the ids of any operations that are added, and store the old->new mapping in replacedIds.

Note also that load() will populate the values of the workspace inputs and outputs, whereas loadWithoutOverwrite() will not. This is because loadWithoutOverwrite() is meant for loading operations other than data sources and requesters into an existing workspace. The only client code expected to use this function is that related to clipboard handling (eg PasteFromClipboard).

This function assumes this workspace is not in a delay-loaded state. This should only occur if the workspace is an external reference and that externally referenced workspace is recursive. Attempting to call loadWithoutOverwrite() on such a workspace is not recommended, since you technically should not be modifying a workspace that is an external reference anyway.

See also
load()

◆ logText()

void logText ( const QString &  msg)

◆ markOutputsUpToDate()

void markOutputsUpToDate ( )
overrideprotectedvirtual

Reimplemented from Operation.

◆ modifyAnchor()

void modifyAnchor ( const QUuid &  id,
const AnchorData d 
)

◆ modifyNoteItem()

void modifyNoteItem ( const QUuid &  id,
const NoteItemData d 
)

◆ nestedHaveDisabledConnections()

bool nestedHaveDisabledConnections ( ) const

Determines whether any nested workspaces have any disabled connections.

This function does not check the current workspace, see Workspace::hasDisabledConnections() if you also want to check the current workspace.

Returns
Whether any connections in any nested workspace are disabled (true) or not (false).

◆ onWorkspaceAbortedUpdate()

void onWorkspaceAbortedUpdate ( )
protected

◆ onWorkspaceFinishedExecution()

void onWorkspaceFinishedExecution ( )
protected

◆ onWorkspaceFinishedUpdate()

void onWorkspaceFinishedUpdate ( )
protected

◆ outputDataTypeChanged()

void outputDataTypeChanged ( WorkspaceOutput requester)

◆ pauseUpdate()

void pauseUpdate ( )

◆ postSave()

bool postSave ( SerializedItem item) const
overrideprotectedvirtual
Parameters
itemThe serialized item in which to save additional data.

This function saves the operations, connections and connection anchors of the workspace.

Returns
True if the save was successful.
See also
Operation::save()

Reimplemented from Operation.

◆ prepareInputsOutputsForLoad()

bool prepareInputsOutputsForLoad ( const SerializedItem item)
overrideprotectedvirtual
Parameters
itemThe serialized item that will be loaded.

Workspaces have their inputs defined by the presence of WorkspaceInput operations they hold. Similarly, their outputs are defined by the presence of WorkspaceOutput operations. This means that before the values of a workspace's inputs (and outputs for backwards compatibility reasons) can be loaded, those inputs must exist. This in turn implies that the contents of the workspace must be loaded first. The Workspace class reimpliments prepareInputsOutputsForLoad() to ensure that the data sources and requesters are loaded. If possible, the function will fully populate the workspace from the serialized data in item too, or else the rest of the data will be populated when something asks one of its WorkspaceOutput's to update.

Returns
True if the function was successful and the rest of the loading process can proceed.

Reimplemented from Operation.

Reimplemented in IteratingWorkspaceBase< ConditionalLoop, false >, IteratingWorkspaceBase< FileLoop, true >, IteratingWorkspaceBase< ForLoop, true >, IteratingWorkspaceBase< Derived, false >, IteratingWorkspaceBase< ObjectArrayLoop, false >, IteratingWorkspaceBase< Derived, true >, IteratingWorkspaceBase< TranslateObjectDictionary, true >, IteratingWorkspaceBase< ZeroMQReplyLoop, false >, and IteratingWorkspaceBase< ZeroMQSubscribeLoop, false >.

◆ processUpdateSet()

void processUpdateSet ( )

◆ regenerateOperationIds()

void regenerateOperationIds ( )

Regenerates the IDs of all operations contained in the workspace.

◆ removeAnchor()

bool removeAnchor ( const QUuid &  id)

◆ removeConnection()

bool removeConnection ( Connection connection)
Parameters
connectionThe connection to be removed from the workspace.

The connection will not be deleted, just removed from the workspace's internal list of connections it contains. This function would typically only be used by developers who are manipulating the contents of a workspace directly.

A RemoveConnectionEvent notification will be raised just before any change is made to connection and before it is removed from the workspace. If connection is not present in the workspace, no event notification will be made.

Returns
True if the connection was found in the workspace and subsequently removed.

◆ removeFromUpdateSet()

void removeFromUpdateSet ( Updatable updatable)

◆ removeMiniOperationFromRack()

bool removeMiniOperationFromRack ( const QUuid &  opId,
const QUuid &  rackId 
)

◆ removeMiniOperationRack()

bool removeMiniOperationRack ( const QUuid &  id)

◆ removeNoteItem()

bool removeNoteItem ( const QUuid &  id)

◆ removeOperation()

bool removeOperation ( Operation operation)
Parameters
operationThe operation to be removed from the workspace.

The operation will not be deleted, just removed from the workspace's internal list of operations it contains. This function would typically only be used by developers who are manipulating the contents of a workspace directly.

A RemoveOperationEvent notification will be raised just before any change is made to operation and before it is removed from the workspace. If operation is not present in the workspace, no event notification will be made.

Returns
True if the operation was found in the workspace and subsequently removed.

◆ requestContinuousUpdate()

void requestContinuousUpdate ( )

Requests a continuous update of the workspace.

◆ requestSingleShotUpdate() [1/2]

void requestSingleShotUpdate ( const QJsonDocument schedulerSettings)

Requests a single update of the workspace with a JSON scheduler settings

◆ requestSingleShotUpdate() [2/2]

void requestSingleShotUpdate ( const QStringList notifyMailRecipients = QStringList())

Requests a single update of the workspace.

◆ requestStop()

void requestStop ( )

Stops execution of the workspace asynchronously.

◆ resetExecutionDependencies()

void resetExecutionDependencies ( )
overridevirtual

When a workspace is being updated continuously, it notifies interested clients each time. The usual arrangement is for an observer to call resetExecutionDependencies for each notification.

See also
ResetDependency

Reimplemented from Operation.

◆ saveToFile()

bool saveToFile ( const QString &  fileName,
bool  saveData = false,
bool  saveAllOutputs = true 
)
Parameters
fileNameThe name of the file to write the serialized form of the Workspace to. Unlike for loadFromFile(), the fileName must be on the local filesystem.
saveDataA flag to indicate that data associated with any outputs within either the workspace or the operations it contains should be saved.
saveAllOutputsA flag to indicate that all outputs are saved, or otherwise, only top level outputs are saved.
Returns
True if the Workspace was saved successfully.
Note
If this function succeeds, it will also set the manual load source URL if the workspace has no parent workspace.
See also
loadFromFile(), setManualLoadSourceUrl()

◆ saveToFileConst()

bool saveToFileConst ( const QString &  fileName,
bool  saveData = false 
) const
Parameters
fileNameThe name of the file to write the serialized form of the Workspace to. Unlike for loadFromFile(), the fileName must be on the local filesystem.
saveDataA flag to indicate that data associated with any outputs within either the workspace or the operations it contains should be saved.
Returns
True if the Workspace was saved successfully.
Note
Unlike saveToFile() which modifies the internally tracked source url to be this new filename, this method doesn't modify the workflow at all or update the WORKSPACE_SEARCH_PATH_PREFIX

◆ saveWithData() [1/2]

bool saveWithData ( SerializedItem item) const
overridevirtual
Parameters
itemWhere content of the Workspace saved to.
Returns
True if the Workspace must run irrespective of any concurrency limit.
See also
setMustRun()

Reimplemented from Operation.

◆ saveWithData() [2/2]

bool saveWithData ( SerializedItem item,
bool  saveAllOutputs 
) const
Parameters
itemWhere content of the Workspace saved to.
saveAllOutputsTrue to save all outputs, False to only save top-level outputs.
Returns
True if the Workspace must run irrespective of any concurrency limit.
See also
setMustRun()

◆ setAtomicUpdate()

void setAtomicUpdate ( bool  atomic)
overridevirtual
Parameters
atomicSets whether this workspace behaves as an atomic operation.
See also
isAtomicUpdate()

Reimplemented from Operation.

◆ setCatalogueName()

void setCatalogueName ( const QString &  name)
Parameters
nameThe name to use for this workspace if it is added to a workspace collection. This is the name that will be shown for it in the operation catalogue.
See also
getCatalogueName(), setCataloguePath()

◆ setCataloguePath()

void setCataloguePath ( const QString &  path)
Parameters
pathThe path to use for this workspace if it is added to a workspace collection. This is the tree path under which it will appear in the operation catalogue. Use forward slashes to separate levels of the tree.
See also
getCataloguePath(), setCatalogueName()

◆ setGlobalNameValue()

bool setGlobalNameValue ( const QString &  globalName,
const T &  value 
)
inline
Parameters
globalNameThe globalName of the attached IOBase which is being assigned to. The globalName must be attached to a scalar input in the workspace itself, or one of its sub-workspaces.
valueThe value to assign to the target IOBase.

Finds the IOBase with the specified globalname in the workspace, and assigns the specified value to it. Success is dependent on the following factors:

  • The global name exists in the workspace or a nested workspace
  • The global name is attached to a scalar input
  • The input is not already connected
  • The input's data factory matches the value type
Precondition
The workspace must not be running when the function is called.
Returns
true if the value was able to be assigned to the IOBase. False otherwise.

◆ setIdPathCachingEnabled()

void setIdPathCachingEnabled ( bool  b)
overridevirtual
Parameters
bWhether or not to enable IdPath caching.

If enabled, the workspace will cache its IdPath both in memory and in serialised form. If the workspace is going to be executed in a distributed environment away from its in-memory parent workflow, a cached ID path is necessary, however, rather than imposing this memory / file size encumbrance on all operations, we make it an opt-in.

Note that if a Workspace is caching IdPaths, all of its child operations will be set to cache their IdPaths as well.

Reimplemented from Operation.

◆ setIgnoreAliasedOperations()

void setIgnoreAliasedOperations ( bool  value)
static

◆ setInputNotUpToDate()

void setInputNotUpToDate ( InputScalar input)
overridevirtual

◆ setIsAsynchronous()

void setIsAsynchronous ( bool  asynchronous)
overridevirtual
Parameters
asynchronousSets whether this workspace runs asynchronously
See also
isAsynchronous()

Reimplemented from Operation.

◆ setIsAsynchronousProcess()

void setIsAsynchronousProcess ( bool  asynchronous)
overridevirtual
Parameters
asynchronousSets whether this workspace runs asynchronously in a dedicated process
See also
isAsynchronousProcess()

Reimplemented from Operation.

◆ setIsRunningAsynchronously()

void setIsRunningAsynchronously ( bool  running)
overridevirtual
Parameters
runningSets whether this workspace runs asynchronously
See also
isAsynchronous()

Reimplemented from Operation.

◆ setIsScheduled()

void setIsScheduled ( bool  scheduled)

◆ setManualLoadSourceUrl()

void setManualLoadSourceUrl ( const QString &  url)
Parameters
urlThe url or file name that this workspace should be considered to have been loaded from.

The manual load source url is meant to signify where a workspace came from without recording that information in any serialized form of the workspace. It would normally only be set just before client code loads a top level workspace from disk or when saving a top level workspace.

Client code would not normally need to call setManualLoadSourceUrl() directly, since it is called automatically by loadFromFile(), which is the function that client code would normally use for such scenarios. It may need to be called directly if, for example, client code loads an XML project file directly and then wants to load that serialized description into a workspace. While valid, this is not the recommended approach and should only be done if the desired behaviour cannot be achieved using loadFromFile().

This function sets different information to what setSourceUrl() sets. The setSourceUrl() function specifies where to load the contents of the workspace from when it is loaded. When saving, having the source url set by setSourceUrl() will prevent the contents of the workspace from being saved, since the contents will be read from the external source when it needs to be populated. Compare this to setManualLoadSourceUrl() which specifies where the existing contents came from.

If this workspace has a parent workspace, calling setManualLoadSourceUrl() will have no effect. This is because the workspace is essentially owned by its parent and therefore comes from wherever its parent came from.

Note
Just to be very clear, don't call this function unless you really have to. Prefer calling loadFromFile() instead and let that set things as necessary.
See also
setSourceUrl()

◆ setMustRun()

void setMustRun ( bool  mustRun)

Indicates that the Workspace must run irrespective of any concurrency limit.

See also
getMustRun()

◆ setNamespace()

void setNamespace ( const QString &  name)

◆ setNotes()

void setNotes ( const QString &  notes)
Parameters
notesThe new notes for the workspace. Any valid HTML code is acceptable, with the understanding that it will be placed within <html><body> tags. Any HTML supported by QWebPage should be considered valid.

If notes is different to the current notes, a WorkspaceNotesEvent notification will be raised.

◆ setOutputNotUpToDate()

void setOutputNotUpToDate ( Output output)
overridevirtual
Parameters
outputThe output making the request for the status to be changed.

The Workspace needs to forward this status change request to the WorkspaceOutput corresponding to output within itself. It will also mark the workspace as not up to date.

Reimplemented from Operation.

◆ setOutputUpToDate()

void setOutputUpToDate ( WorkspaceOutput requester,
bool  b 
)

◆ setSourceUrl()

void setSourceUrl ( const QString &  url)
Parameters
urlThe external URL this workspace should act as a wrapper for.

If url is an empty string, the workspace does not act as a wrapper and instead it will load and save the workspace contents directly. If url is not an empty string, then this workspace acts as a wrapper around whatever url points to. This allows a workspace to quickly and easily import another externally defined workspace as an operation. The external workspace could even be stored centrally on a file system and shared among multiple users. Each user would only need their own workspace to act as a wrapper around the external workspace. If url is not empty, then the manual load source URL is cleared.

See also
setManualLoadSourceUrl(), getSourceUrl()

◆ setSupportsRemoteExecution()

void setSupportsRemoteExecution ( bool  val)

◆ setSynchronisationSource()

void setSynchronisationSource ( Workspace src)

Sets a Workspace that is to be used to synchronise data from

See also
synchronize()

◆ setSyncSerializedWorkflow()

void setSyncSerializedWorkflow ( const QString &  serializedWorkflow)

Sets a Workspace (as serialized text) that is to be used to synchronise data from

See also
synchronize()

◆ setUpToDate()

void setUpToDate ( bool  b)
overridevirtual

Override Operation::setUpToDate(). Notify WorkspaceOutOfDateEvent when becoming out of date.

See also
Operation::setUpToDate()

Reimplemented from Operation.

◆ setUuid()

void setUuid ( const QString &  uuid)

This UUID is only used for distributed scheduling purposes and will probably be removed in future. Use setId() for the actual operation QUuid.

◆ setWasRunning()

void setWasRunning ( bool  b)

◆ shouldPutInExtras()

bool shouldPutInExtras ( const QString &  tagName) const
overrideprotectedvirtual
Parameters
tagNameThe tag name being queried.

Workspaces can have operation and connection tags of their own. These define the contents of the workspace and will be processed by the workspace during a call to save() or load(). Therefore, these should be omitted from the extras data, which is what this reimplimentation does.

Reimplemented from Operation.

◆ stopAndWaitUntilFinishedRunning()

void stopAndWaitUntilFinishedRunning ( )

Stops execution of the workspace and waits (i.e. blocks) until the workspace has finished executing. As this method is a blocking method and blocks until a workspace has finished running, it should not be called from a method initiated from within the workspace's run loop. This means it should not be called in response to notified workspace execution events directly as these are invoked by the workspace's run loop and so as long as the caller IS the workspace run loop, the workspace will always be running.

◆ synchronize() [1/2]

bool synchronize ( )

Requests the Workspace synchronise itself from a previously supplied synchronisation source

Returns
True if the synchronisation succeeded
See also
setSynchronisationSource()

◆ synchronize() [2/2]

bool synchronize ( Workspace src,
Workspace dst 
)
static

Copies the output data from the source to the destination

Parameters
srcThe Workspace from which output data is to be copied
dstThe Workspace to which output data is to be copied to

◆ terminate()

void terminate ( )

◆ update()

bool update ( Updater updater = nullptr)
overridevirtual

Updates a Workspace in-place. When executed in-place the Workspace this function spins until the Workspace has completed and so could consume excessive CPU during execution.

See also
Operation::update
WorkspaceExecutionSucceededEvent
WorkspaceExecutionFailedEvent
Returns
True if the update was successful.

Reimplemented from Operation.

◆ wasRunning()

bool wasRunning ( )

◆ workspaceChanged()

void workspaceChanged ( Workspace oldWorkspace)
overridevirtual
Parameters
oldWorkspaceThe previous workspace before it was changed.

Sub-classes should override this if they want to be notified whenever setWorkspace is called with a workspace different to the currently assigned workspace. The last thing setWorkspace will do before returning is call workspaceChanged with the old workspace as the parameter (this could be a null pointer).

Client code can also call this function if they change something which affects the workspace and which may affect operations in it. An example might be when a workspace has its own parent workspace set, so all WorkspaceInput operations need to be notified so they can change their internal data routing to reflect this.

Warning
The workspace oldWorkspace used to point to might no longer exist, so it is not safe to dereference this pointer.

Reimplemented from WorkspaceElement.

Member Data Documentation

◆ WORKSPACE_SEARCH_PATH_PREFIX

const QString WORKSPACE_SEARCH_PATH_PREFIX
static