Workspace 6.21.5
Public Types | List of all members
SerializeDataType< T > Struct Template Reference

Traits class defining whether detection of serialization support for class T is permitted. More...

#include <Workspace/DataExecution/DataObjects/datafactorytraits.h>

Public Types

enum  { Allowed = 1 }
 

Detailed Description

template<typename T>
struct CSIRO::DataExecution::SerializeDataType< T >

If you want to enforce that T does not support serialization, then in the same header that defines T, specialize this class template as follows:

namespace CSIRO
{
namespace DataExecution
{
template<> struct SerializeDataType<MyClass>
{
enum { Allowed = 0 };
};
}}
Top level namespace for all Workspace code.
Definition: applicationsupportplugin.cpp:32
Traits class defining whether detection of serialization support for class T is permitted.
Definition: datafactorytraits.h:590

By doing this, all logic related to the detection of serialization support for T is disabled and T will be considered not serializable. This will result in the canSerialize(), load() and save() functions in TypedDataFactory being given appropriate function bodies without any further changes.

Normally, the default implementation is sufficient. It allows the code to work out what forms of serialization are available and use the best one, or to disable serialization support if no appropriate method is found. This all happens at compile time. There are some situations where the detection mechanisms can lead to compile errors, usually due to ambiguous overloads of the C++ streaming operators. In those cases, the developer may choose to supply their own overload for the streaming operators for their specific class T, or if they don't want serialization support, they can provide their own explicit specialization of SerializeDataType with Allowed set to the value 0 as shown above.

See also
CloneDataType, AssignDataType

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Allowed