Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / Bug_3582 / Client_ORBInitializer.cpp
blob85d6db42080b515d9e65d9120cfb11a9eb48a9ec
1 // -*- C++ -*-
2 #include "Client_ORBInitializer.h"
4 #if TAO_HAS_INTERCEPTORS == 1
6 #include "Client_Request_Interceptor.h"
7 #include "tao/StringSeqC.h"
8 #include "tao/ORB_Constants.h"
9 #include "ace/OS_NS_string.h"
11 void
12 Client_ORBInitializer::pre_init (
13 PortableInterceptor::ORBInitInfo_ptr)
17 void
18 Client_ORBInitializer::post_init (
19 PortableInterceptor::ORBInitInfo_ptr info)
21 CORBA::String_var orb_id = info->orb_id ();
23 CORBA::StringSeq_var args = info->arguments ();
25 CORBA::String_var forward_str;
27 // Extract the last forward reference from the argument list.
28 CORBA::ULong args_len = args->length ();
29 for (CORBA::ULong i = 0; i < args_len; ++i)
30 if (ACE_OS::strcmp ("-s", args[i]) == 0
31 && i < (args_len - 1))
32 forward_str = args[i + 1];
34 PortableInterceptor::ClientRequestInterceptor_ptr interceptor =
35 PortableInterceptor::ClientRequestInterceptor::_nil ();
37 // Install the client request interceptor.
38 ACE_NEW_THROW_EX (interceptor,
39 Client_Request_Interceptor (orb_id.in (),
40 forward_str.in ()),
41 CORBA::NO_MEMORY (
42 CORBA::SystemException::_tao_minor_code (
43 TAO::VMCID,
44 ENOMEM),
45 CORBA::COMPLETED_NO));
47 PortableInterceptor::ClientRequestInterceptor_var
48 client_interceptor = interceptor;
50 info->add_client_request_interceptor (client_interceptor.in ());
53 #endif /* TAO_HAS_INTERCEPTORS == 1 */