=default for generated implementation copy ctor
[ACE_TAO.git] / TAO / tests / Bug_3926_Regression / Client_Request_Interceptor.cpp
blobb47883250ccef8c08aff50cfc7c5bac0106c106f
1 // -*- C++ -*-
2 #include "Client_Request_Interceptor.h"
3 #include "testC.h"
5 #include "ace/Log_Msg.h"
7 Client_Request_Interceptor::Client_Request_Interceptor (
8 const char *orb_id,
9 const char *forward_str)
10 : orb_id_ (CORBA::string_dup (orb_id)),
11 orb_ (),
12 request_count_ (0),
13 forward_str_ (CORBA::string_dup (forward_str))
17 char *
18 Client_Request_Interceptor::name ()
20 return CORBA::string_dup ("Client_Request_Interceptor");
23 void
24 Client_Request_Interceptor::destroy ()
28 void
29 Client_Request_Interceptor::send_request (
30 PortableInterceptor::ClientRequestInfo_ptr ri)
32 ACE_DEBUG ((LM_DEBUG,
33 ACE_TEXT ("CRI: in send_request\n")));
35 ++this->request_count_;
37 CORBA::Boolean response_expected =
38 ri->response_expected ();
40 if (!response_expected) // A one-way request.
41 return;
43 // Request 1 -- non-forwarded
44 // Request 2 -- forwarded by this interception point.
45 // Request 3 -- non-forwarded
47 if (this->request_count_ == 2)
49 if (CORBA::is_nil (this->orb_.in ()))
51 int argc = 0;
52 char **const argv= 0;
53 this->orb_ = CORBA::ORB_init (argc,
54 argv,
55 this->orb_id_.in ());
58 CORBA::Object_var forward =
59 this->orb_->string_to_object (this->forward_str_.in ());
61 CORBA::String_var forward_str =
62 this->orb_->object_to_string (forward.in ());
64 ACE_DEBUG ((LM_DEBUG,
65 ACE_TEXT ("CRI: request %d will be forwarded via send_request()\n"),
66 this->request_count_));
68 // Notice that this is not a permanent forward.
69 throw PortableInterceptor::ForwardRequest (forward.in ());
73 void
74 Client_Request_Interceptor::send_poll (
75 PortableInterceptor::ClientRequestInfo_ptr)
77 ACE_DEBUG ((LM_DEBUG,
78 ACE_TEXT ("CRI: in send_poll\n")));
81 void
82 Client_Request_Interceptor::receive_reply (
83 PortableInterceptor::ClientRequestInfo_ptr)
85 ACE_DEBUG ((LM_DEBUG,
86 ACE_TEXT ("CRI: in receive_reply\n")));
89 void
90 Client_Request_Interceptor::receive_exception (
91 PortableInterceptor::ClientRequestInfo_ptr)
93 ACE_DEBUG ((LM_DEBUG,
94 ACE_TEXT ("CRI: in receive_exception\n")));
97 void
98 Client_Request_Interceptor::receive_other (
99 PortableInterceptor::ClientRequestInfo_ptr ri)
101 ACE_DEBUG ((LM_DEBUG,
102 ACE_TEXT ("CRI: in receive_other\n")));
104 CORBA::Boolean response_expected =
105 ri->response_expected ();
107 // Oneway
108 if (!response_expected)
109 return;
111 PortableInterceptor::ReplyStatus reply_status;
115 ACE_DEBUG ((LM_DEBUG,
116 ACE_TEXT ("CRI: in receive_other, before reply_status\n")));
118 reply_status = ri->reply_status ();
119 ACE_UNUSED_ARG (reply_status);
121 catch(CORBA::BAD_INV_ORDER const &e)
123 e._tao_print_exception ("CRI: exception");
126 ACE_DEBUG ((LM_DEBUG,
127 ACE_TEXT ("CRI: in receive_other, after reply_status\n")));