Skip to main content

oSP3D Script API 2024 R1

SerializableTraits< T > Struct Template Reference

Last update: 16.07.2025

This header provides a unified way to handle the Json serialization of parameters of different types. Each parameter is stored in an expressive way defining the Type, Range, Value and Multiplicity (Signlton/List) of the serialize object. This is achieved by having a traits class being defined for the parameters Type. Some standard definitions for ints, uints, numbers, strings are available but for serializing custom enums you would typically define this yourself. When de-/serializing a parameter of this type you the would only call the load/save functions depending on single/container parameters. More...

Public Types

using CreateRange = CreateRangeNone
 The Range Type to work with.
 
using SerializedType = string
 The type to serialize into.
 
using Type = T
 The type to serialize.
 

Static Public Member Functions

static SerializedType access (JsonValue v)
 How to access the serializes type in the JsonObject.
 
static Type convertFrom (SerializedType s)
 How to turn the SerializedType into the Type.
 
static SerializedType convertTo (Type t)
 How to turn the Type into the SerializedType.
 
static constexpr char * name ()
 The name of the type in the serialization.
 

Detailed Description

template<typename T>
struct SerializableTraits< T >

This header provides a unified way to handle the Json serialization of parameters of different types. Each parameter is stored in an expressive way defining the Type, Range, Value and Multiplicity (Signlton/List) of the serialize object. This is achieved by having a traits class being defined for the parameters Type. Some standard definitions for ints, uints, numbers, strings are available but for serializing custom enums you would typically define this yourself. When de-/serializing a parameter of this type you the would only call the load/save functions depending on single/container parameters.

Traits class to give all necessary information on the type You want to serialize. See the json_parameter.ipp file for standard definitions

Template Parameters
TThe type to serialize

Connect with Ansys