#include <Request.h>
Collaboration diagram for CORBA::Request:
Public Types | |
typedef CORBA::Request_ptr | _ptr_type |
typedef CORBA::Request_var | _var_type |
typedef CORBA::Request_out | _out_type |
Public Member Functions | |
CORBA::Object_ptr | target (void) const |
Return the target of this request. | |
const CORBA::Char * | operation (void) const |
Return the operation name for the request. | |
CORBA::NVList_ptr | arguments (void) |
Return the arguments for the request. | |
CORBA::NamedValue_ptr | result (void) |
Return the result for the request. | |
CORBA::ExceptionList_ptr | exceptions (void) |
Return the exceptions resulting from this request. | |
CORBA::Context_ptr | ctx (void) const |
Accessor for the Context member. | |
void | ctx (CORBA::Context_ptr) |
Mutator for the Context member. | |
CORBA::ContextList_ptr | contexts (void) |
void | set_return_type (CORBA::TypeCode_ptr tc) |
Initialize the return type. | |
CORBA::Any & | return_value (void) |
Returns reference to Any for extraction using >>=. | |
void | invoke (void) |
Perform method resolution and invoke an appropriate method. | |
void | send_oneway (void) |
Send a oneway request. | |
void | handle_response (TAO_InputCDR &incoming, CORBA::ULong reply_status) |
Callback method for deferred synchronous requests. | |
void | sendc (CORBA::Object_ptr handler) |
CORBA::ULong | _incr_refcnt (void) |
CORBA::ULong | _decr_refcnt (void) |
void | _tao_lazy_evaluation (bool lazy_evaluation) |
Set the lazy evaluation flag. | |
int | _tao_byte_order (void) const |
Get the byte order member. | |
void | _tao_byte_order (int byte_order) |
Set the byte order member. | |
void | raw_user_exception (TAO_InputCDR &cdr) |
ACE_CString & | raw_user_exception (void) |
Accessor for the input stream containing the exception. | |
CORBA::Boolean | response_received (void) |
Argument manipulation helper functions. | |
Arg adders, one for each type of parameter, with and without optional name. Returns reference to Any for insertion using <<=. | |
CORBA::Any & | add_in_arg (void) |
CORBA::Any & | add_in_arg (const char *name) |
CORBA::Any & | add_inout_arg (void) |
CORBA::Any & | add_inout_arg (const char *name) |
CORBA::Any & | add_out_arg (void) |
CORBA::Any & | add_out_arg (const char *name) |
The 'deferred synchronous' methods. | |
The 'deferred synchronous' methods. | |
void | send_deferred (void) |
void | get_response (void) |
CORBA::Boolean | poll_response (void) |
Static Public Member Functions | |
void | _tao_reply_stub (TAO_InputCDR &_tao_reply_cdr, Messaging::ReplyHandler_ptr _tao_reply_handler, CORBA::ULong reply_status) |
CORBA::Request * | _duplicate (CORBA::Request *) |
Pseudo object methods. | |
CORBA::Request * | _nil (void) |
Private Member Functions | |
Request (CORBA::Object_ptr obj, CORBA::ORB_ptr orb, const CORBA::Char *op, CORBA::NVList_ptr args, CORBA::NamedValue_ptr result, CORBA::Flags flags, CORBA::ExceptionList_ptr exceptions) | |
Request (CORBA::Object_ptr obj, CORBA::ORB_ptr orb, const CORBA::Char *op) | |
~Request (void) | |
Private Attributes | |
CORBA::Object_ptr | target_ |
Target object. | |
CORBA::ORB_var | orb_ |
Pointer to our ORB. | |
const char * | opname_ |
Operation name. | |
CORBA::NVList_ptr | args_ |
Parameter list. | |
CORBA::NamedValue_ptr | result_ |
Result of the operation. | |
CORBA::Flags | flags_ |
Invocation flags. | |
CORBA::ExceptionList_var | exceptions_ |
List of exceptions raised by the operation. | |
CORBA::ContextList_ptr | contexts_ |
List of the request's result's contexts. | |
CORBA::Context_ptr | ctx_ |
Context associated with this request. | |
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > | refcount_ |
Reference counting. | |
TAO_SYNCH_MUTEX | lock_ |
Protect the response_received_. | |
bool | lazy_evaluation_ |
If not zero then the NVList is not evaluated by default. | |
CORBA::Boolean | response_received_ |
Set to true upon completion of invoke() or handle_response(). | |
int | byte_order_ |
Can be reset by a gateway when passing along a request. | |
ACE_CString | raw_user_exception_ |
Friends | |
class | ::TAO_Dynamic_Adapter_Impl |
Provides a way to create requests and populate it with parameters for use in the Dynamic Invocation Interface.
Definition at line 72 of file Request.h.
|
|
|
|
|
|
|
Definition at line 54 of file Request.cpp. References ACE_NEW, exceptions_, TAO_Pseudo_Var_T< T >::in(), CORBA::string_dup(), and TAO_ENCAP_BYTE_ORDER.
00061 : target_ (CORBA::Object::_duplicate (obj)), 00062 orb_ (CORBA::ORB::_duplicate (orb)), 00063 opname_ (CORBA::string_dup (op)), 00064 args_ (CORBA::NVList::_duplicate (args)), 00065 result_ (CORBA::NamedValue::_duplicate (result)), 00066 flags_ (flags), 00067 // env_ (env), 00068 exceptions_ (CORBA::ExceptionList::_duplicate (exceptions)), 00069 contexts_ (0), 00070 ctx_ (CORBA::Context::_nil ()), 00071 refcount_ (1), 00072 lazy_evaluation_ (false), 00073 response_received_ (false), 00074 byte_order_ (TAO_ENCAP_BYTE_ORDER) 00075 { 00076 if (this->exceptions_.in () == 0) 00077 { 00078 CORBA::ExceptionList *tmp = 0; 00079 ACE_NEW (tmp, 00080 CORBA::ExceptionList); 00081 00082 this->exceptions_ = tmp; 00083 } 00084 } |
|
Definition at line 86 of file Request.cpp. References ACE_NEW, exceptions_, CORBA::string_dup(), and TAO_ENCAP_BYTE_ORDER.
00089 : target_ (CORBA::Object::_duplicate (obj)), 00090 orb_ (CORBA::ORB::_duplicate (orb)), 00091 opname_ (CORBA::string_dup (op)), 00092 flags_ (0), 00093 // env_ (env), 00094 contexts_ (0), 00095 ctx_ (CORBA::Context::_nil ()), 00096 refcount_ (1), 00097 lazy_evaluation_ (false), 00098 response_received_ (false), 00099 byte_order_ (TAO_ENCAP_BYTE_ORDER) 00100 { 00101 CORBA::ExceptionList *tmp = 0; 00102 ACE_NEW (tmp, 00103 CORBA::ExceptionList); 00104 00105 this->exceptions_ = tmp; 00106 00107 ACE_NEW (this->args_, 00108 CORBA::NVList); 00109 00110 ACE_NEW (this->result_, 00111 CORBA::NamedValue); 00112 } |
|
Definition at line 114 of file Request.cpp. References ACE_ASSERT, and result_.
|
|
Definition at line 42 of file Request.cpp.
00043 { 00044 CORBA::ULong const new_count = --this->refcount_; 00045 00046 if (new_count == 0) 00047 delete this; 00048 00049 return new_count; 00050 } |
|
Pseudo object methods.
|
|
Definition at line 36 of file Request.cpp.
00037 { 00038 return ++this->refcount_; 00039 } |
|
Definition at line 38 of file Request.inl. Referenced by TAO_Dynamic_Adapter_Impl::request().
00039 {
00040 return 0;
00041 }
|
|
Set the byte order member.
Definition at line 166 of file Request.inl.
00167 { 00168 this->byte_order_ = byte_order; 00169 } |
|
Get the byte order member.
Definition at line 160 of file Request.inl. Referenced by TAO::DII_Deferred_Invocation_Adapter::invoke_twoway(), and TAO::DII_Invocation_Adapter::invoke_twoway().
00161 { 00162 return this->byte_order_; 00163 } |
|
Set the lazy evaluation flag.
Definition at line 154 of file Request.inl.
00155 { 00156 this->lazy_evaluation_ = lazy_evaluation; 00157 } |
|
Definition at line 256 of file Request.cpp. References TAO_DII_Reply_Handler::handle_excep(), and TAO_DII_Reply_Handler::handle_response(). Referenced by TAO_DII_Asynch_Reply_Dispatcher::connection_closed(), TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply(), and sendc().
00259 { 00260 // Retrieve Reply Handler object. 00261 TAO_DII_Reply_Handler* reply_handler = 00262 dynamic_cast<TAO_DII_Reply_Handler*> (rh); 00263 00264 // Exception handling 00265 switch (reply_status) 00266 { 00267 case TAO_AMI_REPLY_OK: 00268 case TAO_AMI_REPLY_NOT_OK: 00269 { 00270 reply_handler->handle_response(_tao_in); 00271 break; 00272 } 00273 case TAO_AMI_REPLY_USER_EXCEPTION: 00274 case TAO_AMI_REPLY_SYSTEM_EXCEPTION: 00275 { 00276 reply_handler->handle_excep (_tao_in, reply_status); 00277 break; 00278 } 00279 } 00280 } |
|
|
|
Definition at line 94 of file Request.inl.
00095 { 00096 return this->args_->add_element (CORBA::ARG_IN)->any_; 00097 } |
|
|
|
Definition at line 106 of file Request.inl.
00107 { 00108 return this->args_->add_element (CORBA::ARG_INOUT)->any_; 00109 } |
|
|
|
Definition at line 118 of file Request.inl.
00119 { 00120 return this->args_->add_element (CORBA::ARG_OUT)->any_; 00121 } |
|
Return the arguments for the request.
Definition at line 58 of file Request.inl.
00059 { 00060 return this->args_; 00061 } |
|
Return a list of the request's result's contexts. Since TAO does not implement Contexts, this will always be 0. Definition at line 79 of file Request.inl. References contexts_.
00080 { 00081 return this->contexts_; 00082 } |
|
Mutator for the Context member.
Definition at line 148 of file Request.inl. References ctx_.
00149 { 00150 this->ctx_ = ctx; 00151 } |
|
Accessor for the Context member.
Definition at line 142 of file Request.inl. References ctx_.
00143 { 00144 return this->ctx_; 00145 } |
|
Return the exceptions resulting from this request.
Definition at line 72 of file Request.inl. References exceptions_, and TAO_Pseudo_Var_T< T >::in().
00073 { 00074 return this->exceptions_.in (); 00075 } |
|
Definition at line 284 of file Request.cpp. References response_received_.
00285 { 00286 while (!this->response_received_) 00287 { 00288 (void) this->orb_->perform_work (); 00289 } 00290 00291 if (this->lazy_evaluation_) 00292 { 00293 this->args_->evaluate (); 00294 } 00295 } |
|
Callback method for deferred synchronous requests.
Definition at line 331 of file Request.cpp. References ACE_ERROR, ACE_GUARD, ACE_TEXT, ACE_InputCDR::byte_order(), LM_ERROR, response_received_, result_, TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD, TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM, TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION, TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION, TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION, and TAO_SYNCH_MUTEX.
00333 { 00334 // If this request was created by a gateway, then result_ 00335 // and/or args_ are shared by a CORBA::ServerRequest, whose 00336 // reply must be in the same byte order as the reply we are 00337 // handling here. So we set the member to be accessed later. 00338 this->byte_order_ = incoming.byte_order (); 00339 00340 switch (reply_status) 00341 { 00342 case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION: 00343 if (this->result_ != 0) 00344 { 00345 // We can be sure that the impl is a TAO::Unknown_IDL_Type. 00346 this->result_->value ()->impl ()->_tao_decode (incoming); 00347 } 00348 00349 this->args_->_tao_incoming_cdr (incoming, 00350 CORBA::ARG_OUT | CORBA::ARG_INOUT, 00351 this->lazy_evaluation_); 00352 00353 { 00354 ACE_GUARD (TAO_SYNCH_MUTEX, 00355 ace_mon, 00356 this->lock_); 00357 00358 this->response_received_ = true; 00359 } 00360 00361 break; 00362 case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION: 00363 case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION: 00364 case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: 00365 case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM: 00366 default: 00367 // @@ (JP) Don't know what to do about any of these yet. 00368 ACE_ERROR ((LM_ERROR, 00369 ACE_TEXT ("(%P|%t) unhandled reply status\n"))); 00370 } 00371 } |
|
Perform method resolution and invoke an appropriate method.
If the method returns successfully, its result is placed in the result argument specified on
Definition at line 133 of file Request.cpp. References TAO::NamedValue_Argument::byte_order(), and TAO::Invocation_Adapter::invoke().
00134 { 00135 TAO::NamedValue_Argument _tao_retval (this->result_); 00136 00137 TAO::NVList_Argument _tao_in_list (this->args_, 00138 this->lazy_evaluation_); 00139 00140 TAO::Argument *_tao_arg_list [] = { 00141 &_tao_retval, 00142 &_tao_in_list 00143 }; 00144 00145 TAO::DII_Invocation_Adapter _tao_call ( 00146 this->target_, 00147 _tao_arg_list, 00148 sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), 00149 this->opname_, 00150 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00151 this->exceptions_.in (), 00152 this); 00153 00154 _tao_call.invoke (0, 0); 00155 00156 // If this request was created by a gateway, then result_ 00157 // and/or args_ are shared by a CORBA::ServerRequest, whose 00158 // reply must be in the same byte order as the reply we are 00159 // handling here. So we set the member to be accessed later. 00160 this->byte_order_ = _tao_retval.byte_order (); 00161 } |
|
Return the operation name for the request.
Definition at line 51 of file Request.inl.
00052 { 00053 return this->opname_; 00054 } |
|
Definition at line 298 of file Request.cpp. References ACE_GUARD_RETURN, response_received(), response_received_, and TAO_SYNCH_MUTEX.
00299 { 00300 CORBA::Boolean response_received = false; 00301 00302 { 00303 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00304 ace_mon, 00305 this->lock_, 00306 false); 00307 response_received = this->response_received_; 00308 } 00309 00310 if (!response_received) 00311 { 00312 // If we're single-threaded, the application could starve the ORB, 00313 // and the response never gets received, so let the ORB do an 00314 // atom of work, if necessary, each time we poll. 00315 ACE_Time_Value tv (0, 0); 00316 (void) this->orb_->perform_work (&tv); 00317 00318 { 00319 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00320 ace_mon, 00321 this->lock_, 00322 false); 00323 response_received = this->response_received_; 00324 } 00325 } 00326 00327 return response_received; 00328 } |
|
Accessor for the input stream containing the exception.
Definition at line 180 of file Request.inl. References raw_user_exception_.
00181 { 00182 return this->raw_user_exception_; 00183 } |
|
Definition at line 172 of file Request.inl. References ACE_Message_Block::length(), raw_user_exception_, ACE_Message_Block::rd_ptr(), and ACE_InputCDR::start().
00173 { 00174 this->raw_user_exception_.set (cdr.start ()->rd_ptr (), 00175 cdr.start ()->length (), 00176 1); 00177 } |
|
Proprietary method to check whether a response has been received. Definition at line 186 of file Request.inl. References ACE_GUARD_RETURN, response_received_, and TAO_SYNCH_MUTEX. Referenced by poll_response().
00187 { 00188 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00189 ace_mon, 00190 this->lock_, 00191 false); 00192 00193 return this->response_received_; 00194 } |
|
Return the result for the request.
Definition at line 65 of file Request.inl. References result_.
00066 { 00067 return this->result_; 00068 } |
|
Returns reference to Any for extraction using >>=.
Definition at line 136 of file Request.inl. References result_.
00137 { 00138 return this->result_->any_; 00139 } |
|
Definition at line 188 of file Request.cpp. References ACE_GUARD, TAO::DII_Deferred_Invocation_Adapter::invoke(), response_received_, and TAO_SYNCH_MUTEX.
00189 { 00190 { 00191 ACE_GUARD (TAO_SYNCH_MUTEX, 00192 ace_mon, 00193 this->lock_); 00194 00195 this->response_received_ = false; 00196 } 00197 CORBA::Boolean const argument_flag = this->args_->count () ? true : false; 00198 00199 TAO::NamedValue_Argument _tao_retval (this->result_); 00200 00201 TAO::NVList_Argument _tao_in_list (this->args_, 00202 this->lazy_evaluation_); 00203 00204 TAO::Argument *_tao_arg_list [] = { 00205 &_tao_retval, 00206 &_tao_in_list 00207 }; 00208 00209 size_t number_args = 0; 00210 00211 if (argument_flag) 00212 number_args = 2; 00213 else 00214 number_args = 1; 00215 00216 TAO::DII_Deferred_Invocation_Adapter _tao_call ( 00217 this->target_, 00218 _tao_arg_list, 00219 number_args, 00220 this->opname_, 00221 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00222 0, 00223 this->orb_->orb_core (), 00224 this); 00225 00226 _tao_call.invoke (0, 0); 00227 } |
|
Send a oneway request.
Definition at line 164 of file Request.cpp. References TAO::Invocation_Adapter::invoke().
00165 { 00166 TAO::NamedValue_Argument _tao_retval (this->result_); 00167 00168 TAO::NVList_Argument _tao_in_list (this->args_, 00169 this->lazy_evaluation_); 00170 00171 TAO::Argument *_tao_arg_list [] = { 00172 &_tao_retval, 00173 &_tao_in_list 00174 }; 00175 00176 TAO::DII_Oneway_Invocation_Adapter _tao_call ( 00177 this->target_, 00178 _tao_arg_list, 00179 sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), 00180 this->opname_, 00181 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00182 TAO::TAO_SYNCHRONOUS_INVOCATION); 00183 00184 _tao_call.invoke (0, 0); 00185 } |
|
The 'asychronous' send method. The object is a DSI based callback handler. This handler must implement Messaging::ReplyHandler Definition at line 231 of file Request.cpp. References _tao_reply_stub().
00232 { 00233 TAO::NamedValue_Argument _tao_retval (this->result_); 00234 00235 TAO::NVList_Argument _tao_in_list (this->args_, 00236 this->lazy_evaluation_); 00237 00238 TAO::Argument *_tao_arg_list [] = { 00239 &_tao_retval, 00240 &_tao_in_list 00241 }; 00242 00243 TAO::Asynch_Invocation_Adapter _tao_call ( 00244 this->target_, 00245 _tao_arg_list, 00246 sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), 00247 const_cast<char *> (this->opname_), 00248 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00249 0); // collocation proxy broker 00250 00251 _tao_call.invoke (dynamic_cast<Messaging::ReplyHandler_ptr>(handler), 00252 &CORBA::Request::_tao_reply_stub); 00253 } |
|
Initialize the return type.
Definition at line 130 of file Request.inl. References result_.
00131 { 00132 this->result_->any_._tao_set_typecode (tc); 00133 } |
|
Return the target of this request.
Definition at line 44 of file Request.inl.
00045 { 00046 return this->target_; 00047 } |
|
|
|
Parameter list.
|
|
Can be reset by a gateway when passing along a request.
|
|
List of the request's result's contexts.
Definition at line 250 of file Request.h. Referenced by contexts(). |
|
Context associated with this request.
Definition at line 253 of file Request.h. Referenced by ctx(). |
|
List of exceptions raised by the operation.
Definition at line 247 of file Request.h. Referenced by exceptions(), and Request(). |
|
Invocation flags.
|
|
If not zero then the NVList is not evaluated by default.
|
|
Protect the response_received_.
|
|
Operation name.
|
|
Pointer to our ORB.
|
|
Stores user exception as a CDR stream when this request is used in a TAO gateway. Definition at line 272 of file Request.h. Referenced by raw_user_exception(). |
|
Reference counting.
|
|
Set to true upon completion of invoke() or handle_response().
Definition at line 265 of file Request.h. Referenced by get_response(), handle_response(), poll_response(), response_received(), and send_deferred(). |
|
Result of the operation.
Definition at line 238 of file Request.h. Referenced by handle_response(), result(), return_value(), set_return_type(), and ~Request(). |
|
Target object.
|