Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
Topic Title: Rhapsody tip: Using types in/out/inout direction modifiers to con trol the argument t
Topic Summary:
Created On: 27-Jul-2004 17:53
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 27-Jul-2004 17:53
User is offline View Users Profile Print this message


Amos Ortal

Posts: 120
Joined: 22-Jul-2004

How many times when you wanted to create a type in a model, you ended wanting three or four type (T, T*, const T& ...)?
Well.. Rhapsody 4.0 has the answer for you! and this is code generation for argument direction modifiers. From the same type you can get four different flavors depending on the way the type is used: As an In,Out,Inout arguments or as a return type.

How does it work?
Each modeled type has an additional four properties under CG::Type -
In - the signature of the type when the argument direction is set to In.
Out - the signature of the type when the argument direction is set to Out.
InOut - the signature of the type when the argument direction is set to Inout.
ReturnType -the signature of the type when used as a return type.
All the properties are set by default to $type that is resolved as the type name.
You can modify each of the properties to reflect the way the type should be used in different directions (for example "const $type&" for In direction in C++).
The generated code is modified according to the change in properties (and you can roundtrip the code without any problems).
Usage example:
Say that you want to use this mechanism for classes in the model (e.g. when selecting a type you want to see all the classes in the model, and you want to use the argument In/Out modifiers to control the way the selected class is used)
Create in the model a package named classTypesPkg and set its CG::Type::In/Out ... properties
Create a VBA macro that iterate over the model and add a type to the classTypesPkg for each class in the model
When selecting a type for an argument, you can select any of the classes in the model, and have it generated with the correct signature by setting the argument direction modifiers.
Attached is an example with such usage.

Amos
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 0 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.