Skip to content

Commit

Permalink
API rename
Browse files Browse the repository at this point in the history
  • Loading branch information
lhstrh committed Oct 1, 2023
1 parent 764bde2 commit f3aeb44
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
1 change: 0 additions & 1 deletion core/src/main/java/org/lflang/ast/ASTUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,6 @@ public static ReactorInstance createMainReactorInstance(
} else {
targetConfig
.compileDefinitions
.get()
.put("LF_REACTION_GRAPH_BREADTH", String.valueOf(reactionInstanceGraph.getBreadth()));
}
return main;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public static String initializeTriggersForNetworkActions(
var trigger = CUtil.actionRef(actionInstance, null);
code.pr(
"_lf_action_table["
+ (actionTableCount++)
+ actionTableCount++
+ "] = (lf_action_base_t*)&"
+ trigger
+ "; \\");
if (federate.zeroDelayNetworkMessageActions.contains(action)) {
code.pr(
"_lf_zero_delay_action_table["
+ (zeroDelayActionTableCount++)
+ zeroDelayActionTableCount++
+ "] = (lf_action_base_t*)&"
+ trigger
+ "; \\");
Expand Down Expand Up @@ -114,7 +114,7 @@ public static String stpStructs(FederateInstance federate) {
"staa_lst["
+ i
+ "]->actions["
+ (tableCount++)
+ tableCount++
+ "] = _lf_action_table["
+ federate.networkMessageActions.indexOf(action)
+ "];");
Expand Down Expand Up @@ -173,16 +173,16 @@ public static void handleCompileDefinitions(
RtiConfig rtiConfig,
MessageReporter messageReporter) {
var definitions = federate.targetConfig.compileDefinitions;
definitions.add("FEDERATED", "");
definitions.add(
definitions.put("FEDERATED", "");
definitions.put(
String.format(
"FEDERATED_%s", federate.targetConfig.coordination.get().toString().toUpperCase()),
"");
if (federate.targetConfig.auth.get()) {
definitions.add("FEDERATED_AUTHENTICATED", "");
definitions.put("FEDERATED_AUTHENTICATED", "");
}
definitions.add("NUMBER_OF_FEDERATES", String.valueOf(numOfFederates));
definitions.add("EXECUTABLE_PREAMBLE", "");
definitions.put("NUMBER_OF_FEDERATES", String.valueOf(numOfFederates));
definitions.put("EXECUTABLE_PREAMBLE", "");

handleAdvanceMessageInterval(federate);

Expand All @@ -197,7 +197,6 @@ private static void handleAdvanceMessageInterval(FederateInstance federate) {
federate
.targetConfig
.compileDefinitions
.get()
.put("ADVANCE_MESSAGE_INTERVAL", String.valueOf(advanceMessageInterval.toNanoSeconds()));
}
}
Expand Down Expand Up @@ -253,27 +252,24 @@ public static void addClockSyncCompileDefinitions(FederateInstance federate) {
ClockSyncMode mode = federate.targetConfig.clockSync.get();
ClockSyncOptions options = federate.targetConfig.clockSyncOptions.get();

federate.targetConfig.compileDefinitions.get().put("_LF_CLOCK_SYNC_INITIAL", "");
federate.targetConfig.compileDefinitions.put("_LF_CLOCK_SYNC_INITIAL", "");
federate
.targetConfig
.compileDefinitions
.get()
.put("_LF_CLOCK_SYNC_PERIOD_NS", String.valueOf(options.period.toNanoSeconds()));
federate
.targetConfig
.compileDefinitions
.get()
.put("_LF_CLOCK_SYNC_EXCHANGES_PER_INTERVAL", String.valueOf(options.trials));
federate
.targetConfig
.compileDefinitions
.get()
.put("_LF_CLOCK_SYNC_ATTENUATION", String.valueOf(options.attenuation));

if (mode == ClockSyncMode.ON) {
federate.targetConfig.compileDefinitions.get().put("_LF_CLOCK_SYNC_ON", "");
federate.targetConfig.compileDefinitions.put("_LF_CLOCK_SYNC_ON", "");
if (options.collectStats) {
federate.targetConfig.compileDefinitions.get().put("_LF_CLOCK_SYNC_COLLECT_STATS", "");
federate.targetConfig.compileDefinitions.put("_LF_CLOCK_SYNC_COLLECT_STATS", "");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public CompileDefinitionsProperty() {
super(StringDictionaryType.COMPILE_DEFINITION);
}

public void add(String k, String v) {
public void put(String k, String v) {
this.isSet = true;
var value = this.get();
value.put(k, v);
Expand Down

0 comments on commit f3aeb44

Please sign in to comment.