![]() |
Overview Obtains an object reference to a key service, such as the Naming Service or the Interface Repository. Original class CORBA::ORB Exceptions If the input identifier is not valid, a CORBA::ORB::InvalidName exception is thrown. If another error occurs, a CORBA::SystemException is thrown.
Intended Usage
The CORBA::ORB::resolve_initial_references method is intended to be used by client and server applications to obtain initial object references for accessing key services, such as the Interface Repository or the Naming Service. The caller specifies the identifier of the service for which a reference is needed, then narrows the return result to the proper type. For example, when the input is "InterfaceRepository", the return result should be narrowed to CORBA::Repository. When the input is "NameService", the return result is the root name context of the local naming tree., and should be narrowed to CosNaming::NamingContext (or some class derived from it). Typically an application uses CORBA::ORB::resolve_initial_references to obtain a reference to the root name context, then invokes operations on that reference to obtain all other object references.
IDL Syntax
CORBA::Object_ptr resolve_initial_references (const char* identifier);
Input parameters
- identifier
- The non-NULL identifier of the object reference to be obtained. Valid identifiers are those returned by CORBA::ORB::list_initial_services. The caller retains ownership of this string.
Return values
- CORBA::Object_ptr
- A reference to the requested services. The caller assumes ownership of the returned object reference, and should subsequently release it using CORBA::release.
Example
#include "corba.h" ... /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::ORB::ObjectIdList *oil = op->list_initial_services(); /* pass in the first element of oil as identifier to obtain object reference */ CORBA::Object_ptr optr ; optr = op->resolve_initial_references((*oil)[0]); /* narrow optr appropriately ... */ CORBA::release(optr); ...