(c) Copyright 2000, Author: Kurt De Marco
COOL Code Generator Script
Download
it HERE
This readme assumes that you are familiar with Rational Rose(tm) and
how to run a Rose Script. If not please refer to the Rational Rose documentation.
The script was written and tested with Rational Rose 98i. The script
generates COOL class definitions for all classes in a selected package. In this
version it copies the generated code to the clipboard from where you can paste
it in your source. It is helpful to have every package in its own source file
and to separate the generated class definitions from the implementation code
like handlers, rules, etc. To use the script you have to do the following steps:
- Create a new Rose model (You also can extend an existing one).
- Create a new package where you will define your COOL class hierarchy.
- Model your classes Refer to the test model on how to define attributes/slots,
associations and Operations/message-handlers.
- Load the script
- Select the package containing your COOL classes
- Run the script
- Paste the generated code to your source file.
Supported features/generated code:
Classes:
- (Multiple) inheritance
- Abstract and concrete classes
- Concrete classes are reactive
- If there is no userdefined base class the class will be derived from class
USER.
Please note that the precedence of the class definitions in the generated code
corresponds to the precedence you defined them in the model. If you define a
base class at later stage you have to rearrange the classes in your package,
which is a little tricky.
Attributes/Slots:
- The attribute type has to be a valid CLIPS type. This is not checked by
the script.
- Default values are supported.
- If the attribute is public read-write accessors will be generated.
- In the Class Attribute Specification window there is a CLIPS tool tab,
where you can define some COOL code generation properties.
Supported properties are:
- is-multfield: default false
- additional-slot-facets Here you can specify slot-facets which are not directly
supported by the script (eg range, allwed-values, ...)
Associations:
- For every navigable role in an association a slot of type INSTANCE-NAME
will be included in the class definition of the corresponding role class
- If the multiplicity of the role is unequal 1 a multislot will be generated.
If the multiplicity is unspecified 1 is assumed.
- The slot name corresponds to the name of the role. If no role name is given,
the slot name will be the lowercased class name of the role.
- If the role is public read-write accessors will be generated.
Operations/Messagehandlers:
- For every class operation a message-handler forward declaration will be
included in the class definition.