Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / tests / Portable_Interceptors / PICurrent / ClientORBInitializer.cpp
blobefa8d158819001a758fe308ac1b66d0d31cff008
1 // -*- C++ -*-
2 #include "ClientORBInitializer.h"
3 #include "ClientRequestInterceptor.h"
5 #include "tao/ORB_Constants.h"
7 #include "ace/Log_Msg.h"
9 PortableInterceptor::SlotId slot_id = 2093843211;
11 void
12 ClientORBInitializer::pre_init (
13 PortableInterceptor::ORBInitInfo_ptr /* info */
18 void
19 ClientORBInitializer::post_init (
20 PortableInterceptor::ORBInitInfo_ptr info)
22 CORBA::Object_var obj =
23 info->resolve_initial_references ("PICurrent");
25 PortableInterceptor::Current_var pi_current =
26 PortableInterceptor::Current::_narrow (obj.in ());
28 if (CORBA::is_nil (pi_current.in ()))
30 ACE_ERROR ((LM_ERROR,
31 "(%P|%t) ERROR: Could not resolve PICurrent object.\n"));
33 throw CORBA::INTERNAL ();
36 ::slot_id = info->allocate_slot_id ();
38 PortableInterceptor::ClientRequestInterceptor_ptr foo;
39 ACE_NEW_THROW_EX (foo,
40 ClientRequestInterceptor (::slot_id,
41 pi_current.in ()),
42 CORBA::NO_MEMORY (
43 CORBA::SystemException::_tao_minor_code (
44 TAO::VMCID,
45 ENOMEM),
46 CORBA::COMPLETED_NO));
48 PortableInterceptor::ClientRequestInterceptor_var interceptor =
49 foo;
51 info->add_client_request_interceptor (interceptor.in ());