# Extra member

An extra member is an alien allowing you to specify directly the generated code for each language. This allows to manage non UML items, for instance C++ pre-processor directives, Java attribute initializations etc ...

An extra member is created through the class menu called from the browser :

## Menus

The extra member menu appearing with a right mouse click on its representation in the browser is something like these, supposing it is not read-only nor deleted :

### Menu : edit

edit allows to show/modify the extra member properties. In case the extra member is read-only, the fields of the dialog are also read-only.

#### Extra member dialog, tab Uml

The tab Uml is a global tab, independent of the language :

The name and the stereotype do not have meaning for BOUML.

The description is not used by the code generators.

The editor button visible above and associated here to the description, allows to edit the description in an other window, or to call an external editor (for instance Xcoral) specified through the environment variable BOUML_EDITOR. Note that this external editor have to create an own window, its parameter is the pathname of the file containing the description, its execution is done in parallel with BOUML which looks each second at the file contents to get the new definition until the dialog is closed (I do not like very much this polling but this works even QT isn't compiled with the thread support).

#### Extra member dialog, tab C++

The tab C++ allows to specify the code generated in the header and/or the source file(s), it is visible only if C++ is set through the menu Languages

The declaration part is generated in the definition of the class containing the extra member, except if the inline toggle is set, in this case the generation is made after the class definition as for an inline operation.

The definition part is produced in the source file rather than in the header one.

For instance with :

EM | #ifdef | #endif

and :

The generated code for the class is :

C++ header | C++ source
    class EM {
    #ifdef NEEDED
    // decl

      public:
        void op();

    #endif
    };
    #ifdef NEEDED
    // def
    void EM::op() {
    }

    #endif

In case the extra members and op are inline, all is generated in the header file :

C++ header
    class EM {
    #ifdef NEEDED
    // decl

      public:
        void op();

    #endif
    };

    #ifdef NEEDED
    // def
    inline void EM::op() {
    }

    #endif

#### Extra member dialog, tab Java

The tab Java allows to specify the code generated in Java, it is visible only if Java is set through the menu Languages, for instance with :

EM2 | init

and :

The generated code for EM2 is :

    class EM2 {
      protected Hashtable ht;

      static { H = new Hashtable(); }
    }

#### Extra member dialog, tab Php

The tab Php allows to specify the code generated in Php, it is visible only if Php is set through the menu Languages :

#### Extra member dialog, tab Idl

The tab Idl allows to specify the code generated in Idl, it is visible only if Idl is set through the menu Languages :

### Menu : duplicate

The menu entry duplicate clone the extra member.

### Menu : delete

The menu entry delete is only present when the extra member is not read-only.

Delete the extra member. After that it is possible to undelete it (from the browser) until you close the project : obviously the deleted items are not saved !

### Menu : mark

See mark

### Menu : tools

Appears only when at least one plug-out is associated to the extra member. To apply a plug-out on the extra member.

Previous : operation

Next : class instance