Skip to content

Commit

Permalink
Expose after delays to runtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Sep 30, 2023
1 parent e2c7fd9 commit ff3ddb8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,12 @@ protected String makePreamble(
int numOfNetworkActions = federate.networkMessageActions.size();
code.pr(
"""
lf_action_base_t* _lf_action_table[%1$s];
size_t _lf_action_table_size = %1$s;
lf_action_base_t* _lf_zero_delay_action_table[%2$s];
size_t _lf_zero_delay_action_table_size = %2$s;
"""
interval_t _lf_action_delay_table[%1$s];
lf_action_base_t* _lf_action_table[%1$s];
size_t _lf_action_table_size = %1$s;
lf_action_base_t* _lf_zero_delay_action_table[%2$s];
size_t _lf_zero_delay_action_table_size = %2$s;
"""
.formatted(numOfNetworkActions, federate.zeroDelayNetworkMessageActions.size()));

int numOfNetworkReactions = federate.networkReceiverReactions.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public static String initializeTriggersForNetworkActions(
var reactor = main.lookupReactorInstance(federate.networkReceiverInstantiations.get(i));
var actionInstance = reactor.lookupActionInstance(action);
var trigger = CUtil.actionRef(actionInstance, null);
var delay = federate.networkMessageActionDelays.get(i);
code.pr(
"_lf_action_delay_table[" + actionTableCount + "] = " + getNetworkDelayLiteral(delay) + "; \\"
);
code.pr(
"_lf_action_table["
+ (actionTableCount++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ private static void addNetworkReceiverReactor(

// Keep track of this action in the destination federate.
connection.dstFederate.networkMessageActions.add(networkAction);
connection.dstFederate.networkMessageActionDelays.add(connection.getDefinition().getDelay());
if (connection.getDefinition().getDelay() == null)
connection.dstFederate.zeroDelayNetworkMessageActions.add(networkAction);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ public Instantiation getInstantiation() {
*/
public List<Action> networkMessageActions = new ArrayList<>();

public List<Expression> networkMessageActionDelays = new ArrayList<>();

/**
* List of networkMessage actions corresponding to zero-delay connections. This should be a subset
* of the networkMessageActions.
Expand Down

0 comments on commit ff3ddb8

Please sign in to comment.