Skip to content

Commit

Permalink
Merge pull request #1755 from lf-lang/fix-ros-serialization
Browse files Browse the repository at this point in the history
Fix ROS serialization
  • Loading branch information
petervdonovan authored May 20, 2023
2 parents 03310fa + 34c8bcb commit 6c415be
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedHashMap;
import java.util.List;

import org.lflang.ASTUtils;
Expand All @@ -49,7 +48,6 @@
import org.lflang.federated.launcher.RtiConfig;
import org.lflang.federated.serialization.FedROS2CPPSerialization;
import org.lflang.generator.CodeBuilder;
import org.lflang.generator.GeneratorUtils;
import org.lflang.generator.LFGeneratorContext;
import org.lflang.generator.ReactionInstance;
import org.lflang.generator.ReactorInstance;
Expand Down Expand Up @@ -505,6 +503,7 @@ public String generatePreamble(
includes.pr("#ifdef __cplusplus\n"
+ "}\n"
+ "#endif");
includes.pr(generateSerializationIncludes(federate, fileConfig));
}

return includes.toString();
Expand Down Expand Up @@ -537,8 +536,6 @@ protected String makePreamble(
size_t _lf_action_table_size = %1$s;
""".formatted(numOfNetworkActions));

code.pr(generateSerializationPreamble(federate, fileConfig));

code.pr(generateExecutablePreamble(federate, rtiConfig, errorReporter));

code.pr(generateInitializeTriggers(federate, errorReporter));
Expand All @@ -551,8 +548,8 @@ protected String makePreamble(
/**
* Generate preamble code needed for enabled serializers of the federate.
*/
protected String generateSerializationPreamble(FederateInstance federate, FedFileConfig fileConfig) {
return CExtensionUtils.generateSerializationPreamble(federate, fileConfig);
protected String generateSerializationIncludes(FederateInstance federate, FedFileConfig fileConfig) {
return CExtensionUtils.generateSerializationIncludes(federate, fileConfig);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.lflang.federated.serialization.FedROS2CPPSerialization;
import org.lflang.federated.serialization.SupportedSerializers;
import org.lflang.generator.CodeBuilder;
import org.lflang.generator.GeneratorBase;
import org.lflang.generator.ReactorInstance;
import org.lflang.generator.c.CTypes;
import org.lflang.generator.c.CUtil;
Expand Down Expand Up @@ -547,7 +546,7 @@ public static String surroundWithIfFederatedDecentralized(String code) {
/**
* Generate preamble code needed for enabled serializers of the federate.
*/
public static String generateSerializationPreamble(
public static String generateSerializationIncludes(
FederateInstance federate,
FedFileConfig fileConfig
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class PythonExtension extends CExtension {
protected void generateCMakeInclude(FederateInstance federate, FedFileConfig fileConfig) throws IOException {}

@Override
protected String generateSerializationPreamble(FederateInstance federate, FedFileConfig fileConfig) {
protected String generateSerializationIncludes(FederateInstance federate, FedFileConfig fileConfig) {
CodeBuilder code = new CodeBuilder();
for (SupportedSerializers serialization : federate.enabledSerializers) {
switch (serialization) {
Expand Down

0 comments on commit 6c415be

Please sign in to comment.