Skip to content

Commit 0465155

Browse files
Merge branch 'main' of github01.hclpnp.com:Modeling/rtistic-pub-doc
2 parents 5eb030d + 10be5e3 commit 0465155

File tree

28 files changed

+314
-0
lines changed

28 files changed

+314
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
**/.vscode/art_diagram_settings.json
33
**/.vscode/settings.json
44
**/.vscode/launch.json
5+
**/.vscode/c_cpp_properties.json
6+
**/compile_commands.json
57
**/logs/
68
**/log*.txt
79
**/node_modules/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
capsule Pinger {
2+
[[rt::decl]]
3+
`
4+
private: int count = 0;
5+
`
6+
service behavior port pingPort : Proto;
7+
statemachine {
8+
state State1 {
9+
stop: on pingPort.pong when `count >= N_ITERATIONS`
10+
`
11+
std::cout << "Completed " << N_ITERATIONS << " iterations\n";
12+
context()->abort();
13+
`;
14+
pong: on pingPort.pong
15+
`
16+
std::cout << getName() << " sends ping\n";
17+
pingPort.ping(++count).send();
18+
`;
19+
};
20+
initial -> State1
21+
`
22+
std::cout << getName() << " sends ping\n";
23+
pingPort.ping(++count).send();
24+
`;
25+
};
26+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
capsule Ponger {
2+
service behavior port pongPort~ : Proto;
3+
statemachine {
4+
state State1 {
5+
ping: on pongPort.ping
6+
`
7+
int i = *((int*) rtdata);
8+
std::cout << getName() << " sends pong (count=" << i << ")" << std::endl;
9+
pongPort.pong().send();
10+
`;
11+
};
12+
initial -> State1;
13+
};
14+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
protocol Proto {
2+
in pong();
3+
out ping(`int`);
4+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
capsule Top {
3+
part ping : Pinger, pong : Ponger;
4+
connect ping.pingPort with pong.pongPort;
5+
statemachine {
6+
state State1;
7+
initial -> State1;
8+
};
9+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef MyLimits_h
2+
#define MyLimits_h
3+
4+
enum {
5+
N_ITERATIONS = 7
6+
};
7+
8+
#endif
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ping sends ping
2+
pong sends pong (count=1)
3+
ping sends ping
4+
pong sends pong (count=2)
5+
ping sends ping
6+
pong sends pong (count=3)
7+
ping sends ping
8+
pong sends pong (count=4)
9+
ping sends ping
10+
pong sends pong (count=5)
11+
ping sends ping
12+
pong sends pong (count=6)
13+
ping sends ping
14+
pong sends pong (count=7)
15+
Completed 7 iterations
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
group: cpp_code_generation
3+
---
4+
Art files are organized into subfolders. Check that generated application still builds and works fine.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
let tc = TCF.define(TCF.ART_TO_CPP);
2+
tc.topCapsule = "Top";
3+
tc.cppCodeStandard = "C++ 17";
4+
tc.targetFolder = 'hierarchy_folders_target';
5+
tc.commonPreface = `
6+
#include <iostream>
7+
#include "MyLimits.h"
8+
`;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
capsule Pinger {
2+
[[rt::decl]]
3+
`
4+
private: int count = 0;
5+
`
6+
service behavior port pingPort : Proto;
7+
statemachine {
8+
state State1 {
9+
stop: on pingPort.pong when `count >= N_ITERATIONS`
10+
`
11+
std::cout << "Completed " << N_ITERATIONS << " iterations\n";
12+
context()->abort();
13+
`;
14+
pong: on pingPort.pong
15+
`
16+
std::cout << getName() << " sends ping\n";
17+
pingPort.ping(++count).send();
18+
`;
19+
};
20+
initial -> State1
21+
`
22+
std::cout << getName() << " sends ping\n";
23+
pingPort.ping(++count).send();
24+
`;
25+
};
26+
};

0 commit comments

Comments
 (0)