Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Bug_3926_Regression / Client_ORBInitializer.cpp
blobbdbaa9f53a20261653cbf29edcb43245fdaa7b4e
1 // -*- C++ -*-
2 #include "Client_ORBInitializer.h"
4 #if TAO_HAS_INTERCEPTORS == 1
6 #include "Client_Request_Interceptor.h"
8 #include "ace/OS_NS_string.h"
10 void
11 Client_ORBInitializer::pre_init (
12 PortableInterceptor::ORBInitInfo_ptr)
16 void
17 Client_ORBInitializer::post_init (
18 PortableInterceptor::ORBInitInfo_ptr info)
20 CORBA::String_var orb_id = info->orb_id ();
22 CORBA::StringSeq_var args = info->arguments ();
24 CORBA::String_var forward_str;
26 // Extract the last forward reference from the argument list.
27 CORBA::ULong args_len = args->length ();
28 for (CORBA::ULong i = 0; i < args_len; ++i)
29 if (ACE_OS::strcmp ("-k", args[i]) == 0
30 && i < (args_len - 1))
31 forward_str = args[i + 1];
33 PortableInterceptor::ClientRequestInterceptor_ptr interceptor =
34 PortableInterceptor::ClientRequestInterceptor::_nil ();
36 // Install the client request interceptor.
37 ACE_NEW_THROW_EX (interceptor,
38 Client_Request_Interceptor (orb_id.in (),
39 forward_str.in ()),
40 CORBA::NO_MEMORY (
41 CORBA::SystemException::_tao_minor_code (
42 TAO::VMCID,
43 ENOMEM),
44 CORBA::COMPLETED_NO));
46 PortableInterceptor::ClientRequestInterceptor_var
47 client_interceptor = interceptor;
49 info->add_client_request_interceptor (client_interceptor.in ());
52 #endif /* TAO_HAS_INTERCEPTORS == 1 */