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

Place holder used when a workspace is loaded an a particular operation type is unable to be provided. More...

#include <Workspace/DataExecution/Operations/Builtin/placeholder.h>

Inheritance diagram for PlaceHolder:
[legend]

Public Member Functions

 PlaceHolder ()
 
 ~PlaceHolder () override
 
QString getHelpPage () const override
 
QString getSourcePluginName () const
 
QString getType () const
 
bool save (SerializedItem &item) const override
 
void setAtomicUpdate (bool atomic) override
 
bool update (Updater *updater=nullptr) 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)
 

Protected Member Functions

 PlaceHolder (const OperationFactory &factory, const QString &label)
 
bool execute () override
 
bool finishInputsOutputsAfterLoad (const SerializedItem &item) override
 
bool load (const DataExecution::SerializedItem &item) override
 
bool prepareInputsOutputsForLoad (const SerializedItem &item) 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
 
- 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)
 

Detailed Description

When loading a workspace from a serialized representation, there are scenarios where a particular type of operation needs to be created but there is no operation factory available to provide it. In such situations, a PlaceHolder operation will be created instead.

PlaceHolder operations have some special behaviours compared to a typical operation:

Constructor & Destructor Documentation

◆ PlaceHolder() [1/2]

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

◆ PlaceHolder() [2/2]

◆ ~PlaceHolder()

~PlaceHolder ( )
override

Member Function Documentation

◆ execute()

bool execute ( )
overrideprotectedvirtual

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.

◆ 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.

◆ getHelpPage()

QString getHelpPage ( ) const
overridevirtual
Returns
The file name of the help page for this operation. The file name should be unique within this plugin's help documentation and would normally correspond to the name given to a \page in doxygen-generated documentation sets. For example, the operation's help page is often defined like so:
\page helpmyoperation MyOperation 

In this case, getHelpPage() should return the string "helpmyoperation".

Note
Due to issues with how doxygen handles lower/uppercase keywords, you should use only lowercase names for your \page's. Otherwise you may find that cross-references to these pages do not work.

Reimplemented from Operation.

◆ getSourcePluginName()

QString getSourcePluginName ( ) const

◆ getType()

QString getType ( ) const

◆ load()

bool load ( const DataExecution::SerializedItem item)
overrideprotectedvirtual
Parameters
itemSupplies the state to be loaded into this object.

This function will load the state of this object from item. For many object types, this is most easily implemented in terms of the object's input operator (>>).

It would be reasonable for subclass implementations to assume that the data provided in item is in the same form as would have been saved from a call to save.

Returns
If the state of the object could not be loaded, the function returns false. A return value of true implies that the object state was successfully loaded. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

◆ prepareInputsOutputsForLoad()

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

This function is called just before load() attempts to load the data for inputs and outputs from item. The default implementation simply returns true to indicate that loading can proceed. Subclasses may override this function to perform any required tasks that must be done before the inputs or outputs can be accessed. Typical uses usually revolve around tasks that create inputs and outputs, such as populating a nested workspace, setting the data type of a polymorphic data operation, etc.

Most subclasses will not need to override this function.

Returns
True if the function was successful and the data for the inputs and outputs can be loaded.

Reimplemented from Operation.

◆ save()

bool save ( SerializedItem item) const
overridevirtual
Parameters
itemWhere to save the state of this object.

This function will serialise the object by saving it to item. For most object types, this is most easily implemented in terms of the object's output operator (<<).

It is allowable for an object to only serialize part of itself. This would be useful if the data it represents has a set of defaults and only those values different to the defaults need to be serialized. Such an implementation then needs to be careful how it handles the complimentary load member function.

Returns
If an object could not be serialised or if the underlying object type does not support serialisation, this function should return false. A return value of true implies that the object was successfully saved to item. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

◆ setAtomicUpdate()

void setAtomicUpdate ( bool  atomic)
overridevirtual

The PlaceHolder class ignores all attempts to modify its atomicity and simply ignores the value atomic. This function is provided so that a PlaceHolder can be created to stand in for a Workspace which failed to load.

Reimplemented from Operation.

◆ update()

bool update ( Updater updater = nullptr)
overridevirtual
Parameters
updaterThe execution thread that is calling the function. When the object is being updated from within a workspace, this parameter will normally hold the execution thread that is calling this function. If the object is not part of a workspace or is being updated from client code directly in some other way, this parameter should be a null pointer to indicate that execution is not under the control of an Updater object. This is crucial for robust handling of things like logging messages.

Calling this function attempts to bring the object up to date. For objects connected in a workspace, this must first bring all upstream dependencies up to date as required. Some updatables can update themselves asynchronously. In such instances update() will return false if an updatable is still being updated (asynchronously). In order to determine if an update() returned false because of a genuine failure or because the update is asynchronous (and still in progress) the isWaitingForAsynchronousUpdate() method should be queried to help determine the cause of the update failure.

Returns
True if the update was successful.
Postcondition
Exactly what "up to date" means is up to the subclass, but if update() returns true, then getUpToDate() must also return true immediately after update() returns.
See also
setUpToDate(), getUpToDate(), isWaitingForAsynchronousUpdate()

Implements Updatable.