4.6.6 Getting a FactoryFinder Object Reference Using INS
The following code snippet shows an example of how a client application, using INS, gets an object reference to the FactoryFinder object. For a complete code example, see the client application in the University Sample.
// utility to get the registrar
static UniversityW::Registrar_ptr get_registrar(
CORBA::ORB_ptr orb
) {
// Get the factory finder from the ORB:
CORBA::Object_var v_fact_finder_oref =
orb -> resolve_initial_references("FactoryFinder");
// Narrow the factory finder :
Tobj::FactoryFinder_var v_fact_finder_ref =
Tobj::FactoryFinder::_narrow(v_fact_finder_oref.in());
// Use the factory finder to find the
// university's registrar factory :
CORBA::Object_var v_reg_fact_oref =
v_fact_finder_ref -> find_one_factory_by_id(
UniversityW::_tc_RegistrarFactory -> id()
);
// Narrow the registrar factory :
UniversityW::RegistrarFactory_var v_reg_fact_ref =
UniversityW::RegistrarFactory::_narrow(
v_reg_fact_oref.in()
);
// Return the university's registrar :
return v_reg_fact_ref -> find_registrar();
}
Parent topic: Interoperable Naming Service Bootstrapping Mechanism