Chapter 16 Creating CORBA C++ Components


Generating required C++ files

You use Jaguar Manager to generate the C++ files that you need to compile into a DLL or UNIX shared library as well as a class implementation template in which to write method logic. These C++ files include:

"Method call to a C++ component DLL or UNIX shared library" shows the flow of a client method call to a C++ component DLL or UNIX shared library.

  1. The client invokes a method using the proxy or stub appropriate to the type of client ("Client stub/proxy support" explains the different client types). The stub or proxy sends the invocation information over the network to the Jaguar server.
  2. The method skeleton in the method skeletons file unmarshals the call and makes a call to the method implementation in the class implementation template.
  3. After the method executes, the method implementation returns the call to the method skeleton.
  4. The method skeleton marshals the call and sends the call to the client.

Method call to a C++ component DLL or UNIX shared library

The following figure shows the flow of a client method call to a C++ component DLL or UNIX shared library.

Figure 16-1: How C++ component methods are called

Procedure for generating required C++ files

To generate the required C++ files from a package or component, start Jaguar Manager and:

  1. Select the component or, if you want to generate files for all components in a package, select the package.
  2. In the Generate Stubs and Skeletons dialog, select the Generate Skeletons check box.
  3. Configure the skeleton generation options as follows:
  4. In the Generate Stubs and Skeletons dialog, select Generate Stubs.
  5. Select the Generate C++ Stubs option.
  6. Enter a value for the C/C++ Code Base field. This setting specifies the top-level directory path where generated files should be created.
    The rules described for the C/C++ Code Base field under Generate Skeletons applies to this option as well.
  7. You can create Java stub files at this time as well. "Generating Java stubs" describes how to configure the Java stubs options and compile the generated source files.
  8. Click Generate. Jaguar Manager generates files that are appended with .new.
  9. Rename the generated files, deleting .new.

File naming conventions

The generated component files are named as follows:

File type

File name

method skeletons file

package-name_component-name.cpp

class header file

class-name.hpp.new

class implementation template

class-name.cpp.new

stub interface file

package-name.hpp

where:

component-name is the name of the component that you defined in Jaguar Manager.

class-name is the class name that you specified when you created the component.

Jaguar Manager creates the directory structure based on the code base that you specify and the component name, as follows:

code_base/package_name/component_name

where:

code_base is the directory name in the Code Base field in Jaguar Manager. If the Code Base field does not contain a full path name, the directory will be located under the Jaguar installation directory, relative to the html/classes subdirectory.

package-name is the name of the package that contains the component.

component_name is the component name as displayed in Jaguar Manager.

Regenerating changed C++ component methods

When you add or delete methods or modify component method prototypes, you must regenerate the method skeletons and class header files. You must manually add, delete, or modify the methods in the class implementation template. Before you regenerate the method skeletons and class header files, make sure that you have moved your modified class implementation template to another directory or renamed it so the generated class implementation template does not overwrite your existing class implementation template.

 


Copyright © 2000 Sybase, Inc. All rights reserved.