Before we present these examples, we should sketch what files are generated or written by the programmer in a typical ORBit application. The load of files generated from the IDL specification may seem very complex at a first glance, and the following table tries to make clearer which files are really important. The first file the programmer must write in an ORBit application, is the IDL file. For a f.idl IDL specification, running
bash $orbit-idl-2 --skeleton-impl f.idlwill produce most of the needed files to start writing the application (you can see it as a framework). They are listed in the following table:
|f-stubs.c||do not edit (translation of your IDL)|
|f-skels.c||do not edit (translation of your IDL)|
|f-common.c||do not edit (generated from IDL)|
|f.h||do not edit|
|f-skelimpl.c||add the code of the server methods|
The first three files deal with communication implementation and are automatically generated from your IDL file. The f-skelimpl.c file contains the framework of the servant functions: you should find near the end of the file, function prototypes corresponding to the one you have declared in your IDL, your real code must be inserted between markers. Of course, you should keep this file only on the server side since it is of no use for the client.
The f-client.c (you can choose another name) is to be written by the programmer. This is where the programmer initializes the ORB and binds the client to the server using the IOR.
The f-server.c (you can choose another name) must also be written but this part is rather generic and is usually copied from an existing application and hardly ever modified during the application developpement. It always deals with the ORB initialization and the POA creation so that servants are spawned to execute the server code defined in f-skelimpl.c .