-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2284 from lf-lang/cpp-generic-composition
Fixed code generation for nested generic reactor instances
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
target Cpp { | ||
timeout: 1 sec | ||
} | ||
|
||
reactor Counter<T> { | ||
state count: T(0) | ||
timer t(0, 1 sec) | ||
output out: T | ||
|
||
reaction(t) -> out {= | ||
out.set(count); | ||
count += 1; | ||
=} | ||
} | ||
|
||
reactor Printer<T> { | ||
input in: T | ||
|
||
reaction(in) {= | ||
auto msg = *in.get(); | ||
std::cout << msg << std::endl; | ||
=} | ||
} | ||
|
||
reactor MyWrapper<T> { | ||
c = new Counter<T>() | ||
p = new Printer<T>() | ||
c.out -> p.in | ||
} | ||
|
||
main reactor { | ||
m = new MyWrapper<int>() | ||
} |