Workspace 6.21.5
Public Types | Public Member Functions | List of all members
Output Class Reference

Class for operation outputs. More...

#include <Workspace/DataExecution/InputOutput/output.h>

Inheritance diagram for Output:
[legend]

Public Types

using size_type = size_t
 

Public Member Functions

 Output (const QString &name, DataObject &obj, Operation &op, bool matchOperationState=true)
 
 ~Output () override
 
void addConnection (Connection &connection)
 
bool canSerialize () const override
 
bool connected () const override
 
void disconnect () override
 
ConnectiongetConnection (size_type i)
 
const ConnectiongetConnection (size_type i) const
 
Connection ** getConnectionArray () const
 
QString getDataPathUsingId (bool scoped=true) const override
 
template<typename T >
T & getRawData ()
 
template<typename T >
const T & getRawData () const
 
QString getTagName () const override
 
bool getUpToDate () const override
 
virtual bool hasUpdater () const
 
bool isConnectedToAsynchronous () const override
 
bool isFactoryCompatible (const DataFactory &factory) const
 
bool isWaitingForAsynchronousUpdate () const override
 
bool load (const SerializedItem &item) override
 
size_type numConnections () const
 
void removeConnection (Connection &connection)
 
bool save (SerializedItem &item) const override
 
virtual bool saveWithData (SerializedItem &item) const
 
void setUpToDate (bool b) override
 
bool update (Updater *updater=nullptr) override
 
- Public Member Functions inherited from IOBase
 ~IOBase () override
 
void addConnectorThatRequiresQueuing ()
 
void clearWidgetPropertyValues ()
 
virtual bool connected () const =0
 
virtual void disconnect ()=0
 
bool getAllowedToSerialize () const
 
DataObjectgetDataObject ()
 
const DataObjectgetDataObject () const
 
virtual QString getDataPath () const
 
virtual QString getDataPathUsingId (bool scoped=true) const
 
const QString & getDeprecationMessage () const
 
const QString & getDescription () const
 
const DataFactorygetFactory () const
 
IOBasegetFromPath (const QString &path, Workspace &relativeTo, QStringList &errors) const override
 
QString getIdPath (bool scoped=true) const override
 
const QString & getName () const
 
OperationgetOperation ()
 
const OperationgetOperation () const
 
const QString & getPreferredWidget () const
 
const WorkspacegetRootWorkspace () const override
 
WorkspacegetRootWorkspace () override
 
virtual QString getTagName () const =0
 
bool getUpToDate () const override=0
 
bool getVisible () const
 
const QMap< QString, QVariant > & getWidgetPropertyValueMap (const QString &widgetClassName) const
 
QValidator * getWidgetValidator ()
 
const QValidator * getWidgetValidator () const
 
const WorkspacegetWorkspace () const override
 
WorkspacegetWorkspace () override
 
bool isDeprecated () const
 
void markAsDeprecated (bool b, const QString &message="")
 
virtual void markUpToDateWhereSafe ()
 
void removeConnectorThatRequiresQueuing ()
 
void setAllowedToSerialize (bool b)
 
void setDataObject (DataObject &obj)
 
void setDescription (const QString &description)
 
void setName (const QString &name)
 
void setOperation (Operation *op)
 
void setPreferredWidget (const QString &name)
 
void setUpToDate (bool b) override=0
 
void setVisible (bool b)
 
void setWidgetPropertyValue (const QString &widgetClassName, const QString &propertyName, const QVariant &value)
 
void setWidgetValidator (QValidator *validator)
 
bool shouldQueueChangesWhileUpdating () const
 
bool update (Updater *updater=nullptr) override=0
 
- 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
 

Additional Inherited Members

- Static Public Member Functions inherited from IOBase
static IOBasegetIOBaseFromDataPath (const QString &dataPath, Operation &relativeTo, QStringList &errors)
 
- 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)
 
- Protected Member Functions inherited from IOBase
 IOBase (const QString &name, DataObject &obj)
 
virtual void operationChanged (Operation *oldOp)
 
void setVerifiedName (const QString &name)
 
- 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 &)
 

Detailed Description

Outputs are always scalar, but multiple connections can be made from the one output.

Member Typedef Documentation

◆ size_type

using size_type = size_t

Constructor & Destructor Documentation

◆ Output()

Output ( const QString &  name,
DataObject obj,
Operation op,
bool  matchOperationState = true 
)
Parameters
nameThe name of the output. An output with the same name must not already exist in op.
objThe DataObject to use for this output.
opThe operation owning this output. The output will be added to op by the constructor.
matchOperationStateThis parameter will almost always be true. The up to date state of the output generally cannot be up to date unless the operation owning the output is also up to date. The output is normally only marked as up to date after the operation itself updates. There are, however, some cases where this condition does not hold true. Some looping operations will take over handling of the up to date status of their outputs and inputs and will trigger updates multiple times within their own execute() function. Their looping nature means that up to date status propagation would normally prevent inputs and outputs from ever getting an up to date status, hence why they manually take over that responsibility. It would be extremely rare for plugins to define an output with matchOperationState set to false.

The output does not take ownership of obj.

Note
All Output objects are created with their flag for allowed to serialize set to false. Few operations will override this, since it can create inconsistent update states in a workspace if not used carefully.

◆ ~Output()

~Output ( )
override

Removes the output from its operation.

Member Function Documentation

◆ addConnection()

void addConnection ( Connection connection)
Parameters
connectionThe connection to connect to this output.
Precondition
connection must not already be connected to this output.

◆ canSerialize()

bool canSerialize ( ) const
overridevirtual
Returns
True if this object can be serialized.

For objects that can be serialized, the save and load functions will be used to do the serialization. If this function returns false, both load() and save() must also return false.

Implements Serialize.

◆ connected()

bool connected ( ) const
overridevirtual
Returns
True if there are no connections to this output.

Implements IOBase.

◆ disconnect()

void disconnect ( )
overridevirtual

If any connection exists to this input or output, this function is responsible for destroying it. For some subclasses (notably InputArray), this may mean forwarding the call to other objects eg the InputScalar elements of an InputArray).

Implements IOBase.

◆ getConnection() [1/2]

Connection * getConnection ( size_type  i)
Parameters
iThe index of the connection to retrieve. No check is made to determine if i refers to a valid connection.
Returns
The connection at index i.

◆ getConnection() [2/2]

const Connection * getConnection ( size_type  i) const
Parameters
iThe index of the connection to retrieve. No check is made to determine if i refers to a valid connection.
Returns
The connection at index i.

◆ getConnectionArray()

Connection ** getConnectionArray ( ) const
Returns
The array of connections to this output. This array should not be modified, but the connections themselves can be, although this should be avoided unless you are sure it is safe to do so.
Precondition
There must be at least one connection for this call to be safe. Clients should test with connected() first.
Returns
The return value is intended for use as an iterator over the connections. For example:
if (output.connected())
{
unsigned numConnections = output.size();
Connection** itBegin = output.getConnectionArray();
Connection** itEnd = itBegin + numConnections;
for (Connection** it = itBegin; it != itEnd; ++it)
{
// Do something with the connection ....
}
}
Represents a connection of an output to an input.
Definition: connection.h:66
size_type numConnections() const
Definition: output.cpp:207

◆ getDataPathUsingId()

QString getDataPathUsingId ( bool  scoped = true) const
overridevirtual
Parameters
scopedIf true then return full scope of the item. If false, only return identifier local to its workflow.
Returns
The data path of the input/output using an operation ID path. The default implementation returns an empty string, which means an invalid data path (ie the input/output cannot support data manipulation).

Client code would not normally call this function, but rather would call getDataPath() instead because that function prefers to return the global name form of data path. A global name data path is more flexible than an operation ID data path, but it also has potential non-uniqueness issues if a global name is used more than once. A data path based on an operation ID path, on the other hand, is always unique, but it is broken by operations being moved to a different workspace or by them (or any parent workspace) being renumbered.

See also
getDataPath()

Reimplemented from IOBase.

◆ getRawData() [1/2]

T & getRawData ( )
inline

Convenience wrapper around DataObject::getRawData() for the data object returned by getDataObject(). See the requirements for DataObject::getRawData() before using this function. In addition to those requirements, callers should ensure that it is actually safe to even use this output's data object. No checks on the output's up to date status are performed by this function, since it is assumed that the caller really knows the state of things and just wants to have convenient access to the underlying data.

◆ getRawData() [2/2]

const T & getRawData ( ) const
inline

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

◆ getTagName()

QString getTagName ( ) const
overridevirtual
Returns
The tag name to use for this object when it is serialized.

The main usage of tag names is for XML tags, so essentially anything which is illegal for an XML tag name is also illegal here. There are slightly more restrictions on tag names as used here though. Subclasses must implement this function to return a non-empty string which obeys the following three rules:

  • Must be all lowercase
  • Must start with a letter
  • Must only consist of letters, numbers and underscores

Implements IOBase.

◆ getUpToDate()

bool getUpToDate ( ) const
overridevirtual
Returns
True if this output is up to date.

Implements IOBase.

◆ hasUpdater()

bool hasUpdater ( ) const
virtual

◆ isConnectedToAsynchronous()

bool isConnectedToAsynchronous ( ) const
overridevirtual
Returns
True if the updatable object is connected to an asynchronous updatable.
See also
isWaitingForAsynchronousUpdate(), update()

Implements Updatable.

◆ isFactoryCompatible()

bool isFactoryCompatible ( const DataFactory factory) const
Parameters
factorythe data factory to check compatibility against.
Returns
true if this data object's data factory is compatible with the specified data factory.

◆ isWaitingForAsynchronousUpdate()

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

Implements Updatable.

◆ load()

bool load ( const SerializedItem item)
overridevirtual
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.

◆ numConnections()

Output::size_type numConnections ( ) const
Returns
The number of connections attached to this output.

◆ removeConnection()

void removeConnection ( Connection connection)
Parameters
connectionThe connection to disconnect from this output.
Precondition
connection must be connected to this output.

◆ save()

bool save ( SerializedItem item) const
overridevirtual

The call to save() does not save the output's data. Only the global name for the output (if set) and the preferred widget type is serialized to item.

Implements Serialize.

◆ saveWithData()

bool saveWithData ( SerializedItem item) const
virtual

Saves both the global names associated with the output in addition to an output's data. If the type associated with an output doesn't support serialisation then no data will be saved.

◆ setUpToDate()

void setUpToDate ( bool  b)
overridevirtual
Parameters
bBoolean value specifying the output's new up-to-date status.

If b is false, the call will also try to propagate the not up-to-date status through the workspace. The propagation will continue until it reaches something already not up to date.

Implements IOBase.

◆ update()

bool update ( Updater updater = nullptr)
overridevirtual

Calling this function ensures that the output holds a valid, up to date data object. The operation to which the output belongs (if any) will be executed if required in order to bring the output up to date.

Returns
True if the update was successful.

Implements IOBase.