=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / Bug_3079 / Client_ORBInitializer.cpp
blobb744352dca64e1b9c51e27228a902cf1f58357be
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 first_forward_str;
26 CORBA::String_var second_forward_str;
28 // Extract the last forward reference from the argument list.
29 CORBA::ULong args_len = args->length ();
30 for (CORBA::ULong i = 0; i < args_len; ++i)
32 if (ACE_OS::strcmp ("-f", args[i]) == 0
33 && i < (args_len - 1))
35 first_forward_str = args[i + 1];
37 if (ACE_OS::strcmp ("-s", args[i]) == 0
38 && i < (args_len - 1))
40 second_forward_str = args[i + 1];
44 PortableInterceptor::ClientRequestInterceptor_ptr interceptor =
45 PortableInterceptor::ClientRequestInterceptor::_nil ();
47 // Install the client request interceptor.
48 ACE_NEW_THROW_EX (interceptor,
49 Client_Request_Interceptor (orb_id.in (),
50 first_forward_str.in (),
51 second_forward_str.in ()),
52 CORBA::NO_MEMORY (
53 CORBA::SystemException::_tao_minor_code (
54 TAO::VMCID,
55 ENOMEM),
56 CORBA::COMPLETED_NO));
58 PortableInterceptor::ClientRequestInterceptor_var
59 client_interceptor = interceptor;
61 info->add_client_request_interceptor (client_interceptor.in ());
64 #endif /* TAO_HAS_INTERCEPTORS == 1 */