1 / 17

Mastering Rational Rose RealTime Integrating C++ External Code

Mastering Rational Rose RealTime Integrating C++ External Code. Objectives. Describe the two methods of integrating external code Define the terms Sendable Observable Marshallable. Topics. Integrating External Code Integrating External Data. Reasons for Integrating External Code.

shada
Download Presentation

Mastering Rational Rose RealTime Integrating C++ External Code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mastering Rational Rose RealTimeIntegrating C++ External Code

  2. Objectives • Describe the two methods of integrating external code • Define the terms • Sendable • Observable • Marshallable

  3. Topics • Integrating External Code • Integrating External Data

  4. Reasons for Integrating External Code There are several possible reasons for wanting to include external code in your Rose RealTime model: • Required to interface to legacy code • Required to interface to code that is being developed outside of the Rose RealTime toolset • A part of your system can be developed efficiently using third-party libraries

  5. Integration Requirements • To integrate external code you need: • The name of the header file • The path to the header file • The path to the .obj file • It’s a good idea to use a variable instead of hard-coding the path and name

  6. C++ Level of Integration There are two levels of integration: • Class-by-class • To make an #include file for a class, use the capsule/class specification dialog box: HeaderPreface (Capsule, C++ ) • Model-wide • To make an #include file for the entire model, do it in a component using the component specification dialog box: CommonPreface(Component, C++ Generation)

  7. Topics • Integrating External Code • Integrating External Data

  8. Model 3 Target Model 1 Model 2 Sendable, Observable, Marshallable Host Observable Sendable Marshallable (Injectable)

  9. Auto-Magic • Data classes are automatically sendable, observable and marshallable if they don’t have attributes that are pointers • This section tells you how to use external data classes

  10. Integration Types There are two options for integrating a passive class • Simple • Includes header files • Knows how to encode strings • Sendable • Observable or marshallable • Type descriptor for passive class needs to be created • Includes header files • Knows how to decode strings • Knows how to inject strings

  11. Linking in External Code • If objects are: • Only used to store information within a single capsule instance • Only sent by reference never to be observed or injected • Then make the external class definitions visible to the compiler • Once the definition is visible to the compiler, you can use the class or type within any detail-level code

  12. C++ Linking in External Code (cont.) To make the external class definitions visible to the compiler: • Add the include files to the HeaderPreface section in the C++ tab of the Capsule Specification dialog • Link the external code in with the model (from the component specification)

  13. Integrating External Classes • If objects: • Need to be sent by value between capsule instances (sendable) • Need to be observed during debugging (observable) • Need to be encoded/decoded because they are injected or sent to other processes (marshallable) • Then create a type descriptor for the class to describe the types to the Services Library

  14. C++ Generating Type Descriptors • Needed to inform the RTS of structure • Array • Multiple instances • Generate Descriptor • Generate Type Modifier

  15. C++ Options for Integrating External Classes • There are three ways to handle an externally defined class or data type: • Create a class with the same attributes as the external class and let the Rose RealTime toolset generate the type descriptor • Add the code yourself for describing how to copy, initialize, destroy, encode, and decode an instance of this type • Use the C++ Analyzer (via Tools menu) to reverse engineer existing code • An external class can be made sendable by value without being observable and vice versa (encode/decode not needed)

  16. C++ Option 1: Let RoseRT Create Type Descriptors

  17. C++ Option 2: Defining Required Functions Yourself • To integrate classes in this manner, you must understand the usage of the 5 functions: • InitFunctionBody • CopyFunctionBody • DestroyFunctionBody • DecodeFunctionBody • EncodeFunctionBody • Defined in the C++ TargetRTS tab of the class specification

More Related