Workspace 6.21.5
Public Member Functions | List of all members
OperationFactory Class Referenceabstract

Base class for all operation factories. More...

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

Inheritance diagram for OperationFactory:
[legend]

Public Member Functions

virtual ~OperationFactory ()=default
 
virtual Operationcreate () const =0
 
virtual void destroy (Operation *op) const =0
 
virtual QString getCataloguePath () const =0
 
virtual QString getDefaultIconPath () const =0
 
virtual QString getDeprecationMessage () const =0
 
QString getHeaderPath () const
 
virtual const Application::WorkspacePlugingetPlugin () const =0
 
virtual QString getSourceTreeTop () const =0
 
virtual QString getType () const =0
 
virtual bool isDeprecated () const =0
 
virtual bool isWorkspaceType () const =0
 

Detailed Description

An operation factory is responsible for creating and destroying new operations of a specific type. The workspace application will build up a list of operation factories and select the appropriate factory as required to manage all the operations it needs.

Apart from actually creating and destroying operations, the other main responsibility of a factory is to ensure it provides a unique module name and that this name doesn't change. Any change to the module name or the type of the operation (as given by the getType function) will result in all existing saved workspaces no longer being loadable. Therefore, it is essential that appropriate names be chosen right from the beginning.

Constructor & Destructor Documentation

◆ ~OperationFactory()

virtual ~OperationFactory ( )
virtualdefault

Member Function Documentation

◆ create()

virtual Operation * create ( ) const
pure virtual
Returns
A new operation. Ownership is given to the caller, but the caller must use the destroy function to delete the operation. A valid object must be returned or else an exception thrown.

Most subclasses will simply use the C++ new operator to implement this function.

Implemented in TypedOperationFactory< T >.

◆ destroy()

virtual void destroy ( Operation op) const
pure virtual
Parameters
opThe operation to destroy. It must have been created by a call to create().

Calling this function essentially gives back ownership of the operation to the factory, but the expectation is that the operation will be deleted. Most subclasses will simply use the C++ delete operator to implement this function.

Implemented in TypedOperationFactory< T >.

◆ getCataloguePath()

virtual QString getCataloguePath ( ) const
pure virtual
Returns
A path indicating where the operation should appear in the catalogue hierarchy. This is case-sensitive.

A path may only include letters, numbers, underscores and spaces. The forward slash character (/) is used to separate levels in the catalogue, similar to how directories are separated in a path for file systems.

Unlike the type and module names, the catalogue path can be changed without affecting the loadability of existing workspaces. It is only used to help the user find it in user interfaces.

Implemented in TypedOperationFactory< T >, and TypedOperationFactory< T >.

◆ getDefaultIconPath()

virtual QString getDefaultIconPath ( ) const
pure virtual
Returns
The file or resource location of the default icon for operations created by this factory.

It is recommended that this path be a Qt resource path. Example: "images:/myoperation.png"

Implemented in TypedOperationFactory< T >, and TypedOperationFactory< T >.

◆ getDeprecationMessage()

virtual QString getDeprecationMessage ( ) const
pure virtual
Returns
If this operation is deprecated, a string containing the message to display (usually a reason for this operation being deprecated, plus the name of its replacement, if one exists). If the operation is not deprecated, an empty string will be returned.

Implemented in TypedOperationFactory< T >.

◆ getHeaderPath()

QString getHeaderPath ( ) const
Returns
The header file the operation type was defined in at build time in compact form. This is typically used by the Wizard code to include header file of an operation in the generated source files.
The header path to use in #include directives of C++ files that use this operation type.

This function calls getRawHeaderPath() and modifies what it returns to form a more compact path. Typically this involves stripping off some portion of the start of an absolute path to leave a minimal path relative to either the top of the source tree or the directory above that. The result of getRawHeaderPath() will be returned unchanged if no leading part could be stripped off.

◆ getPlugin()

virtual const Application::WorkspacePlugin & getPlugin ( ) const
pure virtual
Returns
The WorkspacePlugin instance which provides this operation factory.

Implemented in TypedOperationFactory< T >, and TypedOperationFactory< T >.

◆ getSourceTreeTop()

virtual QString getSourceTreeTop ( ) const
pure virtual

Implemented in TypedOperationFactory< T >.

◆ getType()

virtual QString getType ( ) const
pure virtual
Returns
A name identifying the type of operation created by this factory. It must be unique among all operations supplied by this plugin. This is case-sensitive.

Subclass implementors should not change the value returned by this function if it can be avoided, as doing so makes all existing saved workspaces no longer loadable.

See also
getPlugin()

Implemented in TypedOperationFactory< T >, and TypedOperationFactory< T >.

◆ isDeprecated()

virtual bool isDeprecated ( ) const
pure virtual
Returns
True if this operation is deprecated and should be avoided in future workflows. False otherwise.
See also
getDeprecationMessage

Implemented in TypedOperationFactory< T >.

◆ isWorkspaceType()

virtual bool isWorkspaceType ( ) const
pure virtual
Returns
True if the operation is a workspace type (i.e. a type that derives from the Workspace class and should be treated in workflows as a specialised type of nested workflow).

Implemented in TypedOperationFactory< T >, and TypedOperationFactory< T >.