lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.federated.serialization.FedCustomPythonSerialization Class Reference

Enables support for custom serialization. More...

Inherits org.lflang.federated.serialization.FedSerialization.

Public Member Functions

 FedCustomPythonSerialization (String customSerializerPackage)
StringBuilder generateCompilerExtensionForSupport ()
StringBuilder generateNetworkDeserializerCode (String varName, String targetType)
 Generate code in target language that deserializes 'varName'.
StringBuilder generateNetworkSerializerCode (String varName, String originalType)
 Generate code in target language that serializes 'varName'.
StringBuilder generatePreambleForSupport ()
boolean isCompatible (GeneratorBase generator)
 Check whether the current generator is compatible with the given serialization technique or not.
String serializedBufferLength ()
String serializedBufferVar ()

Static Public Attributes

static final String deserializedVarName = "deserialized_message"
 Variable name in the target language for the deserialized data.
static final String serializedVarName = "serialized_message"
 Variable name in the target language for the serialized data.

Package Attributes

String customSerializerPackage

Detailed Description

Enables support for custom serialization.

Author
Shulu Li

Constructor & Destructor Documentation

◆ FedCustomPythonSerialization()

org.lflang.federated.serialization.FedCustomPythonSerialization.FedCustomPythonSerialization ( String customSerializerPackage)

Member Function Documentation

◆ generateCompilerExtensionForSupport()

StringBuilder org.lflang.federated.serialization.FedCustomPythonSerialization.generateCompilerExtensionForSupport ( )
Returns
Code that should be appended to the compiler instructions (e.g., flags to gcc or additional lines to a CMakeLists.txt) to enable support for the current serializer.

Implements org.lflang.federated.serialization.FedSerialization.

◆ generateNetworkDeserializerCode()

StringBuilder org.lflang.federated.serialization.FedCustomPythonSerialization.generateNetworkDeserializerCode ( String varName,
String targetType )

Generate code in target language that deserializes 'varName'.

This code will convert the data in 'varName' from an unsigned byte array into the 'targetType'. The deserialized data will be put in a variable with the name defined by

See also
deserializedVarName.
Parameters
varNameThe variable to deserialize.
targetTypeThe type to deserialize into.
Returns
Target code that deserializes 'varName' from an unsigned byte array to 'type'.

Implements org.lflang.federated.serialization.FedSerialization.

◆ generateNetworkSerializerCode()

StringBuilder org.lflang.federated.serialization.FedCustomPythonSerialization.generateNetworkSerializerCode ( String varName,
String originalType )

Generate code in target language that serializes 'varName'.

This code will convert the data in 'varName' from its 'originalType' into an unsigned byte array. The serialized data will be put in a variable with the name defined by

See also
serializedVarName.
Parameters
varNameThe variable to be serialized.
originalTypeThe original type of the variable.
Returns
Target code that serializes the 'varName' from 'type' to an unsigned byte array.

Implements org.lflang.federated.serialization.FedSerialization.

◆ generatePreambleForSupport()

StringBuilder org.lflang.federated.serialization.FedCustomPythonSerialization.generatePreambleForSupport ( )
Returns
Code in target language that includes all the necessary preamble to enable support for the current serializer.

Implements org.lflang.federated.serialization.FedSerialization.

◆ isCompatible()

boolean org.lflang.federated.serialization.FedCustomPythonSerialization.isCompatible ( GeneratorBase generator)

Check whether the current generator is compatible with the given serialization technique or not.

Parameters
generatorThe current generator.
Returns
true if compatible, false if not.

Implements org.lflang.federated.serialization.FedSerialization.

◆ serializedBufferLength()

String org.lflang.federated.serialization.FedCustomPythonSerialization.serializedBufferLength ( )
Returns
Expression in target language that corresponds to the length of the serialized buffer.

Implements org.lflang.federated.serialization.FedSerialization.

◆ serializedBufferVar()

String org.lflang.federated.serialization.FedCustomPythonSerialization.serializedBufferVar ( )
Returns
Expression in target language that is the buffer variable itself.

Implements org.lflang.federated.serialization.FedSerialization.

Member Data Documentation

◆ customSerializerPackage

String org.lflang.federated.serialization.FedCustomPythonSerialization.customSerializerPackage
package

◆ deserializedVarName

final String org.lflang.federated.serialization.FedSerialization.deserializedVarName = "deserialized_message"
staticinherited

Variable name in the target language for the deserialized data.

◆ serializedVarName

final String org.lflang.federated.serialization.FedSerialization.serializedVarName = "serialized_message"
staticinherited

Variable name in the target language for the serialized data.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/federated/serialization/FedCustomPythonSerialization.java