diff options
author | Christian Hilden | 2019-07-01 08:18:20 +0000 |
---|---|---|
committer | Christian Hilden | 2019-07-01 08:18:20 +0000 |
commit | 9bd8a8bd2e2662045909ad774ee2d857a47e24a5 (patch) | |
tree | 733f0cf142b77b38c8b3b63c5b068247b438e2e7 /runtime/org.eclipse.etrice.modellib.c | |
parent | a877df88488833e5f057ad56fafaef78171c0c5a (diff) | |
download | org.eclipse.etrice-9bd8a8bd2e2662045909ad774ee2d857a47e24a5.tar.gz org.eclipse.etrice-9bd8a8bd2e2662045909ad774ee2d857a47e24a5.tar.xz org.eclipse.etrice-9bd8a8bd2e2662045909ad774ee2d857a47e24a5.zip |
Bug 548621 - integrated first version of interface contracts
Change-Id: I38a0c09cc59a2df278b7f31426065a53e502b887
Diffstat (limited to 'runtime/org.eclipse.etrice.modellib.c')
-rw-r--r-- | runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/definitions.room | 19 | ||||
-rw-r--r-- | runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/monitors.room | 54 |
2 files changed, 73 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/definitions.room b/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/definitions.room new file mode 100644 index 000000000..b9957746f --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/definitions.room @@ -0,0 +1,19 @@ +RoomModel etrice.api.contracts.definitions { + + AnnotationType InterfaceContract { + target = ProtocolClass + mandatory attribute definingActorClassName: ptCharacter + } + + AnnotationType ValueRangeContract { + target = { + Transition, Message + } + mandatory attribute range: ptCharacter + } + + AnnotationType TimingContract { + target = State + mandatory attribute durationInMS: ptInteger + } +}
\ No newline at end of file diff --git a/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/monitors.room b/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/monitors.room new file mode 100644 index 000000000..a37821977 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/model/etrice/api/contracts/monitors.room @@ -0,0 +1,54 @@ +/** work in progress */ +RoomModel etrice.api.contracts.monitors { + + import room.basic.types.* + + ProtocolClass MonitorControl { + incoming { + Message requestAndResetStatus() + Message setForwardInvalidMessages(boolean) + } + outgoing { + Message violationStatus(boolean) + Message violationOccured() + } + } + + // not working due Bug 541775 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=541775 + abstract ActorClass ContractMonitorBase { + Interface { + Port monitor_ctrl: MonitorControl + } + Structure { + external Port monitor_ctrl + Attribute _violation: boolean + Attribute _forwardInvalidMessages: boolean + } + Behavior { + Operation _onViolation(comment: string) ''' + _violation = value; + ET_MSC_LOGGER_VISIBLE_COMMENT(comment); + monitor_ctrl.onViolation(); + ''' + StateMachine { + handler TransitionPoint _trBase + Transition _trStatus: my _trBase -> my _trBase { + triggers { + <requestAndResetStatus: monitor_ctrl> + } + action ''' + monitor_ctrl.violationStatus(_violation); + _violation = false; + ''' + } + Transition _trForward: my _trBase -> my _trBase { + triggers { + <setForwardInvalidMessages: monitor_ctrl> + } + action '''_forwardInvalidMessages = transitionData;''' + } + } + } + } +}
\ No newline at end of file |