Workspace 7.0.2
Classes | Namespaces | Macros
assignmentadaptor.h File Reference
#include <limits>
#include <QtGlobal>
#include "Workspace/Application/LanguageUtils/errorchecks.h"
#include "Workspace/api_workspace.h"
#include "datafactorytraits.h"
#include "dataobject.h"
#include "dependency.h"
#include "typeadaptor.h"
#include "typeadaptorfactory.h"
Include dependency graph for assignmentadaptor.h:
This graph shows which files directly or indirectly include this file:

Classes

class  AssignmentAdaptor< From, To >
 A TypeAdaptor class for converting between two types using assignment operator. More...
 
class  AssignmentAdaptorFactory< From, To >
 A TypeAdaptorFactory for an adaptor converting between two types using assignment operator. More...
 
struct  AssignmentAdaptorImpl< From, To >
 Default assignment implementation used by AssignmentAdaptor. More...
 
struct  AssignmentAdaptorImpl< double, int >
 Specialization for assigning a double to an integer. 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_ASSIGNMENTADAPTOR(F, T, WORKSPACE_EXPORT_SYMBOL)
 
#define DEFINE_WORKSPACE_ASSIGNMENTADAPTOR(F, T, P)
 

Macro Definition Documentation

◆ DECLARE_WORKSPACE_ASSIGNMENTADAPTOR

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

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_ASSIGNMENTADAPTOR

#define DEFINE_WORKSPACE_ASSIGNMENTADAPTOR (   F,
  T,
 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
CSIRO_EXPORTSPEC \
TypeAdaptor* \
AssignmentAdaptorFactory<F, T>::create() const \
{ \
return new AssignmentAdaptor<F, T>; \
} \
template<> \
CSIRO_EXPORTSPEC void AssignmentAdaptorFactory<F, T>::destroy(TypeAdaptor* adaptor) const \
{ \
delete adaptor; \
} \
template<> \
CSIRO_EXPORTSPEC const AssignmentAdaptorFactory<F, T>& AssignmentAdaptorFactory<F, T>::getInstance() \
{ \
static AssignmentAdaptorFactory<F, T> instance; \
return instance; \
} \
template<> \
CSIRO_EXPORTSPEC const Application::WorkspacePlugin& AssignmentAdaptorFactory<F, T>::getPlugin() const \
{ \
return P; \
} \
template class AssignmentAdaptor<F, T>; \
} \
}
#define CSIRO_EXPORTSPEC
Definition: api_workspace.h:80
Parameters
FThe numeric type to convert from.
TThe numeric type to convert to. Compilation will fail if it has no assignment operator which accepts F objects.
PA reference to the plugin that provides the adaptor.

A macro for explicitly instantiating an AssignmentAdaptor 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.