IBM® Rational® Rhapsody® can
preserve the order of elements in the original code structure during
code generation. Using this feature allows you to change the order
of class members and globals, and Rational Rhapsody "respects"
those changes.
Code respect has these additional features:
- Code generation regenerates text fragments to the
correct place in file.
- Reverse engineering imports #ifdef-s to the model
as a verbatim text.
- The branches of #ifdef-s that are seen by the compiler
are modeled as logical elements.
- The branches of #ifdef-s that are not seen
by the compiler are modeled as a verbatim text.
When code is generated in Rational Rhapsody,
it resembles the original. This feature gives you complete flexibility
for using manually written code or auto-generated code while receiving
all the benefits of modeling. You can reverse engineer C++ and C code
into a model in a manner that the model respects the order, location,
and dependencies of the global elements in the original code.
Note: The code respect feature applies to
IBM Rational Rhapsody Developer for C and
IBM Rational Rhapsody Developer for C++ and
the reverse engineering and roundtripping features in these products.
As of version 7.2 of the product, any new project you create has the
code respect feature activated by default. To activate code respect
for an old project, see
Activating the code structure preserving feature.
In addition, you can set up Rational Rhapsody Developer for C and Rational Rhapsody Developer for C++ so
that you can roundtrip code into the Rational Rhapsody model
that respects the structure of the code and preserves this structure
when code is roundtripped in the Rational Rhapsody model.
When you have changed the order of elements in C++
and C, roundtripping in respect mode preserves the order of the following
elements for the next code generation:
- Global elements
- Class elements
- #includes and forward declarations
- Auto-generated operations (excluding statechart
and instrumentation code)