Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fea1289b78bafb918b11d0a60b207700d764f38c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
RoomModel RoomModel1 {
	import room.basic.types.* from "../Types.room"
	LogicalSystem LogSys1 {
		SubSystemRef subSysRef1: SubSysClass1
	}

	SubSystemClass SubSysClass1 {
		ActorRef actorRef1: Toplevel
		LogicalThread defaultThread
	}

	ActorClass Toplevel {
		Structure {
			ActorRef sender: Sender
			ActorRef receiver: Receiver
			Binding sender.receiver and receiver.sender
		}
		Behavior { }
	}

	ActorClass Sender {
		Interface {
			conjugated Port receiver: PSendData
		}
		Structure {
			external Port receiver
			Attribute counter: int32
			
		}
		Behavior {
			StateMachine {
				Transition init: initial -> SendingData {
					action {
						"counter=0;"
					}
				}
				Transition tr0: SendingData -> cp cp0 {
					triggers {
						<receivedData: receiver>
					}
				}
				Transition tr1: cp cp0 -> Done
				Transition tr2: cp cp0 -> SendingData {
					cond {
						"++counter<10"
					}
				}
				ChoicePoint cp0
				State SendingData {
					entry {
						"receiver.sendData(1234);"
					}
				}
				State Done
			}
		}
	}

	ActorClass Receiver {
		Interface {
			Port sender: PSendData
		}
		Structure {
			external Port sender
		}
		Behavior {
			StateMachine {
				Transition init: initial -> WaitingForData { }
				Transition tr0: WaitingForData -> WaitingForData {
					triggers {
						<sendData: sender>
					}
					action {
						"sender.receivedData();"
					}
				}
				State WaitingForData
			}
		}
	}

	ProtocolClass PSendData {
		incoming {
			Message sendData(i: int32)
			
		}
		outgoing {
			Message receivedData()
		}
	}

}

Back to the top