BOUML, an UML tool box   version English   version Français



Code generation




Mac OS X


A class is defined with operations, attributes ... but the C++/Java/Php/Python/Idl generator doesn't generate it

First, if you do not have any message in the trace window, this means the Plug-out doing the code generation is not started, perhaps your firewall blocks it, see The plug-out does nothing.

Else, may be the class doesn't have an associated artifact, or the class/artifact is not defined for the target language. Note that a default definition (set through the generation settings) may be done at the creation for each language if you ask for it through the Languages menu.

How to refer to elements from another library ?

In fact this depends on which level of detail you want to have concerning the library you reference.

  1. Supposing you want to use the stl classes like string, it is a priori useless to have its definition and it is useless to have a class string defined in the model.
    In this case a class may have an attribute which type is string but you can't represent this member through a relation because string is not a known class under Bouml. To help and not to have to add manually #include <string> and may be using namespace std; in the artifact definition the better is to define string as an external type through the bottom of the tab C++ [5] of the dialogue generation settings.
  2. If you want to say that string is a class under Bouml to allow to have for instance an attribute which type is string through a relation, but without additional information concerning string, and without having an artifact associated to the class string because you don't want to generate file for string : the better is to define string as an external class.
    For that : create the class string, edit it and in tab C++ set the toggle external, hit the button default definition and if needed change its definition. The first line indicates how the class must be named in the generated code (by default through its UML name), the next lines will be automatically added in the header/source files produced for the classes referencing string. The default external class definition set through the button default definition may be changed through the tab C++ [5] of the dialogue generation settings.
  3. The last way is to really define the class string under Bouml to see its members, for instance in case of a template class like vector to have the list of formals.
    For that you may use a pseudo definition of vector just defining the formals, or a more complete definition depending on what you want to have. The definition of the stl classes may be (partially) obtained doing a reverse on a collection of stl header files, but Bouml can't directly reverse all without error because the pre-process phase it not done in the reverse. To not have this problem the better is to write a source file containing all the #include <?> you will use, to pre-process this file (g++ -E) placing the result in an other file and to reverse this one. However the stl is very verbose and even if you just reverse string you will have almost 600 classes/types and I am sure you are not interested by all :). Note : because these classes are not external you must associated an artifact to them, in this case when you will ask to generate C++ code at the project level these classes will be also generated, to not crash the true files you have to set the directory used to generate the code of the packages containing the classes to a sub dir of a temporary directory (/tmp or c:\temp etc ...)

Of course the solutions above may be followed for library of classes you write yourself.

In the cases (2) and (3) the better is to do the work in a project only dedicated to these classes, this project being a kind of library in the Bouml point of view. Doing that this allows you to import this project as a library.

Last remark : yes, a C++ catalogue like I did for the Java programmers is missing ...

During a reverse I have syntax errors on a valid code

Syntax errors may be detected by the reverse on a valid code in several cases :

To do substitutions on the read files : edit the package where the C++ reverse will be started (perhaps the project itself) to add a user property (through the tab Properties) with the key #file and the value must be the absolute pathname of a file. Each line of the specified file must contain :

Warning : the lines must not contains spaces or tabs.

How to have comments compatible with Doxygen

By default the definition of generated elements contains the keyword ${comment}, this keyword produces the description of the element adding // before.

When you want to fully specify the contain of the generated comments you just have to replace ${comment} by ${description} and the code generator will not add // at the beginning of each line. Of course do the change in the generation settings of the artifact, class, attribute, relation and operation !

When a default value is specified for a static variable there is no "=" inserted.

This is the desired behavior : a variable initialization is not always done by '=', if the variable is a class instance the init form is Type Class::Var(param1, ... paramn).

So, you have two solutions :

How to add #include in the generated code ?

In the artifact, edit it and add the needed #include in the C++ header or source definition, before or after ${includes}.

You can also use the dependencies between classes.

How to add import in the generated code ?

In the artifact, edit it and add the needed import in the top of Java source definition.

The plug-out does nothing

The exchanges between BOUML and each plug-out are supported by a TCP/IP socket. When you ask BOUML to start a plug-out, it search for a free port number starting at 1024 on localhost (, this port is given in argument to the called plug-out. In case you have a firewall it may be necessary to configure it to allow BOUML and the plug-outs to use a socket.

A modification made by a plug-out is not see by the other ones

To reduce the number of exchanges with BOUML and run faster, a plug-out does not ask for BOUML each time you want to get a value. The system classes read and memorize all the data of a given item the first time you access to one of them (with the restrictions allowed by WITHCPP, WITHJAVA, WITHPHP, WITHPYTHON and WITHIDL). This is transparent for you until two plug-outs access to the same data, when one plug-out modify a value already read by the other, the second plug-out does not see the new value until it unload (an operation defined on UmlBaseItem) the object, then ask for the value.

I can't compile a plug-out in Java

Some files implementing base classes of the API contain several classes, this produces error at compile time when you compile a plug-out file by file. To compile a plug-out, compile all the files at the same time doing javac *.java in the directory where the generated files are.

If I edit a note I can't close the window

This is possible using the key escape. I will add ok / cancel buttons !

Error message cannot write in 'H:/.boumlrc' (H: may be an other path)

Some files like '.boumlrc' are saved in your home directory, this message appears when you don't have the write access in this directory (here H). This have no sense, change your home directory to something else of set the write access of your home directory.

BOUML not friendly with multi display setup (2 monitors)

It is not possible to know you have a multiple screen configuration, but this case is managed by Bouml : you just have to define the default screen to use through the entry set environment of the menu miscellaneous.

These limits are taken into account only for the initial size and position of the BOUML's windows and when a dialog is opened, after that you are able to go out of these limits up to the true desktop limits.

Font script support for foreign languages

After editing a description or other part, the font is modified or several characters are replaced by a space

During the edition the characters encoded with a 16 bits unicode character set, but out of the editions the characters are saved on only 8 bits.

When you use non ISO_8859-1 (latin1) characters you must specify which charset must be used (the list depends on the release of Qt) through the entry set environment of the menu miscellaneous.

Warning : it is not possible to use non ISO_8859-1 everywhere, for instance browser element's name must only use ISO_8859-1 characters, refer to the documentation.

If I do a copy/paste of a diagram from Bouml to Word or PPoint under Windows, the result is not pretty

Word and PPoint are responsible of this problem, not Bouml : if you do the paste in paint for instance you will obtain the original picture. To not have a problem with Word and PPoint don't use a copy/paste but save the diagram picture in a file under Bouml and use this file. Under Word you may also use Edit - Paste Special... and select As bitmap.

I change the generation settings but the generated code is unchanged

Changing the generation settings doesn't have impact on the definitions and declarations already existing : let's suppose you have for instance in C++ an attribute which is a pointer (so its definition contains ${type} * ${name}), and you change something in the default definition of the attributes in C++. Hopefully your attribute's definition is unchanged, else you will not be very happy to loose the '*' to follow the new default definition !

To propagate a change to the already existing elements, use the plug-out Global change.

The reverse doesn't make diagrams

This is the expected behavior : I consider a good diagram can't be generated automatically because a good class diagram is not any list of classes placed randomly in a picture.

Anyway, to make the diagram is very easy : create diagram(s) and drag & drop desired classes from the browser to the diagram. By default the relations between classes will be drawned also (depending on the drawing settings).

If you want you can quickly add all the classes defined under a class view to a diagram : create and open the diagram if needed, select the class view in the browser, do a right mouse click inside the diagram and choose add classes from the selected class view.

Note : you may first change the diagram drawing settings for instance to ask to hide operations and/or attributes etc ...

Concurrent use of BOUML

Please, refer to the documentation chapter multi users considerations and probably project synchro, project control or file control.

How to change getter or setter operations's name

If you have an attribute or relation named foo by default the getter and setter operations are named get_foo and set_foo.

If you want to have getFoo, edit the operation, go in the target language tab and replace get_${name} by get${Name}, idem for the setter.

If you want to have get_FOO, edit the operation, go in the target language tab and replace get_${name} by get_${NAME}, idem for the setter.

Problem with Xft and very large font

At least in the pkgsrc system, QT3 has been configured to depend on Xft2.

When QT3 opens a font, the font size is wrong, and the message couldn't open fontconfigs chosen font with Xft is written on the console. To solve this problem you must compile QT3 with the option -no-xft.

How to have object with different states in an activity diagram ?

In fact, when you add an activity object you add a use of this object, this is why editing the object you have access to its state.

So, to show the same objet with different states in an activity diagram you have to duplicate the object and to set the state on each use.

Is it possible to export documentation/diagram in PDF/EPS format ?

Not directly. To produce PDF you can use for instance Pdf Creator from an HTML export. To produce EPS the better is to export images in SVG.

Site map | Author and links | Legal mentions   Valid XHTML 1.0 Transitional Valid CSS!