Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 2eea9b7d1079593deb921564b19cd14f1ff6809b (plain) (tree)
1
2
3
4
5
6
7
8
9
                   

                                                      
                               

                                           
                                                          

         


















                                                           












                                                                      
                                                                  
























                                                                          
                                                                  

                                                
                                                                     












                                                                                                   
                                                                                       



                                                                                       
                                                                                       





                                                                        






                                                  







                                                                      
                  
                          
                                         
                                                                                            

                  





                                                          

                           
                                         


                        











                                                                           
                                                                       



                                                   
                                                                     






                                          

                                             
                                          


                          
                                              























                                                                      
                                                            
         

 
RoomModel cGenRef {
	import room.basic.types.c.* from "CTypes.room"
	
	SubSystemClass SubSys {
		ActorRef Sender: Sender
		ActorRef Receiver: Receiver
		Binding Sender.dataOut and Receiver.dataIn
	}

//	SubSystemClass SubSysSomewhatBigger {
//		ActorRef Receiver: Receiver
//		ActorRef Sender: Sender
//		ActorRef Broadcast: Broadcast
//		ActorRef Receiver2: Receiver
//		ActorRef ref0: Broadcast
//		ActorRef ref1: Broadcast
//		ActorRef ref2: Receiver
//		ActorRef ref3: Receiver
//		Binding Sender.dataOut and Broadcast.dataIn
//		Binding Broadcast.dataOut and ref0.dataIn
//		Binding Broadcast.dataOut and ref1.dataIn
//		Binding Receiver.dataIn and ref0.dataOut
//		Binding Receiver2.dataIn and ref0.dataOut
//		Binding ref2.dataIn and ref1.dataOut
//		Binding ref3.dataIn and ref1.dataOut
//	}


	ActorClass Receiver {
		Interface {
			Port dataIn: CommunicationProtocol
		}
		Structure {
			external Port dataIn
			Attribute attr1: DataClass1
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> DataReceived {
					triggers {
						<sendData: dataIn>
					}
					action {
						"dataIn.receivedData();"
					}
				}
				State Idle
				State DataReceived
			}
		}
	}

	ActorClass Broadcast {
		Interface {
			Port dataIn: CommunicationProtocol
			conjugated Port dataOut [2]: CommunicationProtocol
		}
		Structure {
			external Port dataIn
			external Port dataOut
		}
		Behavior {
			StateMachine {
				Transition init: initial -> Idle { }
				Transition tr0: Idle -> tp0 of Sending {
					triggers {
						<sendData: dataIn>
					}
					action {
						"dataOut.sendData();"
					}
				}
				Transition tr1: tp1 of Sending -> ReceivedBoth {
					action {
						"dataIn.receivedData();"
					}
				}
				State Idle
				State Sending {
					subgraph {
						Transition tr0: my tp0 -> WaitingForReceived
						Transition tr1: WaitingForReceived -> ReceivedOne {
							triggers {
								<receivedData: dataOut>
							}
						}
						Transition tr3: ReceivedOne -> my tp1 {
							triggers {
								<receivedData: dataOut>
							}
						}
						EntryPoint tp0
						ExitPoint tp1
						State WaitingForReceived
						State ReceivedOne
					}
				}
				State ReceivedBoth
			}
		}
	}

	ActorClass SenderManual {
		Interface {
			conjugated Port dataOut: CommunicationProtocol
		}
		Structure {
			external Port dataOut
			Attribute attribute1: int32
			Attribute attribute2: DataClass1
		}
		Behavior {
			//@BehaviorManual
			Operation operation1(argument1:int32, argument2: DataClass1 ref){""}
		}
	}
	ActorClass ReceiverManual {
		Interface {
			Port dataIn: CommunicationProtocol
		}
		Structure {
			external Port dataIn
		}
		Behavior {
			//@BehaviorManual
		}
	}
	
	

	ActorClass Sender {
		Interface {
			conjugated Port dataOut: CommunicationProtocol
		}
		Structure {
			external Port dataOut
		}
		Behavior {
			StateMachine {
				Transition init: initial -> SendingData { }
				Transition tr0: SendingData -> Done {
					triggers {
						<receivedData: dataOut>
					}
				}
				State SendingData {
					entry {
						"dataOut.sendData();"
					}
				}
				State Done
			}
		}
	}

	ProtocolClass CommunicationProtocol {
		incoming {
			Message sendData()
			
		}
		outgoing {
			Message receivedData()
		}
	}
	

	DataClass DataClass1 {
		usercode1 {"// usercode1"}
		usercode2 {"// usercode2"}
		usercode3 {"// usercode3"}
		Attribute Attr1: int32
		Attribute ComplexAttr: DataClass2 
		Attribute Attr3: float32
		
		Operation MultiplyWithAttr1(value: int32): int32 {
			"return self->Attr1*value;"
		}
		Operation MultiplyWithAttr3(value: float32): float32 {
			"return self->Attr3*value;"
		}
	}

	DataClass DataClass2 {
		Attribute Attr1: int32
		Attribute Attr2: float32
		Attribute Attr3: int32
		Operation Operation1() {"/*nothing to do*/"}
	}

}

Back to the top