This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
v050:userguide [2016/07/28 09:54] ndj94 [Creating own models] |
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 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 class, state 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 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 is 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 together and these groups can be configured as described below. | The model classes can be grouped together and these groups can be configured as described below. | ||
The events that arrive for classes which belong to the same group will be served by a configured thread pool. | The events that arrive for classes which belong to the same group will be served by a configured thread pool. | ||
You can group 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 enumerate the classes which belongs to this group. | + | * ''contains'': You can enumerate the classes which belong to this group. |
- | * ''constant'': It determines how many threads will be regardless of the number of object instances. It's default value is ''1''. It must be 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 threads will be created depending on the number of objects. It can be a real number between ''0.0'' and ''1.0''. It is a linear dependency. (''value * n'' - where ''n'' is the number of created objects). It's default value is ''0''. | + | * ''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 threads will be created at most. It's default value is determined by the 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 there are classes with no groups aligned to them then a default implicit group will be created which contains these classes. It will be configured with the default values shown above. | + | 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: | ||
Line 141: | Line 142: | ||
</code> | </code> | ||
- | This means that all of the classes will be grouped to the default group. | + | This means that all of the classes will be grouped in the default group. |
<code> | <code> | ||
Line 149: | Line 150: | ||
</code> | </code> | ||
- | This means that ''A'' and ''B'' objects instances are served by the same thread pool witch contains two constant threads plus one for every ''2'' ''A'' or ''B'' typed objects created, but only ''10'' at most. The ''C'' typed objects are served by another thread pool and it contains only one thread (default values). | + | 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 created, but 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 {{v050:demo.zip|demo projects}}. | We suggest reviewing the deployment configurations in the {{v050:demo.zip|demo projects}}. | ||
Line 159: | Line 160: | ||
**CMake support:** | **CMake support:** | ||
- | You can compile the generated files with any C++ compiler manually but we suggest using the generated //CMakelist// file to create native "make files" that can be used in the compiler environment of your choice. //Cmake// is available from [[https://cmake.org/]]. | + | 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/]]. |
- | You should create a new folder next to the generated files where the build environment should be created. Open a terminal or command prompt and type the following command: | + | 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: |
<code> | <code> | ||
- | cmake -G "Chosen build enviorement" -D CMAKE_BUILD_TYPE=[Bedug,Relase] [.,..] | + | cmake -G <environment> -D CMAKE_BUILD_TYPE=<type> <path> |
- | (it depends on where the CMakeList file is compared to the current path) | + | |
</code> | </code> | ||
+ | Where the parameters mean the following: | ||
+ | * ''<environment>'': The chosen build environment. You can use the ''cmake %%--%%help'' command to list the possible build environments. | ||
+ | * ''<type>'': The type of the build. Can be ''Debug'' or ''Release''. | ||
+ | * ''<path>'': The relative path to the generated //CMakeLists// file. | ||
- | The //cmake --help// command listing the possible build enviroments. | + | A concrete example: |
+ | |||
+ | <code> | ||
+ | cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=Release .. | ||
+ | </code> | ||