Workspace 6.21.5
Classes | Namespaces | Macros
derivedtobaseadaptor.h File Reference
#include "Workspace/Application/LanguageUtils/classconstraints.h"
#include "Workspace/Application/LanguageUtils/errorchecks.h"
#include "Workspace/api_workspace.h"
#include "datafactorytraits.h"
#include "dataobject.h"
#include "typeadaptor.h"
#include "typeadaptorfactory.h"
#include "typeddatafactory.h"
Include dependency graph for derivedtobaseadaptor.h:
This graph shows which files directly or indirectly include this file:

Classes

class  DerivedToBaseAdaptor< D, B >
 A TypeAdaptor class for converting a derived class to a base class. More...
 
class  DerivedToBaseAdaptorFactory< D, B >
 A TypeAdaptorFactory class for an adaptor converting a derived class to a base class. 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_DERIVEDTOBASEADAPTOR(D, B, WORKSPACE_EXPORT_SYMBOL)
 
#define DEFINE_WORKSPACE_DERIVEDTOBASEADAPTOR(D, B, P)
 

Macro Definition Documentation

◆ DECLARE_WORKSPACE_DERIVEDTOBASEADAPTOR

#define DECLARE_WORKSPACE_DERIVEDTOBASEADAPTOR (   D,
  B,
  WORKSPACE_EXPORT_SYMBOL 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
WORKSPACE_EXPORT_SYMBOL const DerivedToBaseAdaptorFactory<D, B>& DerivedToBaseAdaptorFactory<D, B>::getInstance(); \
template<> \
WORKSPACE_EXPORT_SYMBOL \
TypeAdaptor* \
DerivedToBaseAdaptorFactory<D, B>::create() const; \
template<> \
WORKSPACE_EXPORT_SYMBOL void DerivedToBaseAdaptorFactory<D, B>::destroy(TypeAdaptor* a) const; \
template<> \
WORKSPACE_EXPORT_SYMBOL const Application::WorkspacePlugin& DerivedToBaseAdaptorFactory<D, B>::getPlugin() const; \
} \
}
void destroy(TypeAdaptor *a) const override
static const DerivedToBaseAdaptorFactory & getInstance()
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 derived to base adaptor factories.

◆ DEFINE_WORKSPACE_DERIVEDTOBASEADAPTOR

#define DEFINE_WORKSPACE_DERIVEDTOBASEADAPTOR (   D,
  B,
 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
CSIRO_EXPORTSPEC \
TypeAdaptor* \
DerivedToBaseAdaptorFactory<D, B>::create() const \
{ \
return new DerivedToBaseAdaptor<D, B>; \
} \
template<> \
{ \
delete adaptor; \
} \
template<> \
CSIRO_EXPORTSPEC const DerivedToBaseAdaptorFactory<D, B>& DerivedToBaseAdaptorFactory<D, B>::getInstance() \
{ \
static DerivedToBaseAdaptorFactory<D, B> instance; \
return instance; \
} \
template<> \
CSIRO_EXPORTSPEC const Application::WorkspacePlugin& DerivedToBaseAdaptorFactory<D, B>::getPlugin() const \
{ \
return P; \
} \
template class DerivedToBaseAdaptor<D, B>; \
} \
}
#define CSIRO_EXPORTSPEC
Definition: api_workspace.h:80
Parameters
DThe type of the derived class.
BThe type of the base class.
PA reference to the plugin that provides the adaptor.

A macro for explicitly instantiating a DerivedToBaseAdaptor and its factory. The use of this macro is the preferred method of instantiating such an adaptor and its factory for a particular type. 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 the type D, typically at the end of that file.