When generating code for a class, Rational Rose Visual Basic produces a skeletal member function for each user-defined method that is detailed in the Class Specification. You use the following model properties to specify additional details that Rational Rose Visual Basic uses when generating the member functions:
■ AliasName ■ DefaultBody ■ IsStatic ■ LibraryName ■ ProcedureID ■ ReplaceExistingBody
AliasName (Method Property)
TheAliasNameproperty indicates that the procedure being called has another name in the DLL. This is useful when the external procedure name is the same as a Visual Basic reserved word. You can also use an alias when a DLL procedure has the same name as a global variable, or constant, or any other procedure in the same scope. An alias is also useful if any characters in the DLL procedure name are not allowed in Visual Basic names.
TheAliasNameproperty must be a string literal defining a valid alias name of the declared procedure.
The value of theAliasNamemodel property for methods with stereotype Declare can be changed on theDeclaretab of the Model Assistant. It can also be changed on theVisual Basictab in the Method
Specification.
DefaultBody (Method Property)
TheDefaultBodymodel property is a text property that specifies the code and comments to insert into the method body when generating code for this method. If theDefaultBodymodel property is empty, Rational Rose uses the default body defined by the template currently attached to this class. However, ifDefaultBodyis not empty, its contents override the code defined by the template.
Depending on the value of theReplaceExistingBodymodel property, Rational Rose inserts the contents of theDefaultBodyin the method body either the first time or every time the method is generated.
The value of theDefaultBodymodel property for Sub methods, Function methods, and property procedures can be modified on theMethod or
Property Get/Set/Lettab of the Model Assistant. It can also be modified on theVisual Basictab in the Method Specification.
Note: Rose does not check the correctness of the code that you specify in theDefaultBodyproperty.
IsStatic (Method Property)
TheIsStaticproperty specifies if Rational Rose Visual Basic produces the function procedure for a user-defined method with the Static keyword. This indicates that the function procedure's local variables are preserved between calls. TheIsStaticproperty does not affect variables that are declared outside the function procedure, even if they are used in the procedure.
The value of theIsStaticmodel property for Sub methods, Function methods, and property procedures can be modified on theMethod or
Property Get/Set/Lettab of the Model Assistant. It can also be modified on theVisual Basictab in the Method Specification.
The following table summarizes the possible values for theIsStatic property. In this table,resultis the return type of the member function,fnameis the name of the member function, andparamsis the formal parameter list.
Table 33 DefaultBody Model Property Values If ReplaceExistingBody is Result
TRUE Rose always replaces the method body with the contents ofDefaultBodywhen updating the code for this class. IfDefaultBodyis empty, Rose uses the default body defined by the template currently attached to this class.
FALSE (Default) Rose inserts the contents of DefaultBody, but only the first time code is generated for this method. IfDefaultBodyis empty, Rose uses the default body defined by the template currently attached to this class.
LibraryName (Method Property)
TheLibraryNameproperty specifies the name of the DLL that contains the declared method.
The value of theLibraryNamemodel property must be a string literal. It can be modified on theDeclaretab of the Model Assistant and on the
Visual Basictab in the Method Specification.
ProcedureID (Method Property)
TheProcedureIDproperty corresponds to theProcedure IDbox in the
Procedure Attributesdialog box for the method in Microsoft Visual Basic. The value of this model property is set when the method in the model is updated from code.
The value of theProcedureIDmodel property for a method is only available on theVisual Basictab in the Method Specification. Table 34 IsStatic Model Property Values
Value Result
TRUE Rose produces a static Function procedure declaration. For example:
Static Sub fname (params)
Static Function fname (params) As result
FALSE (Default) Rose produces a Function procedure declaration. For example:
Sub fname (params)
Function fname (params) As result
Table 35 ProcedureID Model Property Values Value Corresponds to value
nothing (None)
0 (Default)
-552 AboutBox
ReplaceExistingBody (Method Property)
TheReplaceExistingBodyproperty specifies whether or not to always replace the body of a method with the default body in the model when updating the code for this class. The default body is the contents of the DefaultBodymodel property, or if that model property is empty, the default body is defined by the template currently attached to this class. The value of theReplaceExistingBodymodel property for Sub methods, Function methods, and property procedures can be modified on the
MethodorProperty Get/Set/Lettab of the Model Assistant. It can also be modified on the Visual Basictab in the Method Specification.