# Idl generator

The Idl code generator is a plug-out directly written in C++.

The generated sources follows the definition made in BOUML at the artifact / class / operation / relation / attribute / extra member levels.

When the code generation is applied on a artifact associated to several classes, the code generation is made for all these classes. Nevertheless the the Idl code generator produce first the code in memory and update the appropriate files only when it is necessary, to not change the last write date of the files for nothing. Depending on the toggle verbose code generation of the global menu Miscellaneous the code generator is verbose or not.

The Idl code generator plug-out may be called on :

- a class : in this case the code generation is in fact applied on the class's artifact, then on all the classes associated to this artifact

- a artifact : in this case the code generation is in fact applied on all the classes associated to the artifact

- a class view : the code generation will be applied on all the sub classes, then on all the artifacts associated to these classes

- a deployment view : the code generation is applied on all the sub artifacts

- a package (may be the project itself) : the code generation will be applied on all the sub class views and deployment views, then on all their sub classes and artifacts.

When the Idl code generator is ask through the Tools menu, it is applied on the project, then on all the artifacts.

The name of the generated files depend on the artifact name, the extension depend on the language and is fixed for each by the generations settings (see below), the directory where the files are generated may be set in each package containing directly or indirectly the artifact (see generation directory).

## artifact

The Idl definition of a artifact is set through the Idl source tabs of the artifact dialog.

The generated file name is the artifact's name with the extension specified in the first Idl tab of the generations settings :

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${NAME} produce the artifact name capitalized, ${Name} produce the artifact name with the first letter capitalized, at least ${name} produce the artifact name without modification.

- ${comment} is replaced by the artifact description adding //

- ${description} is replaced by the artifact description without adding //

- ${includes} is not yet managed by the Idl generator and produce an empty string.

- ${module_start} is replaced by the module xx forms, dependent on the module specifications associated to the BOUML package containing the deployment view where the artifact is defined.

- ${definition} is replaced by the definition of the classes associated to the artifact.

- ${module_end} is replaced by }, dependent on the module specifications associated to the BOUML package containing the deployment view where the artifact is defined.

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the artifact, if not found for the deployment view containing the artifact, if not found in the package containing the deployment view etc ...

## Class

The Idl definition of a class is set through the Uml and Idl tabs of the class dialog.

A Idl type definition may be a valuetype, an interface, a struct, an union, an enum, an exception or a typedef defined through a class, depending on the stereotype and its translation in Idl (see generation settings).

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the class adding //

- ${description} is replaced by the class description without adding //

- ${abstract} only for the valuetypes, produce abstract when the valuetype is abstract

- ${custom} only for the valuetypes, produce abstract when the valuetype is custom

- ${name} is replaced by the class's name

- ${inherit} is replaced by the inheritance

- ${members} is replaced by the code generated for all the class's members (relations, attributes, operations and extra members) following the browser order.

- ${switch} only for the unions, is replaced by the union switch type

- ${items} only for the enums, is replaced by the enum's items definition

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the class, if not found for the container of the class (an other class of a class view) etc ...

## Operation

The Idl definition of an operation is set through the Uml and Idl tabs of the operation dialog.

The indentation of the first line of the declaration/definition give the indentation added to the class definition for all the operation definition.

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the operation adding //

- ${description} is replaced by the operation description without adding //

- ${oneway} produce oneway when the operation is oneway

- ${type} is replaced by the value type (see the UML tab)

- ${name} is replaced by the name of the operation.

- ${(} and ${)} produce ( and ), but there are also a mark for BOUML to find the parameters list

- ${t<n>} and ${p<n>} produce the type and the name of each parameter (count from 0), this allows you to remove a parameter, etc ...

- ${raise} is replaced by the form raise (...) when at least an exception is defined in the UML tab.

- ${raisenl} produce a line break when the operation have exception. In case you do not like this notation, change the generation settings to remove this macro.

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the operation, if not found for the class containing the operation etc ...

## Attribute

The Idl definition of an attribute is set through the Uml and Idl tabs of the attribute dialog.

The indentation of the first line of the definition give the indentation added to the class definition for all the attribute definition.

The definition of an attribute depend on the stereotype of its class.

### interface's attribute

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the attribute adding //

- ${description} is replaced by the attribute description without adding //

- ${readonly} produce readonly when the attribute is read only (see the UML tab)

- ${attribute} produce attribute

- ${type} is replaced by the type of the attribute (see the UML tab)

- ${name} is replaced by the attribute's name (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the attribute, if not found for the class containing the attribute etc ...

### valuetype's attribute

The macros known by the Idl code generator are :

- ${comment} is replaced by the description of the item adding //

- ${description} is replaced by the item description without adding //

- ${visibility} produce the visibility (see the UML tab)

- ${type} is replaced by the type of the attribute (see the UML tab)

- ${name} is replaced by the attribute's name (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the attribute, if not found for the class containing the attribute etc ...

### union's attribute

The macros known by the Idl code generator are :

- ${comment} is replaced by the description of the item adding //

- ${description} is replaced by the item description without adding //

- ${readonly} produce readonly when the attribute is read only (see the UML tab)

- ${case} is replaced by the case associated to the attribute

- ${type} is replaced by the type of the attribute (see the UML tab)

- ${name} is replaced by the attribute's name (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the attribute, if not found for the class containing the attribute etc ...

### enumeration item

The macros known by the Idl code generator are :

- ${comment} is replaced by the description of the item adding //

- ${description} is replaced by the item description without adding //

- ${name} is replaced by the item's name (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the attribute, if not found for the class containing the attribute etc ...

### constant

The macros known by the Idl code generator are :

- ${comment} is replaced by the description of the item adding //

- ${description} is replaced by the item description without adding //

- ${type} is replaced by the type of the attribute (see the UML tab)

- ${name} is replaced by the attribute's name (see the UML tab)

- ${value} is replaced by the initial value of the attribute (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the attribute, if not found for the class containing the attribute etc ...

## Relation

The Idl definition of a relation is set through the Uml and Idl tabs of the relation dialog.

The indentation of the first line of the definition give the indentation added to the class definition for all the relation definition.

### Relation equivalent to an attribute in an interface

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the attribute adding //

- ${description} is replaced by the relation description without adding //

- ${readonly} produce readonly when the relation is read only (see the UML tab)

- ${attribute} produce attribute

- ${type} is replaced by the name of the class pointed by the relation (see the UML tab)

- ${name} is replaced by the role's name (see the UML tab)

- ${stereotype} is replaced by the translation in Idl of the relation's stereotype (see the UML tab)

- ${multiplicity} is replaced by the multiplicity of the relation (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the relation, if not found for the class containing the relation etc ...

### Relation equivalent to an attribute in a valuetype

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the relation adding //

- ${description} is replaced by the relation description without adding //

- ${visibility} produce the visibility (see the UML tab)

- ${type} is replaced by the name of the class pointed by the relation (see the UML tab)

- ${name} is replaced by the role's name (see the UML tab)

- ${stereotype} is replaced by the translation in Idl of the relation's stereotype (see the UML tab)

- ${multiplicity} is replaced by the multiplicity of the relation (see the UML tab)

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the relation, if not found for the class containing the relation etc ...

### Relation equivalent to an attribute in an union

In BOUML the generated code is obtained by the substitution of macros in a text, the macros known by the Idl code generator are :

- ${comment} is replaced by the description of the relation adding //

- ${description} is replaced by the relation description without adding //

- ${readonly} produce readonly when the relation is read only (see the UML tab)

- ${type} is replaced by the name of the class pointed by the relation (see the UML tab)

- ${name} is replaced by the role's name (see the UML tab)

- ${stereotype} is replaced by the translation in Idl of the relation's stereotype (see the UML tab)

- ${multiplicity} is replaced by the multiplicity of the relation (see the UML tab)

- ${case} is replaced by the case associated to the relation

- @{xyz} is replaced by the user property value in case xyz is the key of this property. The property if searched first for the relation, if not found for the class containing the relation etc ...

### Inheritance

The class inheritance are managed at the class level.

## Extra member

The Idl definition of an extra member is set through the Idl tabs of the extra member dialog.

No macros.

Previous : Java catalog

Next : State machine generator