Skip to content

Commit e792d50

Browse files
Merge branch 'main' of github01.hclpnp.com:Modeling/rtistic-pub-doc
2 parents 2b95182 + fbb84dd commit e792d50

9 files changed

Lines changed: 371 additions & 1 deletion

File tree

art-comp-test/art-comp-test.code-workspace

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,11 @@
6060
"path": "tests/choice_transition_exclude"
6161
},
6262
{
63-
"path": "tests/class_with_template"
63+
"path": "tests/class_trigger_guard"
6464
},
65+
{
66+
"path": "tests/class_with_template"
67+
},
6568
{
6669
"path": "tests/code_snippets"
6770
},
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
class MyClass {
2+
[[rt::impl_preface]]
3+
`
4+
#include "testlib.art.h"
5+
`
6+
[[rt::decl]]
7+
`
8+
public: int x = 0, y = 0;
9+
`
10+
/* Trigger Operations */
11+
trigger foo(`bool` b);
12+
/* State Machine */
13+
statemachine {
14+
state S1, S2, S3;
15+
initial -> S1;
16+
S1 -> S2 on foo(`bool`) [`x == 0 && b`] when `y == 0 && b`
17+
`
18+
x = 1;
19+
y = 1;
20+
ASSERT(b, "Value of b is not true");
21+
`;
22+
S1 -> S3 on foo(`bool`) [`x == 1`] when `y == 1`
23+
`
24+
x = 2;
25+
y = 2;
26+
`;
27+
};
28+
};
29+
30+
capsule Top {
31+
[[rt::header_preface]]
32+
`
33+
#include "testlib.art.h"
34+
#include <MyClass.h>
35+
`
36+
[[rt::decl]]
37+
`
38+
MyClass p;
39+
`
40+
/* State Machine */
41+
statemachine {
42+
state State1;
43+
initial -> State1
44+
`
45+
bool b = true;
46+
p.foo(b);
47+
ASSERT(p.x == 1, "Unexpected value of x");
48+
ASSERT(p.y == 1, "Unexpected value of y");
49+
PASS();
50+
`;
51+
};
52+
};
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+
In addition to a transition guard, each trigger of a transition can also have a guard. The transition function is only called if the transition guard and the guard of the matching trigger are both fulfilled in class statemachine.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let tc = TCF.define(TCF.CPP_TRANSFORM);
2+
tc.topCapsule = 'Top';
3+
tc.prerequisites = ["../../TestUtils/testlib.tcjs"];
4+
tc.targetFolder = 'class_trigger_guard_target';
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>class_trigger_guard</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.ibm.xtools.umldt.core.internal.builders.UMLDevelopmentBuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
</buildSpec>
15+
<natures>
16+
<nature>com.ibm.xtools.umldt.core.internal.natures.MDDProjectNature</nature>
17+
</natures>
18+
</projectDescription>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
active.config=Top.tcjs
2+
eclipse.preferences.version=1
3+
top.level.only=true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

art-comp-test/testsEmx/class_trigger_guard/Top.emx

Lines changed: 272 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let tc = TCF.define(TCF.CPP_TRANSFORM);
2+
tc.sources = [
3+
'platform:/resource/class_trigger_guard/Top.emx#_OMKeAX_IEe-ybOKRD6Tr-A',
4+
];
5+
tc.prerequisites = [
6+
'platform:/resource/TestRTSUtils/testRTSlib.tcjs',
7+
];
8+
tc.compilationMakeType = MakeType.GNU_make;
9+
tc.createTargetProject = true;
10+
tc.targetConfiguration = 'WinT.x64-MinGw-12.2.0';
11+
tc.targetProject = 'class_trigger_guard_target';
12+
tc.topCapsule = 'platform:/resource/class_trigger_guard/Top.emx#_OMLsIH_IEe-ybOKRD6Tr-A';

0 commit comments

Comments
 (0)