User Tools

Site Tools


v050:userguide

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
v050:userguide [2016/07/17 19:55]
nagy.andras95 [Compilation to C++]
v050:userguide [2016/08/16 00:18] (current)
deva [Sample models]
Line 16: Line 16:
   * Download and unzip the {{v050:​demo.zip|sample models}}.   * Download and unzip the {{v050:​demo.zip|sample models}}.
   * Import them into your Eclipse workspace (''​File''​ / ''​Import''​ / ''​General''​ / ''​Existing projects into workspace''​).   * Import them into your Eclipse workspace (''​File''​ / ''​Import''​ / ''​General''​ / ''​Existing projects into workspace''​).
 +  * Clean and build the projects (''​Project''​ / ''​Clean...''​).
  
-Sample models are implemented using either XtxtUML syntax (see the source packages ''<​name of example>​.x.model''​) or JtxtUML syntax (see the source packages ''<​name of example>​.j.model''​),​ or both. In addition, the sample models are accompanied with diagram descriptions (see the Java classes inheriting from the ''​ClassDiagram''​''​StateMachineDiagram''​ or ''​CompositeDiagram''​ type).+Sample models are implemented using either XtxtUML syntax (see the source packages ''<​name of example>​.x.model''​) or JtxtUML syntax (see the source packages ''<​name of example>​.j.model''​),​ or both. In addition, the sample models are accompanied with diagram descriptions (see the Java classes inheriting from the ''​ClassDiagram'' ​or ''​StateMachineDiagram''​ type).
  
 We suggest reading the [[v050:​userguide#​Generating diagrams]] and the [[v050:​userguide#​Running and debugging models|Running and debugging models]] sections as the next steps of experimenting with the sample models. We suggest reading the [[v050:​userguide#​Generating diagrams]] and the [[v050:​userguide#​Running and debugging models|Running and debugging models]] sections as the next steps of experimenting with the sample models.
Line 26: Line 27:
  
 txtUML models should be placed in txtUML projects. A new txtUML project can be created by selecting ''​File''​ / ''​New project...''​ / ''​txtUML''​ / ''​txtUML Project''​ and setting the project name. txtUML models should be placed in txtUML projects. A new txtUML project can be created by selecting ''​File''​ / ''​New project...''​ / ''​txtUML''​ / ''​txtUML Project''​ and setting the project name.
-{{v030:​newproject.png}}+{{v050:​newproject.png}}
  
 By default, the project will be created in the current workspace. In order to override this, uncheck the ''​Use default location''​ checkbox and select a location for the new project. By default, the project will be created in the current workspace. In order to override this, uncheck the ''​Use default location''​ checkbox and select a location for the new project.
Line 49: Line 50:
 === New model elements === === New model elements ===
  
-For XtxtUML syntax, select ''​File''​ / ''​New''​ / ''​Other...''​ / ''​txtUML''​ / ''​XtxtUML File''​. Fill in the source folder and package to place the new source file in, then enter a file name. You can also choose between the two possible extensions: .xtxtuml ​and .txtuml+For XtxtUML syntax, select ''​File''​ / ''​New''​ / ''​Other...''​ / ''​txtUML''​ / ''​XtxtUML File''​. Fill in the source folder and package to place the new source file in, then enter a file name. You can also choose between the two possible extensions: ​//.xtxtuml// or //.txtuml//.
 {{v050:​newxfile.png}} {{v050:​newxfile.png}}
  
Line 61: Line 62:
 ==== Generating diagrams === ==== Generating diagrams ===
  
-It is possible to generate [[http://​wiki.eclipse.org/​MDT-UML2|EMF-UML2]] models together with [[https://​eclipse.org/​papyrus/​|Papyrus]] diagrams from txtUML models. Currently classstate machine ​and composite structure ​diagrams can be generated. Content and layout of the class diagrams and flat state machine ​or composite structure ​diagrams can be defined by textual diagram descriptions. (Support for [[https://​github.com/​ELTE-Soft/​txtUML/​issues/​214|hierarchical diagrams]] is coming in a later release.)+It is possible to generate [[http://​wiki.eclipse.org/​MDT-UML2|EMF-UML2]] models together with [[https://​eclipse.org/​papyrus/​|Papyrus]] diagrams from txtUML models. Currently class and state machine diagrams can be generated. Content and layout of the class diagrams and flat state machine diagrams can be defined by textual diagram descriptions. (Support for [[https://​github.com/​ELTE-Soft/​txtUML/​issues/​214|hierarchical diagrams]] is coming in a later release.)
  
-The following simple example assumes classes ''​A'',​ ''​B'',​ ''​C''​ and ''​D''​ in the model. We create a class diagram ​with where classes ''​A'',​ ''​B''​ and ''​C''​ are in a row, and class ''​D''​ is below ''​B''​. Diagram definitions can be written using a Java API. See the [[v050:​layout|Diagram Language Guide]] for detailed description.+The following simple example assumes classes ''​A'',​ ''​B'',​ ''​C''​ and ''​D''​ in the model. We create a class diagram where classes ''​A'',​ ''​B''​ and ''​C''​ are in a row, and class ''​D''​ is below ''​B''​. Diagram definitions can be written using a Java API. See the [[v050:​layout|Diagram Language Guide]] for detailed description.
  
 Our example diagram can be defined as follows: Our example diagram can be defined as follows:
Line 69: Line 70:
 <​code>​ <​code>​
 public class ExampleDiagram extends ClassDiagram { public class ExampleDiagram extends ClassDiagram {
- @Row({A.class,​ B.class, C.class}) +  ​@Row({A.class,​ B.class, C.class}) 
- @Below(val = D.class, from = B.class) +  @Below(val = D.class, from = B.class) 
- class ExampleLayout extends Layout {}+  class ExampleLayout extends Layout {}
 } }
 </​code>​ </​code>​
Line 81: Line 82:
  
 When clicking ''​Finish'',​ a Papyrus model is generated with the following class diagram: When clicking ''​Finish'',​ a Papyrus model is generated with the following class diagram:
-{{v020:diag.png}}+{{v050:diag.png}}
  
 ==== Diagram language ==== ==== Diagram language ====
Line 94: Line 95:
 Switch to Java or Debug perspective and create a new run/debug configuration. Use ''​Java Application''​ type if you only want to run or debug the model only in text. Use ''​txtUML Application''​ type if state machine animation is required as well. Switch to Java or Debug perspective and create a new run/debug configuration. Use ''​Java Application''​ type if you only want to run or debug the model only in text. Use ''​txtUML Application''​ type if state machine animation is required as well.
  
-{{v040:​debugconf.png}}+{{v050:​debugconf.png}}
  
 Breakpoints can be created and managed the same way as for Java programs. The standard debug controls (stop, pause, resume, step, step-into) work as usual. Breakpoints can be created and managed the same way as for Java programs. The standard debug controls (stop, pause, resume, step, step-into) work as usual.
  
-{{v020:​breakpoint.png}}+{{v050:​breakpoint.png}}
  
 The variable view can show the current signal, current state, associations and the attribute values of the actual object. The variable view can show the current signal, current state, associations and the attribute values of the actual object.
  
-{{v020:​variableview.png}}+{{v050:​variableview.png}}
  
 === State machine animation === === State machine animation ===
  
-txtUML can animate state machine diagrams generated by the txtUML visualization process. See the [[v020:​userguide#​Generating diagrams]] section. Make sure that the run/debug configuration is of ''​txtUML Application''​ type.+txtUML can animate state machine diagrams generated by the txtUML visualization process. See the [[v050:​userguide#​Generating diagrams]] section. Make sure that the run/debug configuration is of ''​txtUML Application''​ type.
  
 Open the generated Papyrus diagram and start the model either in //run// or in //debug// mode. The current state and currently executed transition gets highlighted. Open the generated Papyrus diagram and start the model either in //run// or in //debug// mode. The current state and currently executed transition gets highlighted.
  
-{{v040:​animation.png}}+{{v050:​animation.png}}
  
 For each state machine diagram, the state changes of the first activated object of the corresponding type will be highlighted. An expected later improvement will make it possible to select the object to be animated during the debug session. For each state machine diagram, the state changes of the first activated object of the corresponding type will be highlighted. An expected later improvement will make it possible to select the object to be animated during the debug session.
Line 120: Line 121:
 {{v050:​cpp-dialog.png}} {{v050:​cpp-dialog.png}}
  
-The Eclipse project and the package that contains the model must be specified. The runtime library contains only pre-written cpp files so they can be used for other generated models too. +The Eclipse project and the package that contains the model must be specified. The runtime library contains only pre-written ​//.cpp// files so they can be used for other generated models too. 
    
 The txtUML deployment configuration is a description of how the object instances will be distributed into different threads. The txtUML deployment configuration is a description of how the object instances will be distributed into different threads.
-The deployment configuration is a special class which derived from ''​Configuration''​ base class.  +The deployment configuration is a special class which is derived from the ''​Configuration''​ base class.  
-The model classes can be grouped and the groups can be configured.  +The model classes can be grouped ​together ​and these groups can be configured ​as described below.  
-The events ​arrived for that classes which belongs ​to same group will be served by same configured thread pool.+The events that arrive for classes which belong ​to the same group will be served by configured thread pool.
  
-You can grouping ​by the help of ''​Group''​ annotation which contains the following configuration options: +You can group by the help of ''​Group''​ annotation which contains the following configuration options: 
-  * ''​contains'':​ You can listing ​the classes which belongs ​to the group +  * ''​contains'':​ You can enumerate ​the classes which belong ​to this group. 
-  * ''​constant'':​ It determines how many thread ​will be regardless of number of object instances. It's default value: 1. It is a natural number. +  * ''​constant'':​ It determines how many threads ​will be regardless of the number of object instances. It must be a natural number. Its default value is ''​1''​
-  * ''​gradient'': ​it determines how many thread ​will be created depending number of objects. It can be real number between 0 and 1. It is a linear ​dependency. (value*where n is the created objects). It'default value0. +  * ''​gradient'': ​It determines how many threads ​will be created ​(in addition to the number of ''​constant''​ threads) ​depending ​on the number of objects. It represents ​a linear ​coefficient,​ that is, the number of additionally created threads is ''​gradient ⋅ n'', ​where ''​n'' ​is the number of created objects. It can be a real number between ​''​0.0''​ and ''​1.0''​. Its default value is ''​0''​
-  * ''​max'': ​it determines how many thread ​will be created at most. It'​s ​default value is determined by value of constant+  * ''​max'': ​It determines how many threads ​will be created at most. It must be a natural number. Its default value is determined by the value of ''​constant''​.
- +
-If remains un-grouped classes then a default implicit group will be created which contains these classes. It will be configured with default values+
  
 +If there are classes with no groups aligned to them, a default implicit group will be created which contains these classes. It will be configured with the default values shown above. ​
  
 Examples: Examples:
- 
  
 <​code>​ <​code>​
Line 143: Line 142:
 </​code>​ </​code>​
  
- +This means that all of the classes will be grouped ​in the default group.
-It means that all of classes will be grouped ​to default group. +
  
 <​code>​ <​code>​
Line 153: Line 150:
 </​code>​ </​code>​
  
-It means that A and B objects instances is served by the same thread pool witch contains two constant ​thread and half much as A or B typed object is created but only 10 at mostThe typed objects is served by an other thread pool and it contains only one thread+This means that instances of classes ''​A'' ​and ''​B''​ are served by the same thread pool, which contains two constant ​threads plus one for every ''​2''​ ''​A'' ​or ''​B''​ instances ​createdbut no more than ''​10''​Instances of class ''​C''​ are served by another ​thread pool and it contains only one thread ​(according to the default values).
- +
-We suggest reviewing ​the deployment configurations in the {{v040:​demo.zip|demo projects}}. +
  
 +We suggest reviewing the deployment configurations in the {{v050:​demo.zip|demo projects}}.
  
 The generated C++ code is saved in the //cpp-gen// folder of the selected project. Note that you might have to //refresh// the folder so that the newly generated files become visible in Eclipse. The generated C++ code is saved in the //cpp-gen// folder of the selected project. Note that you might have to //refresh// the folder so that the newly generated files become visible in Eclipse.
  
 +{{v050:​cpp-gen.png}}
  
-{{v040:cppfiles.png}}+**CMake support:**
  
 +You can compile the generated files with any C++ compiler manually but we suggest using the generated //​CMakeLists//​ file to create native "make files" that can be used in the compiler environment of your choice. //CMake// is available from [[https://​cmake.org/​]].
 +It is recommended to create a new folder next to the generated files, where the build environment should be created. The compilation can be performed by the following command:
  
-**CMake support:**+<​code>​ 
 +cmake -G <​environment>​ -D CMAKE_BUILD_TYPE=<​type>​ <​path>​ 
 +</​code>​
  
-You can complying ​the generated files with any C++ complier manual but we suggest using the generated //​CMakelist//​ file to create native makefiles that can be used in the compiler environment of your choiceThe cmake is aviable from [[https://cmake.org/]]+Where the parameters mean the following:​ 
-You should create a new folder next to the generated ​files where the build envirorement should be createdOpen terminal or command prompt and type the following command:+  * ''<​environment>'':​ The chosen build environment. ​You can use the ''​cmake %%--%%help''​ command ​to list the possible build environments 
 +  * ''<​type>''​The type of the buildCan be ''​Debug''​ or ''​Release''​
 +  * ''<​path>'':​ The relative path to the generated ​//​CMakeLists//​ file.
  
-cmake -G "​Chosen build enviorement"​ -D CMAKE_BUILD_TYPE=[Bedug,​Realse] [.,..] (it depends on where the CMakeList file compared to the current path)+A concrete example:
  
- +<​code>​ 
-The //cmake --help// command listing the possible build enviroments. ​+cmake -G "MinGW Makefiles" ​-D CMAKE_BUILD_TYPE=Release .. 
 +</code>
  
v050/userguide.1468778147.txt.gz · Last modified: 2016/07/17 19:55 by nagy.andras95