![]() |
|
Use this task to add code to check input parameters to the source file for a CORBA server. This code is used to check the parameters that a user specifies when starting the CORBA server.
This task assumes that the CORBA server is started by the following command:
servantServer server_aliasWhere:
The code checks that the command used to start the CORBA server specifies a string, server_alias, the server alias. During the subsequent server initialization function called when the server starts, the server alias is used to retrieve the server's ImplementationDef; therefore, the string specified must match the server alias predefined in the system Implementation Repository.
This task is one step of the parent task to create the CORBA server main code, as described in Creating a CORBA server main code (server.cpp).
To add code to check the input parameters to the source file for a CORBA server main code, complete the following steps::
void main( int argc, char *argv[] ) { ::CORBA::Object_ptr objPtr; ::CORBA::Status stat; int rc = 0; // Validate the input parameters. if ( argc != 2 ) { cerr << "Usage: servant <server_alias>" << endl; exit( -1 ); } if ( ( rc = perform_initialization( argc, argv ) ) != 0 ) exit( rc ); ... }
Where:
This task adds code to check input parameters to the main method in the source file for a CORBA server.
You need to add code to the server source file for the server initialization function, as described in Creating CORBA server main code (server.cpp), adding code to initialize the server environment.
![]() |