Troubleshooting
Problem
Customers who have overridden TargetRTS methods in their model will experience this error when they upgrade from Tornado 2.0 to Tornado 2.2.
Cause
The GNU compiler shipped with WindRiver's Tornado 2.2 is stricter when it comes to definition of class methods. They must be declared within the class definition.
Resolving The Problem
Currently, IBM Rational Rose RealTime only allows you to declare a method, or declare and define a method. There is an RFE (Request for Enhancement) asking that Rose RealTime allow you to define a method and not declare it. Then the declaration in the TargetRTS libraries will be used.
There are several workarounds for this issue. The following examples use Tornado 2.2.1. The first three workarounds declare the class and methods as per the online documentation "Overriding Operations Within a Model".
1) Inline the methods to be overridden. Open the operation specification and go to the C++ tab. Check the inline check box.
2) Create the operations to be overridden under a class in the Logical View.
- Add the following to the class specification's HeaderPreface (Class, C++)
#ifndef TORNADO_221 - Add the following to the class specification's HeaderEnding (Class, C++)
#endif //TORNADO_221 - Add the following to your Tornado 221 component specification's CompileArguments (Component, C++ Compilation)
-DTORNADO_221
This will generate code similar to the following source in the header file for the class.
#ifndef TORNADO_221
void RTMain::targetShutdown( void );
void RTMain::targetStartup( void );
#endif //TORNADO_221
3) Comment out the method declarations.
- Add the following to the bottom of the class specification's HeaderPreface (Class, C++)
/* - Add the following to the top of the class specification's HeaderEnding (Class, C++)
*/
/*
void RTMain::targetShutdown( void );
void RTMain::targetStartup( void );
*/
4) Do not create the operations to be overridden under a class in the Logical View. Instead place the definitions in the class HeaderPreface. The disadvantage of this option is that you have to open the class specification to see the operations that have been defined. The operations will not be visible in the model browser or class diagrams.
#include <RTMain.h>
#include <iostream>
using namespace std;
void RTMain::targetShutdown( void )
{
cout << "**** Overridden RTMain::targetShutdown ****" << endl;
}
void RTMain::targetStartup( void )
{
cout << "**** Overridden RTMain::targetStartup ****" << endl;
}
The attached model is an example of workaround 2).
For more information on overriding TargetRTS methods in your model, see the online help at
C++ Reference --> Configuring and Customizing the Services Library --> Configuration and Customization --> Overriding Operations Within a Model
Related Information
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21176776