Code RealTime Integration
DevOps Code RealTime is just like DevOps Model RealTime a development environment for creating stateful and event-driven realtime applications in C++. The main differences between the products are:
- Model RealTime is an Eclipse-based product, while Code RealTime runs as an extension of Visual Studio Code, Eclipse Theia or as a web application.
- Model RealTime uses UML models with an emphasis on working in graphical diagrams. Code RealTime, however, uses a textual language, called Art, as the main way to design the application (though it also has graphical diagrams, of course).
- While both Model RealTime and Code RealTime use and generate C++, Code RealTime is more code-centric and Model RealTime more model-centric. There is no overlap between concepts of Art and C++, and many things which in Model RealTime require use of UML model elements, can be done directly in C++ (sometimes with code annotations) in Code RealTime.
Applications created with Model RealTime and Code RealTime use the same TargetRTS, and it's therefore possible to use the two products together. This article describes how you can use Code RealTime for creating some parts of your application, build them into a library, and then use that library from Model RealTime.
The integration between Model RealTime and Code RealTime is available starting from version 12.0.3 as an EXPERIMENTAL feature, with limited support for the Art language. Future versions will extend the support to cover the whole Art language.
Motivation
There can be several reasons and benefits with developing parts of your application with Code RealTime:
- For certain parts of an application, modeling and graphical diagrams add little value, and the textual notation offered by the Art language may be more attractive. For example, protocols and events can often be faster and better to work with in a text editor, and with Code RealTime you get features such as syntax coloring, content assist, semantic validation etc.
- Some groups of developers may prefer to work for example in Visual Studio Code instead of in Eclipse, which makes Code RealTime the better choice for them.
- Libraries created with Code RealTime can be used both by applications created with Model RealTime and Code RealTime. By developing common parts in Code RealTime you can therefore avoid developing them twice and share them between multiple applications.
Workflow
Follow the steps below for using a library created with Code RealTime in Model RealTime:
- Develop the library in Code RealTime and build it with a library TC that uses the same target configuration as you use for building your Model RealTime application. The picture below shows what you see in Code RealTime for a simple library.
- Import the Code RealTime workspace folder into your Model RealTime workspace. Use the command File - Import - General - Projects from Folder or Archive.
- Set the imported library TC as a prerequisite of your executable TC.
- Make sure your executable TC is active, and also that you have enabled the preference Experimental Features - Support Art files from Code RealTime. You should then see the elements defined in the library in the Project Explorer as an imported package:
There will be one imported package for each Art file that is built by the library TC.
- Now you can use the library elements in your Model RealTime model in the same way as if they were defined in the model itself. For example, you can show protocols from the library on diagrams, create ports typed by those protocols and create transitions that trigger on events in the protocols.
- When you build your executable TC in Model RealTime, the generated application will automatically link with the Code RealTime library.
Art Language Support
In this first EXPERIMENTAL version Model RealTime does not support everything that can be written in an Art file. The following subset is currently supported:
- Protocols Use them as the type of ports in your model.
- Events Use them for transition triggers in your capsule state machines. An event may have a data parameter of primitive types (bool, int, long etc). Event parameters of user-defined types are not yet supported.
- User-defined C++ types with a type descriptor Use them from code snippets in your model.
Changing Art Files
If you make a change in the library Art files in Code RealTime you need to rebuild the library there (it does not happen automatically when building in Model RealTime). To see the updated library elements in Model RealTime you need to close and reopen the model project. You may of course also need to update your model, depending on what changes you did, and how the changed elements are used.
Current Limitations
In the current EXPERIMENTAL version of the Code RealTime integration, the following limitations apply:
- Library Art files may only contain what is mentioned in Art Language Support.
- It's required that the library is already built with Code RealTime. It will not be built automatically when building the Model RealTime TC.
- Some features in the Model RealTime user interface may not work exactly the same for imported library elements, as they work when the elements are defined in the model.