Chapter 4

ANSI C++ Add-In

Rose ANSI C++ is the new Rational Rose language add-in in support of the C++ programming language.

Because of its many benefits, users are encouraged to convert their models from Rose C++ to Rose ANSI C++. Rose ANSI C++ is designed to be powerful enough to handle large projects, with particular emphasis on scalability and completeness of language support. The user interface has been completely overhauled to make it easy to understand and use.

A model converter is included as an add-in with this release, and the ANSI C++ online help provides instructions for this easy conversion.


Rose ANSI C++ Features and Enhancements

Rose ANSI C++ provides:

Batch File Load

Progress Bar/Cancel

Macros

AutoSync


Known ANSI C++ Defects

Defect
Description
8350

Reverse engineering with the ANSI C++ add-in does not create a diagram that contains all reverse engineered classes.
Although they do not appear on a diagram, the reverse engineered classes do exist in the model. You can see them in the browser and can add them to a diagram with drag and drop, or by using the Query|Add Classes menu item.

9071

The ANSI C++ add-in displays any errors encountered during code generation or reverse engineering in the Rose log window. However, there is no message telling the user to check the log window for errors.

9084

The ANSI C++ add-in will create two unidirectional associations on reverse engineering when the model originally has a bi-direction association between two classes and both roles of the association are named.

10091

If the stereotype of an operation in the model is changed to <<const>>, and the return type of that operation is a pointer to a function, then the "const" will be inserted into the code in the wrong place.

10776

When generating code, Rose ANSI C++ does not make backup copies of files it changes, nor does it provide an undo mechanism for such changes. You are strongly encouraged to backup your source files or have them under an effective source code control mechanism before generating code.

11115

If a typedef defines more than one name, the ANSI C++ add-in does not reverse engineer the typedef.
For example, reverse engineering the following code completes without error:
>>>
typedef struct myStruct {
DWORD Version;
DWORD Size;
} myName, * lp_myName;
<<<

However, the struct myStruct appears in the model, but the typedef does not.

14630

The ANSI C++ add-in ignores comments in source code.

15120

After you convert a class or model from Classic C++ using the ANSI C++ Model Converter, you generate code for the class or model before attempting reverse engineering. Attempting to reverse engineer before generating code will cause this message to be displayed:
Class cannot be reverse engineered because it does not exist in the project files.

16714

Apply button on component dialog is never enabled.
Workaround: "OK" button is available and enabled.

17114

When a template class is deleted from the code, and then the code is reverse engineered, the corresponding template class in the model is deleted; however, anonymous classes that are instantiations of that template are not deleted.

17513

When indicating "vi" as the editor of choice in the Tools > ANSI C++ > Preferences dialog, it is necessary to invoke vi within the context of it's own window, by entering the following command in the preferences.
xterm -e vi command_line_args
Entering "vi", instead of the command listed above will start vi if an xterm window is currently open and will display the source but it then receives an 'input read error' and exits vi.
emacs and gvim will work as expected.

17844

The initial values of static attributes are not updated during either code generation or reverse engineering. The initial values are used when an item is created for the first time in either the code or the model, but are not changed if the item already exists.

18360

Creation order of classes affects code generation from class (but not from component).
If a class containing a data member is created before the class being contained and code is generated by selecting both classes on a class diagram and choosing Tools > ANSI C++ > Generate Code, the #include for the contained class is not generated.
If code is generated from the component (not the classes), the #include is generated.
If the contained class is created first and code is generated from the class diagram, the #include is generated.

20639

Types nested within template instantiations may not be used as base classes or the ends of assocations, since such types are not modeled. Reverse engineering such code can result in an incorrect model.
For example, if the following code is reverse engineered, the base class of class c will be "a<b>", not "a<b>::z".
template <class t> class a {
typedef t z;
};
class b { };
class c : public a<b>::z { };

21809

Automatically generated #include directives are always relative to the source file root directory. There is no easy way to force them to always be simple names or to make them relative to some other directory.

23938

Multiple code generations on code including the "friend" type will cause the "friend" keyword to appear multiple times.

24206

With AutoSync enabled, when a class in the model is changed from being at package scope to being a nested class, its new definition is correctly added to the code of its containing class, but its old definition in the code is not deleted.

25046

Rose ANSI C++ does not work with components whose stereotype is one of Main Program, Package Body, Subprogram Body, or Task Body. Components with such stereotypes cannot be used for code generation or reverse engineering with Rose ANSI C++.

25564

ANSI C++ dialogs may contain incorrect dialog title of "libcppdll.so".

31276

Initial value for role added to header file during subsequent code generation.

31350

Argument type cannot be updated when Autosync is turned on.


Fixed Defects in ANSI C++ Version 2001A.04.00

10743
29762


When a function parameter is changed in the model and code is generated, the corresponding change is only made in the member function declaration - the *.cpp file is not updated.

11549

If an existing class does not have any member functions or static data members in an implementation (.cpp )file, the ANSI C++ add-in generates the function body for any new functions in the header (.h) file.

11689

Automatic code generation does not create new #included statements when existing code elements are modified via model edits. It only creates them when new items are added.

11961

The ANSI C++ add-in does not create directories during code generation. If you try to generate code into a directory that does not exist, a message will be displayed that says the file cannot be created.

12569

In a .cpp file containing only a #include statement is reverse engineered, the code generator will place this #include statement in a header file on forward engineering.

15144

When attempting to generate code for a collection of classes, if the Root Directory field in the code generation dialog remains empty, a warning dialog is presented once for each of the selected classes

16428

The ANSI C++ add-in does not create directories during code generation. If you try to generate code into a directory that does not exist, a message will be displayed that says the file cannot be created.

16429

If a typedef defines more than one name, the ANSI C++ add-in does not reverse engineer the typedef.
For example, reverse engineering the following code completes without error:
>>>
typedef struct myStruct {
DWORD Version;
DWORD Size;
} myName, * lp_myName;
<<<

However, the struct myStruct appears in the model, but the typedef does not.

16430

The ANSI C++ add-in displays any errors encountered during code generation or reverse engineering in the Rose log window. However, there is no message telling the user to check the log window for errors.

16432

Reverse engineering with the ANSI C++ add-in does not create a diagram that contains all reverse engineered classes.
Although they do not appear on a diagram, the reverse engineered classes do exist in the model. You can see them in the browser and can add them to a diagram with drag and drop, or by using the Query > Add Classes menu item.

16434

If an existing class does not have any member functions or static data members in an implementation (.cpp )file, the ANSI C++ add-in generates the function body for any new functions in the header (.h) file.

16449

The ANSI C++ add-in ignores comments in source code.

16452

The Class Customization feature can generate two get or set operations for the same attribute if the user invokes Class Customization twice, once generating Get by Reference and once just generating Get.

16457

After you convert a class or model from Classic C++ using the ANSI C++ Model Converter, you generate code for the class or model before attempting reverse engineering. Attempting to reverse engineer a class before generating code will cause this message to be displayed:
Class cannot be reverse engineered because it does not exist in the project files.

16463

A previous version of Rose could create multiple module lines for C++ classes in certain cases. These extra module lines cause the
Convert from Classic C++ to fail with this message:
The Class/Interface <class name here> is assigned to an unloaded Component, which has the language C++. Classes/Interfaces
may only be assigned to components with the same language.
To convert a model that has multiple module lines, open the model in a text editor and remove the offending lines. The lines that
should be removed contains two words: "module" and the name of the module. For example:
  module  "ABC"
    module  "ABC"
    module  "ABC"
    module  "ABC"
    module  "ABC"

16550

The ANSI C++ add-in cannot expand pathmaps that are defined using the reserved symbol "&". . Using a pathmap that is defined with "&" for the code generation root directory or the source file root directory will cause this error message when you attempt to close the ANSI C++ Component Specification dialog:
Directory <Pathmap symbol here> does not exist. Please reenter.

16552

The add-in can create the wrong operation signature in the model as a result of reverse engineering. This occurs if the code contains non-const, on-abstract member function declarations (i.e. one where the closing parenthesis is followed by a semicolon), where the last two parameters are abstract declarations(i.e. they don't have an identifier) that contain a single type name.
For instance, when reverse engineering:
class a { };
class b { };
class c { };
class x {
public:
void f(a, b, c);
};
the operation x::f in the model has the signature "f(:a, c:b): void",
which is wrong. The signature should be "f(:a, :b, :c): void".
On code update, the original signature is preserved, so the code is not changed. Only the model is incorrect.

Workaround: Change the code so that the function parameters are named.
For example, change
 void f(a, b, c);
to
 void f(a arg1, b arg2, c arg3);
Since parameter names are optional in function declarations, this will not affect the meaning of the code.

17848

The Typename keyword is not supported.

19170

AutoSynch does not remove the data member in the header file when removing its corresponding attribute in the Rose class.

19210

When AutoSynch is enabled, adding an operation to the class produces the correct declaration of the operation, but the operation body is also defined in the header file instead of in the .cpp file as one would expect.

19309

Rose is unable to browse the .cpp file with the editor after generating code and then reverse engineering.

21101

Converting from Classic C++ fails if a class is assigned to C++ Package Body and Specification components.

26191

Rose may crash when ANSI C++ reverse engineering is performed, using the following scenario:
  1. Start a new Rose (ANSI C++) model

  2. Create a class named "test"

  3. Create a component and assigned "test" to the component

  4. Mouse right click on the component and select ANSI C++ -> Open ANSI C++ Specification

  5. Enter the path for "Code generation root directory:" and click OK to exit

  6. Mouse right click on the component and select ANSI C++ -> Generate Code

  7. Start a new Rose (ANSI C++) model

  8. Create a component select ANSI C++ -> Open ANSI C++ Specification

  9. Click "Add Files" button.

  10. From the "Project Files:" list view window, click on the "..." button.

  11. Use the dialog to locate and select test.h and test.cpp produced earlier.

  12. Click OK to exit ANSI C++ Specification dialog

  13. Mouse right click on the component and select ANSI C++ -> Reverse engineer

  14. Drag and drop reverse engineered "test" class to the diagram. Note that there should no attributes/operations at all.

  15. Open test.h from i-editor and add an operation to test class as follows:

    class test
    {
    myFoo();
    };

  16. Save test.h and mouse right click on the component and select ANSI C++ -> Reverse engineer. Click OK to the class list dialog. Observe that myFoo() operation has been added to the class

  17. Open test.h from i-editor and change myFoo() operation to yourFoo() as follow:

    class test
    {
    yourFoo();
    };

  18. Save test.h and mouse right click on the component and select ANSI C++ -> Reverse engineer.
    Click OK to close the class list dialog.
    Rose may crash at this point.




      

Rational Support

techpubs@rational.com
Copyright © 2001, Rational Software Corporation. All rights reserved.