It's time again for a new release of Model RealTime: 11.1 2021.40. Let's look at the highlights of this release.
You can now create constructors for capsules in the same way as for passive classes using the Add UML - Special Operation - Constructor command. A capsule constructor lets you pass initialization data which can be used by a capsule instance already at the time of its creation. For example, it allows you to have attributes of reference type in a capsule.
A capsule factory defines how to create and destroy an instance of a capsule. It allows, for example, to invoke a capsule constructor that you have defined. Capsule factories can be specified for individual capsule parts or globally in a TC. It can also be provided when incarnating an optional capsule part using the Frame service of the TargetRTS. Check this article for more information on how to customize capsule creation.
A new TargetRTS service for dependency injection is now available. It's implemented in the RTInjector
class and allows you to dynamically assign a create function to be used when incarnating a certain capsule part. A capsule factory can then delegate the creation of capsule instances to RTInjector
to make sure the correct type of capsule instance gets created. You can even change the registered create functions dynamically at run-time if you need to.
Two new preferences were introduced in RealTime Development - Transformation Configuration Editor - Model References. By enabling them, references to model elements from a TC can become more "portable" by using file paths that are relative to the TC file rather than the workspace. Also, the unique ID that normally is used for identifying the element in a model file can be replaced with a qualified name instead. This improves the readability of a TC file.
The preference RealTime Development - Build/Transformations - C++ - Code compliance - Clang-Tidy now also handles warnings for unused parameters. If the preference is set, all functions generated by the model compiler will get comments that suppress Clang-Tidy warnings about unused parameters. By not getting warnings from the generated code, it becomes more practical to use Clang-Tidy to find problems in your handwritten code snippets.
Mattias Mohlin
Architect for IBM Model RealTime