Browse Source

added some documentation parts for interface information
deleted auto generated files from svn repository

jos.itemis@gmail.com 14 years ago
parent
commit
95e295d308

+ 68 - 0
plugins/org.yakindu.sct.doc.user/help/04_C-Code_Generator/04_statechart_interfaces.textile

@@ -0,0 +1,68 @@
+h1. Statechart Interfaces  
+
+A statechart is divided into the following building blocks:
+
+* EventHandler
+* Statechart
+* DataRepository
+* TimerHandler
+
+The main class is Statechart. It is derived from EventHandler and contains a DataRepository and a TimerHandler.
+
+h2. EventHandler
+
+The EventHandler contains only one interface method:
+
+* raiseEvent(<Event>)
+
+This virtual method is called from the outside to inform the state machine to handle an event. The action applied to this notification is up to the implementer. E.g. queuing/storing of the event or direct even handling.  
+
+h2. Statechart
+
+The Statechart contains the following interface methods:
+
+h3. init()
+
+initializes the state machine (e.g. setzt the initial state or states, initializes the timers etc). Init can be called whenever the state machine should be reseted to the start.
+
+h3. runCycle()
+
+runCycle dispatches one "Run-To-Completion" step of a state machine. This means, it will either take exactly one transition if the transition condition is met or will do nothing. The transition condition is met if one or more of the specified events are set _and_ the guard condition is true.
+When a transition is taken, the state machine executes all exit actions of the states, which are left. The exit chain is started with the most inner state to the state that both substates owns. Then the transition action is executed and all entry actions are taken up to state, the transition ends at.
+
+h3. get/setDataRepository()
+
+Setter and Getter to set the Data Repository. The Data Repository may be derived from the generated one an must therefore have a setter as well.
+
+h3. get/setTimerHandler()
+
+Setter and Getter for the TimerHandler.
+
+The TimerHandler class is only an abstract or interface class, which must have an implementation and must therfore be set and getable. 
+
+The code generator creates a DummyTimerHandler, that is initially instantiated to have no empty TimerHandler. It is placed into the statechart during the constructor call. This is necessary e.g. for the implementation of statecharts, which are not time dependent. 
+
+h3. add/remove/getEventHandler()   
+
+To handle external events, that are created by the statemachine and which must be handled by a codeblock outside the statemachine, the EventHandler should be used. The statemachine itself is an eventHandler as well, therefore two statemachines can be connected by this method and can exchange events. 
+
+The statemachine calls the method raiseEvent() for every registered EventHandler whenever an external event occurs.
+
+h2. DataRepository
+
+All variables, that are defined and used within the state chart diagram are placed into the DataRepository. This repository offers getter and setter methods to access the variables. 
+
+The Getters and Setters are called in accordance to the variable names. As variables with upper and lower cases are not prohibited and reference different resources, the getter and setter methods are created by the prefix "get_" and the variable name with all original upper and lower cases and no camel case.
+
+For the preparation for multithreading, the DataRepository defines the virtual functions lock() and unlock() which are called implicitly by the getter and setter methods. In case the state machine is running in it's own thread, the lock and unlock method can be filled within a derived class by a sufficient locking and unlocking mechanism respectively (e.g. via a mutex or semaphore). 
+
+h2. TimerHandler
+
+The code generator creates an abstract / interface class for the usage of timers. Additionally it creates a DummyTimerHandler class, that is derived from this abstract class. 
+
+The implementer has to provide two methods in an implementation derived from TimerHandler:
+
+* setTimer(eventId, time_ms, periodic)
+* resetTimer(eventId)
+
+The setTimer method has to create a operation system timer with the given wake up time. The    

+ 0 - 10
plugins/org.yakindu.sct.doc.user/help/04_C-Code_Generator/c_code_generator-toc.xml

@@ -1,10 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<toc topic="help/04_C-Code_Generator/c_code_generator.html" label="c_code_generator">
-	<topic href="help/04_C-Code_Generator/c_code_generator.html" label="Yakindu Statechart Generator">
-		<topic href="help/04_C-Code_Generator/c_code_generator.html#Introduction" label="Introduction"></topic>
-		<topic href="help/04_C-Code_Generator/c_code_generator.html#DescriptionoftheExecutionModelusedinYAKINDUstatechartenvironment" label="Description of the 'Execution Model' used in YAKINDU statechart environment">
-			<topic href="help/04_C-Code_Generator/c_code_generator.html#TimerhandlerInterface" label="Timerhandler Interface"></topic>
-		</topic>
-		<topic href="help/04_C-Code_Generator/c_code_generator.html#Multithreading" label="Multithreading"></topic>
-	</topic>
-</toc>

+ 0 - 51
plugins/org.yakindu.sct.doc.user/help/04_C-Code_Generator/c_code_generator.html

@@ -1,51 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-	<head>
-		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-		<title>c_code_generator</title>
-		<link type="text/css" rel="stylesheet" href="../content/PLUGINS_ROOT/PRODUCT_PLUGIN/book.css"/>
-		<link type="text/css" rel="stylesheet" href="../style.css"/>
-	</head>
-	<body>
-		<h1 id="YakinduStatechartGenerator">Yakindu Statechart Generator</h1>
-		<h2 id="Introduction">Introduction</h2>
-		<p>Within this documentation, we want to create a common view about the Yakindu Statechart Generator and a number of implementation variations.</p>
-		<h2 id="DescriptionoftheExecutionModelusedinYAKINDUstatechartenvironment">Description of the &#8218;Execution Model&#8217; used in YAKINDU statechart environment</h2>
-		<p>The following figure shows the eCore model for the execution model (date 18:10:11):</p>
-		<p>
-			<img border="0" src="../04_C-Code_Generator/images/execution_model.png"/> 
-		</p>
-		<h3 id="TimerhandlerInterface">Timerhandler Interface</h3>
-		<p>The mechanism to generate and execute time-dependent events is the task of the specific implementation and not the task of the generated code. In default the code generator assumes that a concrete implementation is available. </p>
-		<p>The Interface should contain following methods:</p>
-		<table>
-			<tr>
-				<td>*</td>
-				<td>
-					<strong>setTimer(event, time, periodic?)</strong>
-				</td>
-			</tr>
-			<tr>
-				<td></td>
-				<td>Defines an event which will be triggered after the specified <Time>. The third parameter should be set if the event has to be periodically triggered. The time should be specified in milliseconds.</td>
-			</tr>
-		</table>
-		<table>
-			<tr>
-				<td>*</td>
-				<td>
-					<strong>resetTimer(event)</strong>
-				</td>
-			</tr>
-			<tr>
-				<td></td>
-				<td>Resets the timer of the event so it is not triggered anymore.</td>
-			</tr>
-		</table>
-		<p>Example:
-			<br/>The C++ code generator generates an abstract base class &#8218;Timer&#8217; which contains the virtual methods &#8218;setTimer(EventID, Time in ms, periodic occurence?)&#8217; and &#8218;resetTimer(event)&#8217;.
-		</p>
-		<p>A concrete implementation has to fill these methods to create an event with the given ID at the end of the assigned time and commit it to the statechart via the event interface. If a State is leaved by another event before the timer event is triggered, the timer event has to be resetted with the 'resetTimer(event) method. The concrete implementation has to ensure that the started timer is stopped.</p>
-		<h2 id="Multithreading">Multithreading</h2>
-	</body>
-</html>

+ 0 - 35
plugins/org.yakindu.sct.doc.user/help/04_C-Code_Generator/c_code_generator.textile

@@ -1,35 +0,0 @@
-h1. Yakindu Statechart Generator
-
-h2. Introduction
-
-Within this documentation, we want to create a common view about the Yakindu Statechart Generator and a number of implementation variations.
-
-h2. Description of the 'Execution Model' used in YAKINDU statechart environment
-
-The following figure shows the eCore model for the execution model (date 18:10:11):
-
-!../04_C-Code_Generator/images/execution_model.png! 
-
-h3. Timerhandler Interface
-
-The mechanism to generate and execute time-dependent events is the task of the specific implementation and not the task of the generated code. In default the code generator assumes that a concrete implementation is available. 
-
-The Interface should contain following methods:
-
-
-|*|*setTimer(event, time, periodic?)*|
-| |Defines an event which will be triggered after the specified <Time>. The third parameter should be set if the event has to be periodically triggered. The time should be specified in milliseconds.|
-
-|*|*resetTimer(event)*|
-| |Resets the timer of the event so it is not triggered anymore.|
-
-Example:
-The C++ code generator generates an abstract base class 'Timer' which contains the virtual methods 'setTimer(EventID, Time in ms, periodic occurence?)' and 'resetTimer(event)'.
-
-A concrete implementation has to fill these methods to create an event with the given ID at the end of the assigned time and commit it to the statechart via the event interface. If a State is leaved by another event before the timer event is triggered, the timer event has to be resetted with the 'resetTimer(event) method. The concrete implementation has to ensure that the started timer is stopped.
-
-
-
-h2. Multithreading
-
-

+ 1 - 1
plugins/org.yakindu.sct.doc.user/help/04_C-Code_Generator/index.txt

@@ -1,6 +1,6 @@
 01_introduction.textile
 02_execution_model.textile
+04_statechart_interfaces.textile
 timerhandler_interface.textile
 03_statechart_runtime.textile
-04_statechart_interfaces.textile
 05_multithreading.textile