Workspace 6.21.5
Public Member Functions | Static Public Member Functions | List of all members
OperationFactoryTraits< T > Class Template Reference

Traits class for operations of type T. More...

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

Public Member Functions

CSIRO_EXPORTSPEC ChartToImagecreate ()
 
CSIRO_WORKSPACE_API CSIRO::DataExecution::Workspacecreate ()
 
CSIRO_EXPORTSPEC const OperationFactorygetInstance ()
 
CSIRO_WORKSPACE_API const OperationFactorygetInstance ()
 
QString getRawHeaderPath () const
 
QString getRawHeaderPath () const
 

Static Public Member Functions

static T * create ()
 
static void destroy (T *op)
 
static QString getCataloguePath ()
 
static const OperationFactorygetInstance ()
 
static const Application::WorkspacePlugingetPlugin ()
 
static QString getType ()
 
static constexpr bool isWorkspaceType ()
 

Detailed Description

template<typename T>
class CSIRO::DataExecution::OperationFactoryTraits< T >

In order to ensure that operation factories used across plugins are portable (ie will work on all platforms), there are cases where the code must prevent the compiler from having the chance to inline certain functions. In particular, the TypedOperationFactory template implements some memory allocation and deallocation, and this must not be allowed to get inlined or else memory could be allocated in one module and deallocated in another, and that is not portable. Therefore, the OperationFactoryTraits class provides an interface to the TypedOperationFactory functions but in a way that hides its implementation. The factory is ultimately instantiated by the DEFINE_WORKSPACE_OPERATION_FACTORY macro and the client code instantiates the OperationFactoryTraits class whenever it is needed. The macro defines the functions that are only declared in the OperationFactoryTraits class, and by only using the macro in an implementation file and never a header, the two classes are effectively decoupled and client code never sees the implementation of TypedOperationFactory.

Member Function Documentation

◆ create() [1/3]

◆ create() [2/3]

static T * create ( )
static
Returns
A new dynamically allocated operation of type T.

Conceptually similar to the C++ new operator.

See also
TypedOperationFactory::create()

◆ create() [3/3]

◆ destroy()

static void destroy ( T *  op)
inlinestatic
Parameters
opAn operation assumed to be of type T that is also assumed to have been created by a call to create().

Deletes op. Conceptually similar to the C++ delete operator.

See also
TypedOperationFactory::destroy()

◆ getCataloguePath()

static QString getCataloguePath ( )
inlinestatic
Returns
The catalogue path for operations of type T. This is used in the GUI application to determine where the operation should be placed in the catalogue dock window's tree hierarchy. It is safe to change this at any time since it will not affect existing workspace files, only the way the GUI application behaves.
See also
OperationFactory::getCataloguePath()

◆ getInstance() [1/3]

CSIRO_EXPORTSPEC const OperationFactory & getInstance ( )

◆ getInstance() [2/3]

static const OperationFactory & getInstance ( )
static
Returns
The factory responsible for operations of type T.

◆ getInstance() [3/3]

CSIRO_WORKSPACE_API const OperationFactory & getInstance ( )

◆ getPlugin()

static const Application::WorkspacePlugin & getPlugin ( )
inlinestatic
Returns
The plugin that provides the factory for operations of type T.
See also
OperationFactory::getPlugin()

◆ getRawHeaderPath() [1/2]

QString getRawHeaderPath ( ) const

◆ getRawHeaderPath() [2/2]

QString getRawHeaderPath ( ) const
inline

◆ getType()

static QString getType ( )
inlinestatic
Returns
The type name that operations of type T are known by in a workspace.
See also
OperationFactory::getType()

◆ isWorkspaceType()

static constexpr bool isWorkspaceType ( )
inlinestaticconstexpr
Returns
True if the operation is a workspace type, false otherwise. Defined as a constexpr so it can be used for compile-time evaluation.