SinelaboreRT Header Logo

SinelaboreRT

As simple as possible, but not any simpler!

User Tools

Site Tools


wiki:news:16aug2013

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:news:16aug2013 [2013/08/16 15:36] pmuellerwiki:news:16aug2013 [2021/04/18 13:41] (current) – [Microwave Oven Example in C#] pmueller
Line 1: Line 1:
-====== C# backend now available again ======+====== Generating C# code ======
  
- 
-In an earlier version it was possible to generate C# code. This was not possible with the latest versions of the code generator, but is available now again with version 3.3. 
  
 To generate C# code call the code generator with the new command line flag ''-l csharp''. All states are created into one source file. The file name is determined by the ''-o'' command line switch. To generate C# code call the code generator with the new command line flag ''-l csharp''. All states are created into one source file. The file name is determined by the ''-o'' command line switch.
Line 13: Line 11:
  
 ===== Microwave Oven Example in C# ===== ===== Microwave Oven Example in C# =====
-The following microwave oven is taken from the examples folder of the code generator. It realizes a simple microwave oven and can be compiled with Microsoft Visual Studio((Copyright Microsoft Cooperation)) on Windows((Copyright Microsoft Cooperation)). The next figure shows the state diagram of the oven. It was created with the Cadifra UML editor.+microwave oven is taken from the examples folder of the code generator to demonstrate the generator featuresThe example realizes a simple microwave oven and can be compiled with Microsoft Visual Studio((Copyright Microsoft Cooperation)) on Windows((Copyright Microsoft Cooperation)). The next figure shows the state diagram of the oven. It was created with the Cadifra UML editor. 
  
 {{ :wiki:news:oven_csharp_cadifra.png?nolink |}} {{ :wiki:news:oven_csharp_cadifra.png?nolink |}}
Line 29: Line 27:
  
  
 +To generate code from the diagram call the generator as follows:
 +
 +<code bash>
 +java -Djava.ext.dirs=../bin/ -jar  "../bin/codegen.jar" -p CADIFRA -l csharp -o Oven oven.cdd
 +</code>
 The generated code looks as follows: The generated code looks as follows:
  
-<code>+<code c#>
 namespace OvenMachineNS namespace OvenMachineNS
 { {
Line 118: Line 121:
  
 </code> </code>
 +
 +
 +Finally start the generated exe file and play with the microwave oven. First increment the cooking time. Then start cooking by closing the door. 
 +
 +{{ :wiki:news:oven_windows_capture.png?nolink |}}
 +
 +The sinelabore code generator provides much more features than just code generations. Before generation an extensive check is performed to ensure your diagram is correct (e.g. each transition has an associated event, all state names are unique ...). You can add trace code if needed, simulate the state machine, generate test cases and more.
 +
 +If you want to try out the example yourself download the code generator demo. The oven can be found in the examples folder.
 +
 +
 +
 +~~DISCUSSION:closed|Leave your comments~~
 +
 +
 +
wiki/news/16aug2013.1376660204.txt.gz · Last modified: 2013/08/16 15:36 by pmueller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki