A very important use of the NVList is to pass the argument list for an operation when creating a request. CORBA 1.1 specifies two methods, defined in the ORB class, to build an argument list: create_list and create_operation_list. The IDL prototypes for these methods are as follows:
ORBStatus create_list( in long count, /* # of items */ out NVList new_list ); ORBStatus create_operation_list( in OperationDef oper, out NVList new_list );
The create_list method returns an NVList with the specified number of elements. Each of the elements is empty. It is the client's responsibility to fill the elements in the list with the correct information using the set_item method. Elements in the NVList must contain the arguments in the same order as they were defined for the operation. Elements are numbered from 0 to count-1.
The create_operation_list method returns an NVList initialized with the argument descriptions for a given operation (specified by the OperationDef). The arguments are returned in the same order as they were defined for the operation. The client only needs to fill in the item_value and value_len in the elemens of the NVList.
In addition to these CORBA-defined methods, DSOM provides a third version, defined in the SOMDObject class. The IDL prototype for this method is as follows:
ORBStatus create_request_args( in Identifier operation, out NVList arg_list, out NamedValue result );
Like create_operation_list, the create_request_args method creates the appropriate NVList for the specified operation. In addition, create_request_args initializes the NamedValue that will hold the result with the expected return type. The create_request_args method is defined as a companion to the create_request method, and has the advantage that the InterfaceDef for the operation does not have to be retrieved from the Interface Repository.
Note: The create_request_args method is not defined in CORBA 1.1. Hence, the create_operation_list method, defined on the ORB class, should be used instead when writing portable CORBA-compliant programs.