Troubleshooting
Problem
An IBM Rational ObjecTime model converted to an IBM Rational Rose RealTime model has compile time errors in sub/classes related to incorrectly generated dependencies on data classes. The compilation errors look like... !> Compiling SubClass SubClass.cpp ../src\SuperClass.h(36) : error C2079: 'myESV' uses undefined class 'EsvType' ../src/SubClass.cpp(33) : error C2079: 'localVar2' uses undefined class 'LocalDataType2' NMAKE : warning U4010: 'SubClass.OBJ' : build failed; /K specified, continuing ...
Cause
ObjecTime's "Generate Class Dependencies..." behaves differently than Rose
RealTime's "Add Class Dependencies..."
Resolving The Problem
Explanation of Terms
Explicit and implicit dependencies are exclusively ObjecTime concepts and have no meaning in Rose RealTime.
Implicit dependencies are automatically detected by the ObjecTime toolset. Any class reference which is visually rendered in ObjecTime automatically results in an implicit dependency on the referenced class. Implicit dependencies are not shown in a class's Properties/Dependencies pane, they are "invisible" in the toolset but do have an impact on the generated code, that is, the appropriate #include in the appropriate file.
Explicit dependencies are not automatically detected by the ObjecTime toolset. Any data class referenced in the action code of an actor, and not referenced by any ESV (extended state variable) definition in the actor, will require the addition of an explicit dependency. They are either manually added to a model by dragging and dropping a data class from the Update Browser or by running Update => Generate Class Dependencies... Explicit dependencies are shown in a class's Properties/Dependencies pane. They result in a forward reference in the generated code of the appropriate file.
Differences between ObjecTime and Rose RealTime
In ObjecTime, data classes referenced in an actor's action code, which did not already have an implicit dependency, would have an explicit dependency generated for that actor. By contrast in RoseRT, "Add Class Dependencies..." does not search a capsule's action code and therefore compilation errors can result. A dependency between the capsule and the class must be added to a class diagram before the compilation will succeed in Rose RealTime. Note: This is the expected behaviour in RoseRT!
In ObjecTime, "Generate Class Dependencies..." only _adds_ explicit dependencies, it is not designed to remove explicit dependencies which are no longer required. How could an explicit dependency no longer be required? Say Actor1 initially has a reference to a data class Data1 somewhere in its action code. An explicit dependency on Data1 is manually added to Actor1. Later, an ESV of type Data1 is added to Actor1. The ObjecTime toolset will automatically add an implicit dependency on Data1 to Actor1. There is now an implicit and explicit dependency on Data1 in Actor1. This does not cause a problem in ObjecTime but can cause compilation errors in models migrated to Rose RealTime.
What happens to a migrated ObjecTime model with an actor that has both an implicit and an explicit dependency on a data class? When Rose RealTime reads in the linear form file, the explicit dependency is processed first and the KindInHeader is set to "forward reference" and KindInImplementation is set to "inclusion" for the relation/dependency. This dependency is too "weak" and results in a compilation error. It needs to be KindInHeader==include and KindInImplementation==none.
If the migrated actor class only has an implicit dependency on a data class, then the KindInHeader is set to "inclusion" and the KindInImplementation is set to "none". In this case all is well if the capsule (migrated actor) has subclasses, no compilation errors will result.
The ObjecTime code generation for inherited data class dependencies in actor subclasses was over zealous, it would add inclusions in subclasses whether they were needed or not, resulting in longer compile times. In Rose RealTime, the code generation in this area is more conservative, it only adds inclusions when necessary, thus saving compilation time.
Migration Procedure
In ObjecTime Developer
1) Remove all unnecessary explicit dependencies from all actors. Open Property Editors on all actor classes in the model, select and delete all dependencies from the Dependencies pane.
2) In the Update Browser select, Update > Generate Class Dependencies..., this will add only the necessary dependencies.
3) Do a clean compile of your model, that is, with no errors. Passivate/save your model.
4) Get and apply the latest patches for ObjecTime 5.2.1. Save Session. Get and apply the
rrt04e.rrtexport_enhanced.patch to your ObjecTime session. (This patch is available from the ObjecTime support site under Downloads, select "Toolset & Other Patches for Rational ObjecTime V5.2.1 for Windows & UNIX", then download the "Special Patch)
5) In the Update Browser select Update > Export... and choose Rose RealTime Linear Form. Abandon your session, so that RRT04E is not saved as part of your session. (Patch RRT04E is a utility patch and should not be part of your regular patch lineup!)
In Rose RealTime
6) Select File > Open on the linear form file produced in step 5
7) Select Build > Add Class Dependencies...
8) Build your component and add references [yes] if/when dialog box pops up. (Add dependencies to Class diagram as necessary for any classes which are referenced in code. This shouldn't be required if you have followed the preceding steps.)
This should produce a clean compile/build in Rose RealTime of your migrated ObjecTime model.
Related Information
Historical Number
12692
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21123736