Workspace 6.21.5
Classes | Namespaces | Macros | Functions
simpleadaptor.h File Reference
#include <functional>
#include <memory>
#include <QDebug>
#include <QtGlobal>
#include "Workspace/api_workspace.h"
#include "datafactorytraits.h"
#include "dataobject.h"
#include "dependency.h"
#include "typeadaptor.h"
#include "typeadaptorfactory.h"
#include "typedobject.h"
Include dependency graph for simpleadaptor.h:
This graph shows which files directly or indirectly include this file:

Classes

class  SimpleAdaptor< From, To >
 A TypeAdaptor class for converting between two types using an adapt(From, To) func. More...
 
class  SimpleAdaptorFactory< From, To >
 A TypeAdaptorFactory for an adaptor converting between two types using an adapt(From, To) func. More...
 
class  SimpleDataObjectAdaptor< From, To >
 A TypeAdaptor class for converting between two types using an adapt(DataObject from, DataObject to, bool copy) func. More...
 

Namespaces

namespace  CSIRO
 Top level namespace for all Workspace code.
 
namespace  CSIRO::DataExecution
 Base workspace functionality not requiring a user interface.
 

Macros

#define DECLARE_WORKSPACE_SIMPLEADAPTOR(F, T, WORKSPACE_EXPORT_SYMBOL)
 
#define DECLARE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR(F, T, WORKSPACE_EXPORT_SYMBOL)
 
#define DEFINE_WORKSPACE_SIMPLEADAPTOR(F, T, P, Func)
 
#define DEFINE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR(F, T, P, Func)
 

Functions

bool adaptDataObject (DataObject &src, DataObject &dest, bool copy, const TypeAdaptorFactory *adaptorFactory)
 

Macro Definition Documentation

◆ DECLARE_WORKSPACE_SIMPLEADAPTOR

#define DECLARE_WORKSPACE_SIMPLEADAPTOR (   F,
  T,
  WORKSPACE_EXPORT_SYMBOL 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
WORKSPACE_EXPORT_SYMBOL const SimpleAdaptorFactory<F, T>& SimpleAdaptorFactory<F, T>::getInstance(); \
template<> \
WORKSPACE_EXPORT_SYMBOL \
TypeAdaptor* \
SimpleAdaptorFactory<F, T>::create() const; \
template<> \
WORKSPACE_EXPORT_SYMBOL void SimpleAdaptorFactory<F, T>::destroy(TypeAdaptor* a) const; \
template<> \
WORKSPACE_EXPORT_SYMBOL const Application::WorkspacePlugin& SimpleAdaptorFactory<F, T>::getPlugin() const; \
} \
}
static const SimpleAdaptorFactory & getInstance()
void destroy(TypeAdaptor *a) const override
const Application::WorkspacePlugin & getPlugin() const override
Top level namespace for all Workspace code.
Definition: applicationsupportplugin.cpp:32

Use this macro in a header (combined with DEFINE_WORKSPACE_SIMPLEADAPTOR in the cpp) to define an adator based on a simple bool (*)(const F& src, T& dst) function

This macro is analogous to the DECLARE_WORKSPACE_DATA_FACTORY macro. See its detailed description for why we also need a similar macro for numeric type adaptor factories.

◆ DECLARE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR

#define DECLARE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR (   F,
  T,
  WORKSPACE_EXPORT_SYMBOL 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
WORKSPACE_EXPORT_SYMBOL const SimpleAdaptorFactory<F, T>& SimpleAdaptorFactory<F, T>::getInstance(); \
template<> \
WORKSPACE_EXPORT_SYMBOL \
TypeAdaptor* \
SimpleAdaptorFactory<F, T>::create() const; \
template<> \
WORKSPACE_EXPORT_SYMBOL void SimpleAdaptorFactory<F, T>::destroy(TypeAdaptor* a) const; \
template<> \
WORKSPACE_EXPORT_SYMBOL const Application::WorkspacePlugin& SimpleAdaptorFactory<F, T>::getPlugin() const; \
} \
}

Use this macro in a header (combined with DEFINE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR in the cpp) to define an adator based on a simple bool (*)(const DataObject& src, DataObject& dst, bool copy) function

This macro is analogous to the DECLARE_WORKSPACE_DATA_FACTORY macro. See its detailed description for why we also need a similar macro for numeric type adaptor factories.

◆ DEFINE_WORKSPACE_SIMPLEADAPTOR

#define DEFINE_WORKSPACE_SIMPLEADAPTOR (   F,
  T,
  P,
  Func 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
CSIRO_EXPORTSPEC \
TypeAdaptor* \
SimpleAdaptorFactory<F, T>::create() const \
{ \
return new SimpleAdaptor<F, T>(static_cast<bool (*)(const F&, T&)>(Func)); \
} \
template<> \
CSIRO_EXPORTSPEC void SimpleAdaptorFactory<F, T>::destroy(TypeAdaptor* adaptor) const \
{ \
delete adaptor; \
} \
template<> \
CSIRO_EXPORTSPEC const SimpleAdaptorFactory<F, T>& SimpleAdaptorFactory<F, T>::getInstance() \
{ \
static SimpleAdaptorFactory<F, T> instance; \
return instance; \
} \
template<> \
CSIRO_EXPORTSPEC const Application::WorkspacePlugin& SimpleAdaptorFactory<F, T>::getPlugin() const \
{ \
return P; \
} \
template class SimpleAdaptor<F, T>; \
} \
}
#define CSIRO_EXPORTSPEC
Definition: api_workspace.h:80
Parameters
FThe type to convert from.
TThe type to convert to.
PA reference to the plugin that provides the adaptor.
FuncThe adaptor function taking the two types

Use this macro in a cpp (combined with DECLARE_WORKSPACE_SIMPLEADAPTOR in the header) to define an adator based on a simple bool (*)(const F& src, T& dst, bool copy) function

A macro for explicitly instantiating an SimpleAdaptor and its factory. The use of this macro is the preferred method of instantiating such an adaptor and its factory for a particular from/to type pair. It should only ever be used in an implementation file and never in a header file. It would normally be used in the file that implements one of the two types, typically at the end of that file.

◆ DEFINE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR

#define DEFINE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR (   F,
  T,
  P,
  Func 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
CSIRO_EXPORTSPEC \
TypeAdaptor* \
SimpleAdaptorFactory<F, T>::create() const \
{ \
return new SimpleDataObjectAdaptor<F, T>(static_cast<bool (*)(DataObject&, DataObject&, bool)>(Func)); \
} \
template<> \
CSIRO_EXPORTSPEC void SimpleAdaptorFactory<F, T>::destroy(TypeAdaptor* adaptor) const \
{ \
delete adaptor; \
} \
template<> \
CSIRO_EXPORTSPEC const SimpleAdaptorFactory<F, T>& SimpleAdaptorFactory<F, T>::getInstance() \
{ \
static SimpleAdaptorFactory<F, T> instance; \
return instance; \
} \
template<> \
CSIRO_EXPORTSPEC const Application::WorkspacePlugin& SimpleAdaptorFactory<F, T>::getPlugin() const \
{ \
return P; \
} \
template class SimpleAdaptor<F, T>; \
} \
}
Parameters
FThe type to convert from.
TThe type to convert to.
PA reference to the plugin that provides the adaptor.
FuncThe adaptor function taking two DataObjects

Use this macro in a cpp (combined with DECLARE_WORKSPACE_SIMPLEDATAOBJECTADAPTOR in the header) to define an adator based on a simple bool (*)(DataObject& src, DataObject& dst, bool copy) function

A macro for explicitly instantiating an SimpleAdaptor and its factory. The use of this macro is the preferred method of instantiating such an adaptor and its factory for a particular from/to type pair. It should only ever be used in an implementation file and never in a header file. It would normally be used in the file that implements one of the two types, typically at the end of that file.