The animation feature in IBM® Rational® Rhapsody® is
made possible due to instrumentation code that the product inserts
when it generates code for configurations where Instrumentation Mode
has been set to Animation.
Because
the underlying approach in code-centric
mode is to minimize the intrusion into your code, there is a difference
in the way animation code is generated in code-centric mode, compared
to animation code generated in model-centric mode:
In
code-centric mode, when code is generated for
animation, only the files that contain animated elements are generated,
rather than all the files as is the case in model-centric mode.
As is the case with model-centric mode, animation
code that is generated is framed within #ifdef _OMINSTRUMENT blocks.
If you make changes to the code within these blocks, roundtripping
will ignore
these changes.
Because code is not generated
for diagrams such
as statecharts and activity diagrams in code-centric mode, the only
type of diagram that can be animated is a sequence diagram.
To further minimize the intrusion into your code
as the result of animation, you can use the following Rational Rhapsody features
when animating in code-centric mode:
- Use
the Animate option in the pop-up menu
for Sequence Diagrams to specify which sequence diagrams to animate.
(When you use this option, all classes included in the diagram will
be animated.)
- Use the Advanced Instrumentation
Settings window
(accessed through the Advanced button on the Settings tab
of the Features window for configurations) to specify that instrumentation
code is to be generated for only certain type of elements, such as
operations.
- Use the Advanced Instrumentation
Settings window
to specify that instrumentation code generates only for specific diagrams,
classes, or both.
While the instrumentation
code is less intrusive
in code-centric mode, it is important to keep in mind the following
information when using animation:
- In ordinary
code-centric code generation, code
is generated only for modified elements within a file. When using
animation, however, files that contain any animated elements will
be regenerated
in their entirety.
- If you are working with
a single Rational Rhapsody configuration
and change the Instrumentation Mode to Animation, then the files generated
by Rational Rhapsody will
overwrite
those files currently in your output directory.
- If
a file has been generated for animation purposes,
it will be generated in full each time you generate code (selective
code updating is not used) until the next time you roundtrip the code.
This
means that to restore selective code update behavior for files that
contained instrumentation code, you must:
- change
the animation settings so that instrumentation
code is not generated
- regenerate the code
- roundtrip the generated file
- Even though auto-generated code
is not typically generated in code-centric mode, if you are using
animation there are cases where Rational Rhapsody might
generate some auto‑generated elements, for example, generating
a constructor if your code does not contain one.