Workspace 6.21.5
Classes | Namespaces | Macros
typeddatafactory.h File Reference
#include <cmath>
#include <iomanip>
#include <limits>
#include <mutex>
#include <sstream>
#include <QMetaType>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QtGlobal>
#include "Workspace/Application/LanguageUtils/classconstraints.h"
#include "Workspace/Application/LanguageUtils/errorchecks.h"
#include "Workspace/Application/LanguageUtils/streamable.h"
#include "Workspace/Application/LanguageUtils/typet.h"
#include "Workspace/Application/workspaceplugin.h"
#include "Workspace/DataExecution/Serialization/serialize.h"
#include "Workspace/DataExecution/Serialization/serializeditem.h"
#include "Workspace/api_workspace.h"
#include "datafactory.h"
#include "datafactorytraits.h"
#include "typeadaptor.h"
#include "typeadaptorfactory.h"
#include "typedobject.h"
Include dependency graph for typeddatafactory.h:
This graph shows which files directly or indirectly include this file:

Classes

class  AdaptFromQVariant< T >
 
class  AdaptFromQVariantFactory< T, Adapt >
 
class  AdaptFromQVariantFactory< QVariant, Adapt >
 
class  AdaptFromQVariantFactory< T, false >
 
class  AdaptToQVariant< T >
 
class  AdaptToQVariantFactory< T, Adapt >
 
class  AdaptToQVariantFactory< QVariant, Adapt >
 
class  AdaptToQVariantFactory< T, false >
 
class  AssignDefaultImpl< T, C >
 
class  AssignDefaultImpl< T, false >
 
class  CloneDefaultImpl< T, G, C >
 
class  CloneDefaultImpl< T, G, false >
 
class  CloneDefaultImpl< T, true, true >
 
class  CompareDefaultImpl< T, C >
 
class  CompareDefaultImpl< T, false >
 
class  QMetaTypesMustBeClonable< T, true >
 
class  SerializeDefaultImpl< T, Allowed, Srl, Strm, E >
 
class  SerializeDefaultImpl< T, true, false, false, true >
 
class  SerializeDefaultImpl< T, true, false, true, E >
 
class  SerializeDefaultImpl< T, true, true, Strm, E >
 
class  SortDefaultImpl< T, C >
 
class  SortDefaultImpl< T, false >
 
class  StreamableFallback< T, bypass, Allowed >
 
class  StreamableFallback< T, false, false >
 
class  StreamableFallback< T, true, Allowed >
 
class  TypedDataFactory< T >
 Template for instantiating data factories for a particular type. More...
 

Namespaces

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

Macros

#define CSIRO_TYPEDDATAFACTORY_STRINGIFY(x)   #x
 
#define CSIRO_TYPEDDATAFACTORY_TOSTRING(x)   CSIRO_TYPEDDATAFACTORY_STRINGIFY(x)
 
#define DEFINE_WORKSPACE_DATA_FACTORY(T, P)    DEFINE_WORKSPACE_SHARED_DATA_FACTORY(T, P, "")
 
#define DEFINE_WORKSPACE_DATA_FACTORY_NO_QMETATYPE(T, P)
 
#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY(T, P, S)    DEFINE_WORKSPACE_SHARED_DATA_FACTORY_WITH_PRIORITY(T, P, S, INT_MIN)
 
#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY_COMMON(T, P, S, ALIGNMENT, SIZE, PRIORITY)
 
#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY_WITH_PRIORITY(T, P, S, O)
 
#define SHARED_DATA_INFO_COMPILER   "other"
 
#define SHARED_DATA_INFO_DEBUG   true
 

Macro Definition Documentation

◆ CSIRO_TYPEDDATAFACTORY_STRINGIFY

#define CSIRO_TYPEDDATAFACTORY_STRINGIFY (   x)    #x

◆ CSIRO_TYPEDDATAFACTORY_TOSTRING

#define CSIRO_TYPEDDATAFACTORY_TOSTRING (   x)    CSIRO_TYPEDDATAFACTORY_STRINGIFY(x)

◆ DEFINE_WORKSPACE_DATA_FACTORY

#define DEFINE_WORKSPACE_DATA_FACTORY (   T,
 
)     DEFINE_WORKSPACE_SHARED_DATA_FACTORY(T, P, "")
Parameters
TThe type to define. It must be the fully qualified name of the type, ie you must not omit any namespace scoping (or class scoping for nested types defined within classes). This parameter is used as a string, so namespace using directives will not be considered.
PA reference to the WorkspacePlugin instance this type should belong to.

This macro defines explicit specializations of the functions in DataFactoryTraitsBase for the type T. They are all defined as forwarding functions to their corresponding equivalents in TypedDataFactory<T>. This technique ensures that the function implementations for DataFactoryTraits are only ever defined in the one place. Specifically, it ensures that T objects are always allocated and deleted in the same file when performed through the DataFactoryTraits class.

The macro also takes care of explicitly instantiating both TypedObject<T> and TypedDataFactory<T>.

◆ DEFINE_WORKSPACE_DATA_FACTORY_NO_QMETATYPE

#define DEFINE_WORKSPACE_DATA_FACTORY_NO_QMETATYPE (   T,
 
)
Value:
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
TypedDataFactory<T>::TypedDataFactory() \
{ \
} \
template class TypedObject<T>; \
extern template class TypedDataFactory<T>; \
template class TypedDataFactory<T>; \
} \
}
Top level namespace for all Workspace code.
Definition: applicationsupportplugin.cpp:32
#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY_COMMON(T, P, S, ALIGNMENT, SIZE, PRIORITY)
Definition: typeddatafactory.h:1259

This macro is similar to DEFINE_WORKSPACE_DATA_FACTORY except that no QMetaType support is added for the type T. This macro must be used if T refers to a type for which Qt already provides QMetaType support (ie built in C++ types and Qt classes). It must also be used if T does not support cloning, since the QMetaType system requires types to be clonable (more correctly, to be copyable).

See also
DEFINE_WORKSPACE_DATA_FACTORY, DECLARE_WORKSPACE_DATA_FACTORY_NO_QMETATYPE

◆ DEFINE_WORKSPACE_SHARED_DATA_FACTORY

#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY (   T,
  P,
 
)     DEFINE_WORKSPACE_SHARED_DATA_FACTORY_WITH_PRIORITY(T, P, S, INT_MIN)

◆ DEFINE_WORKSPACE_SHARED_DATA_FACTORY_COMMON

#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY_COMMON (   T,
  P,
  S,
  ALIGNMENT,
  SIZE,
  PRIORITY 
)

◆ DEFINE_WORKSPACE_SHARED_DATA_FACTORY_WITH_PRIORITY

#define DEFINE_WORKSPACE_SHARED_DATA_FACTORY_WITH_PRIORITY (   T,
  P,
  S,
 
)
Value:
DEFINE_WORKSPACE_SHARED_DATA_FACTORY_COMMON(T, P, S, Q_ALIGNOF(T), sizeof(T), O) \
namespace CSIRO \
{ \
namespace DataExecution \
{ \
template<> \
TypedDataFactory<T>::TypedDataFactory() \
{ \
TypedDataFactoryPrivate::QMetaTypesMustBeClonable<T>(); \
if (!QMetaType::type(#T)) \
qRegisterMetaType<T>(); \
} \
template class TypedObject<T>; \
extern template class TypedDataFactory<T>; \
template class TypedDataFactory<T>; \
} \
}
Parameters
TThe type to define. It must be the fully qualified name of the type, ie you must not omit any namespace scoping (or class scoping for nested types defined within classes). This parameter is used as a string, so namespace using directives will not be considered.
PA reference to the WorkspacePlugin instance this type should belong to.
SWhen a plugin add a data type defined by a third party library, it is possible the same type added by other plugins as well. Use this string to specify the third party library name and version so that Workspace could generate suitable adapter between these data types.
OPriority of the type being choosed as the main type. INT_MAX gets the highest priority.

This macro defines explicit specializations of the functions in DataFactoryTraitsBase for the type T. They are all defined as forwarding functions to their corresponding equivalents in TypedDataFactory<T>. This technique ensures that the function implementations for DataFactoryTraits are only ever defined in the one place. Specifically, it ensures that T objects are always allocated and deleted in the same file when performed through the DataFactoryTraits class.

The macro also takes care of explicitly instantiating both TypedObject<T> and TypedDataFactory<T>.

◆ SHARED_DATA_INFO_COMPILER

#define SHARED_DATA_INFO_COMPILER   "other"

◆ SHARED_DATA_INFO_DEBUG

#define SHARED_DATA_INFO_DEBUG   true