1 #include "ClientInitializer.h"
2 #include "ClientInterceptor.h"
3 #include "MessengerC.h"
6 ClientInitializer::ClientInitializer (void)
8 current_ (PortableInterceptor::Current::_nil())
13 ClientInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr
)
18 ClientInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info
)
20 // resolve Messenger object
21 CORBA::Object_var obj
= info
->resolve_initial_references( "Messenger" );
22 Messenger_var messenger
= Messenger::_narrow( obj
.in() );
23 if( CORBA::is_nil( messenger
.in() ) ) {
24 std::cerr
<< "Not a Messenger reference" << std::endl
;
29 slot_
= info
->allocate_slot_id();
32 CORBA::Object_var current_obj
= info
->resolve_initial_references("PICurrent");
35 PortableInterceptor::Current::_narrow(current_obj
.in());
37 // Create and register the request interceptors.
38 PortableInterceptor::ClientRequestInterceptor_var ci
=
39 new ClientInterceptor(messenger
, current_
.in(), slot_
);
40 info
->add_client_request_interceptor (ci
.in());
44 ClientInitializer::set_slot_data (void)
46 // Set the recursion flag
48 CORBA::Boolean x
= false;
49 flag
<<= CORBA::Any::from_boolean(x
);
50 current_
->set_slot(slot_
, flag
);
52 // Now that we're done with the PICurrent, we will release
53 // our reference to it.
54 current_
= PortableInterceptor::Current::_nil();