IBM Support

How to Initialize member of a structure in Rational Rhapsody

Question & Answer


Question

How do you initialize member of a structure in IBM Rational Rhapsody?

Cause

You would like to generate code with initialized values for each member of the structure in Rational Rhapsody.

Answer

You can initialize the members of the structure type in Rational Rhapsody by following the steps below:

  1. Create a Type under a package

  2. Add a structure type with some member attributes as shown:



  3. Create a variable and set the structure type as its Type as shown:



  4. Enter the initial value within curly brackets <Refer Screen capture in Point 3>
  5. Override the Property CPP_CG::Attribute::InitializationStyle for the variable to ByAssignment

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.6.1.3","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21622177