Adding an Argument to an SWC Method

  1. Open the signature editor for the method.
  2. In the signature editor, go to the Arguments tab.
  3. Do one of the following:

    • Click the Add argument button
    • In the Argument menu, select Add.

    The new argument is added to the Arguments list with its name highlighted for in-place editing.

  4. Name the argument and press <Enter>.
  5. In the Argument Type combo box, select the type of the argument.

    The default argument type is cont.

    Note

    Since ASCET V6.3, composite and complex arguments are always explicit references, even though they are not marked with the overlay icon .

  6. If you selected an array or matrix of enumeration or record type, Closedthe following happens.

    The Choose a enumeration type or Choose a record type window opens.

    • In the "Database"/"Workspace"e field, select the enumeration or record you want to use, then click OK.
  7. To edit the size of an array or matrix argument, Closeddo the following.

    1. Open the Argument menu or the context menu and select Edit Max Size.

      The Max and Variant Size for: <argument> window opens.

    2. In the Max Size x (and Max Size y) field(s), enter the array or matrix size.

    3. To specify a variant size, use the Variant Size x (and Variant Size y) field(s) to select the system constants you want to use as dimension values.

      Both normal and user-defined system constants can be used. The value of a system constant should be in the range 1 ... X (or 1 ... Y).

    4. To specify a variable size, use the Variant Size x (and Variant Size y) field(s) to select *.

      The Max Size x (and Max Size y) field(s) are disabled.

    5. Click OK to close the window and accept your settings.
  8. Enter a unit for the argument in the Unit box.

    The unit is purely descriptive and does not influence the functionality of the class.

  9. Type a comment relating to the argument into the Comment box.

    Every argument or return value can have a comment associated with it. This comment is displayed when documentation for the component is generated.

  10. In the Direction combo box, select a direction for the argument.

    In

    The argument can be read in the method.

    Out

    The argument must be written in the method.

    InOut

    The argument can be read and written in the method.

    See also Directions of Method Arguments.

    If the argument is of type array, matrix, or component, the selection in the Direction combo box also determines Closedinternal access to the referenced element.

Note

If you use matrices as interrunnable variables, make sure that the Number of dimensions for fixed matrixestarget option is set to Two-dimensional.

Otherwise, a warning WMdl653 is issued during AUTOSAR code generation. By default, this warning is promoted to an error.

See also

Editing the Signature of a Runnable or Method

Directions of Method Arguments

Introduction – Variant Size of Arrays and Matrices

Introduction – Variable Size for Arrays and Matrices

Introduction – Explicit References

Introduction – Constants and System Constants

Assigning a Component as an Argument

Reserved Keywords