Generating C/C++ Code from Service Input and Output Parameters
If you know the set of input and output parameters that a C/C++ service will use before you start coding it, you can declare the service’s input/output parameters first and generate C/C++ code from it. The generated code obtains the specified input values from the service’s input signature and assigns them to variables in your service. It also puts the set of output values into the output signature.
You do not have to generate code for all the input and output parameters. You can choose to generate code for only the input parameters, only the output parameters, or you can select one or more input/output parameters for which to generate code.
When Designer generates code from the service input/output parameters, it puts the code on the clipboard. From there, you can paste it into your service and modify it as necessary.
Generating the code from the service input and output parameters is an optional task. It helps save time when you are reusing the input and output parameters of a C/C++ service.
To generate starter code from a C/C++ service’s input/output parameters
1. In the Service Development perspective, open the C/C++ service by double clicking it in the Package Navigator view.
2. If you want to generate code for a subset of the input/output parameters, on the Input/Output tab, select the parameters for which you want to generate code. To select more than one variable, press the CTRL key as you select parameters.
3. Right click in the editor to view the context menu, and select Generate Code.
4. In the Code Generation dialog box, select For implementing this service and click Next.
5. For Specification, select the Input and/or Output check boxes to select the parameters for which you want to generate code.
6. For Which fields? select one of the following:
All fields if you want to generate code for all of the parameters identified by your
Specification selection.
Selected fields if you want to generate code for only the parameters you selected before starting the code generation.
7. Click Finish. Designer generates code and places it on the clipboard.
8. Select the Source tab.
9. Paste the contents of the clipboard into your source code.
10. Save the C/C++ service.