Today we release Model RealTime 11.1 2021.24, the second release on the 11.1 release track. The release contains several improvements, both bug fixes and new features. Let's have a look at some of these new features.
You can now use the Mocha framework for unit testing capsules. A new command in the context menu of a capsule, Add Unit Test, will create everything needed for quickly writing and running a unit test for the capsule:
You can run the unit tests directly from within the Model RealTime user interface, or from the command-line.
The model compiler can now generate code that complies with some of the rules implemented by the static code analysis tool Clang-Tidy. Enable this feature by setting the new preference RealTime Development - Build/Transformations - C++ - Code compliance - Clang-Tidy. By not getting warnings from the generated code, it becomes more practical to use Clang-Tidy to find problems in your handwritten code snippets.
When a search returns a large number of matches it's useful to filter the search result. Model RealTime now allows the boolean AND (&&) operator to be used for combining multiple patterns in the filter string. You can also combine it with the boolean NOT (!) operator to specify a filter string that will hide all matches where certain words are not present.
You can enclose the filter string in double quotes to avoid special interpretation of the characters ! or && (i.e. in that case the filter string will be applied verbatimly).
The model compiler now supports generating type descriptors for type aliases with template parameters. For example:
template<typename T, unsigned int N > using StdArray = std::array<T, N>;
If type descriptor functions are defined for the type alias, they will be generated as template functions with the same template parameters. This makes it possible to implement the type descriptor generically so that it works for all (or many) instantiations of the template.
For type aliases of container types (vector, array etc) it's typically needed to lookup the type descriptor for the element type at compile time when implementing for example the encode function. This is possible by means of a new TargetRTS template function RTObject_class::fromType<T>()
. It is specialized for all built-in C++ types, and you can write your own specializations for other types for which this is needed.
Mattias Mohlin
Architect for HCL Model RealTime