Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Mastering UML with Rational Rose 2002.pdf
Скачиваний:
137
Добавлен:
02.05.2014
Размер:
9.68 Mб
Скачать

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

Anything you change using this window will set the default for all classes, attributes, operations, and so on.

You can also set the code−generation properties for a single class, attribute, operation, or other model element. To do so, open the specification window for the model element and select the CORBA tab. On this tab, you can change the properties that apply to that particular type of model element. In the following sections, we'll examine the CORBA code−generation properties.

Project Properties

Project properties are the CORBA code−generation properties that apply to the whole project rather than to any specific model element, such as a class or relationship.

568

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

The options in this section include things like the default directory to use when generating code and the maximum number of errors that can occur during code generation. Each of the project properties is listed in Table 17.1 along with its purpose and default value.

Table 17.1: CORBA Code−Generation Project Properties

Property

Purpose

Default

CreateMissingDirectories

Controls whether Rose should create directories to

True

 

mirror the packages when generating code.

 

Editor

Controls which editor to use to view and edit CORBA Built−In (Uses a

 

files.

built−in CORBA

 

 

editor)

IncludePath

Path used to resolve the location of .IDL files during

Empty

 

code generation and reverse engineering.

 

StopOnError

Controls whether Rose will stop generating code if it

True

 

encounters an error.

 

PathSeparator

Sets the character (such as the backslash) to separate

<blank> (uses the

 

path elements.

default for the

 

 

operating system)

You can also set these properties through the Tools → CORBA → Project Specification menu item, as shown on the following page.

569

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

It does not matter whether you set the properties in the Tools → Options area or through the Project Specification window. Changes you make in one area will be reflected in the other.

Class Properties

Class properties are the CORBA code−generation properties that apply specifically to classes. Most of the class properties are set through the Class Specification window. There are a few properties, however, that can also be set through the Tools → Options area, as shown below:

Table 17.2 lists the CORBA class properties on the Tools → Options window, their purposes, and their default values.

570

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

Table 17.2: CORBA/IDL Code−Generation Class Properties

Property

Purpose

Default

ArrayDimensions

Sets the dimensions of the array used in the class

Empty

 

definition if the class is a typedef.

 

ImplementationType

This value has different uses based on the class’s

Empty

 

stereotype. If CORBAConstant, then the value

 

 

indicates the data type of the constant. If

 

 

CORBATypeDef, then the value indicates the data

 

 

type. If CORBAUnion, then the value is equivalent to

 

 

the switch type.

 

ConstValue

If a CORBA constant is being generated, controls the

<blank>

 

value of the constant.

 

The properties listed above apply to all types of CORBA classes. You can, however, set additional properties for the different CORBA stereotypes supported by Rose.

When you first create a class and try to open its specification window, Rose will prompt you for the type of class to create:

In the Stereotype field, select from the following: Interface, CORBAConstant, CORBAEnum, CORBA−Exception, CORBANative, CORBAStruct, CORBATypedef, CORBAUnion, CORBAValue, or CORBACusomValue. Once you have selected a stereotype, the appropriate specification window will appear.

Interface Specification

On the interface specification window, you can set the following:

Inherits From to set the parent class

Attribute/Role Ordering to set the order in which attributes and roles will be generated in the code

DocComment for comments that will be generated in the code

571

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

CORBAConstant Specification

On the constant specification window, you can set the following:

Implementation Type to set the data type of the generated constant

Constant Value to set the value of the generated constant

DocComment for comments that will be generated in the code

CORBANative Specification

On the CORBANative specification window, you can set only the DocComment field, which is for comments that will be generated in the code.

572

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

CORBATypeDef Specification

On the typedef specification window, you can set the following:

Implementation Type to set the data type of the generated typedef

Array Dimensions to indicate that the typedef's declarator is an array and sets the dimensions of the array

DocComment for comments that will be generated in the code

CORBAUnion Specification

On the union specification window, you can set the following:

Attribute/Role Ordering to set the order in which attributes and roles will be generated in the code

Switch Type to set the switch type for case statements for the union

573

Chapter 17: CORBA/IDL Code Generation and Reverse Engineering

DocComment for comments that will be generated in the code

CORBAValue/CORBACustomValue

On the value specification window, you can set the following:

Inherits From to set the parent class

Attribute/Role Ordering to set the order in which attributes and roles will be generated in the code

DocComment for comments that will be generated in the code

Other CORBA Stereotypes

On the specification window, you can set the following for other CORBA stereotypes (CORBA−Enum, CORBAException, and CORBAStruct):

574