#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 () |
Perform method resolution and invoke an appropriate method. | |
void | send_oneway () |
Send a oneway request. | |
void | handle_response (TAO_InputCDR &incoming, CORBA::ULong reply_status) |
Callback method for deferred synchronous requests. | |
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 | get_response () |
CORBA::Boolean | poll_response () |
Static Public Member Functions | |
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. | |
CORBA::ULong | refcount_ |
Reference counting. | |
TAO_SYNCH_MUTEX | lock_ |
Protect the refcount_ and 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 67 of file Request.h.
|
|
|
|
|
|
|
Definition at line 64 of file Request.cpp. References ACE_NEW, exceptions_, TAO_Pseudo_Var_T< T >::in(), CORBA::string_dup(), and TAO_ENCAP_BYTE_ORDER.
00072 : target_ (CORBA::Object::_duplicate (obj)), 00073 orb_ (CORBA::ORB::_duplicate (orb)), 00074 opname_ (CORBA::string_dup (op)), 00075 args_ (CORBA::NVList::_duplicate (args)), 00076 result_ (CORBA::NamedValue::_duplicate (result)), 00077 flags_ (flags), 00078 // env_ (env), 00079 exceptions_ (CORBA::ExceptionList::_duplicate (exceptions)), 00080 contexts_ (0), 00081 ctx_ (CORBA::Context::_nil ()), 00082 refcount_ (1), 00083 lazy_evaluation_ (false), 00084 response_received_ (0), 00085 byte_order_ (TAO_ENCAP_BYTE_ORDER) 00086 { 00087 if (this->exceptions_.in () == 0) 00088 { 00089 CORBA::ExceptionList *tmp = 0; 00090 ACE_NEW (tmp, 00091 CORBA::ExceptionList); 00092 00093 this->exceptions_ = tmp; 00094 } 00095 } |
|
Definition at line 97 of file Request.cpp. References ACE_NEW, exceptions_, CORBA::string_dup(), and TAO_ENCAP_BYTE_ORDER.
00101 : target_ (CORBA::Object::_duplicate (obj)), 00102 orb_ (CORBA::ORB::_duplicate (orb)), 00103 opname_ (CORBA::string_dup (op)), 00104 flags_ (0), 00105 // env_ (env), 00106 contexts_ (0), 00107 ctx_ (CORBA::Context::_nil ()), 00108 refcount_ (1), 00109 lazy_evaluation_ (false), 00110 response_received_ (0), 00111 byte_order_ (TAO_ENCAP_BYTE_ORDER) 00112 { 00113 CORBA::ExceptionList *tmp = 0; 00114 ACE_NEW (tmp, 00115 CORBA::ExceptionList); 00116 00117 this->exceptions_ = tmp; 00118 00119 ACE_NEW (this->args_, 00120 CORBA::NVList); 00121 00122 ACE_NEW (this->result_, 00123 CORBA::NamedValue); 00124 } |
|
Definition at line 126 of file Request.cpp. References ACE_ASSERT, and CORBA::string_free().
00127 { 00128 ACE_ASSERT (refcount_ == 0); 00129 00130 ::CORBA::release (this->target_); 00131 CORBA::string_free ((char*) this->opname_); 00132 this->opname_ = 0; 00133 ::CORBA::release (this->args_); 00134 ::CORBA::release (this->result_); 00135 } |
|
Definition at line 42 of file Request.cpp. References ACE_GUARD_RETURN, and TAO_SYNCH_MUTEX.
00043 { 00044 { 00045 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00046 ace_mon, 00047 this->lock_, 00048 0); 00049 00050 this->refcount_--; 00051 00052 if (this->refcount_ != 0) 00053 { 00054 return this->refcount_; 00055 } 00056 } 00057 00058 delete this; 00059 return 0; 00060 } |
|
Pseudo object methods.
|
|
Definition at line 31 of file Request.cpp. References ACE_GUARD_RETURN, and TAO_SYNCH_MUTEX.
00032 { 00033 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00034 ace_mon, 00035 this->lock_, 00036 0); 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 172 of file Request.inl.
00173 { 00174 this->byte_order_ = byte_order; 00175 } |
|
Get the byte order member.
Definition at line 166 of file Request.inl. Referenced by TAO::DII_Deferred_Invocation_Adapter::invoke_twoway(), and TAO::DII_Invocation_Adapter::invoke_twoway().
00167 { 00168 return this->byte_order_; 00169 } |
|
Set the lazy evaluation flag.
Definition at line 160 of file Request.inl.
00161 { 00162 this->lazy_evaluation_ = lazy_evaluation; 00163 } |
|
|
|
Definition at line 94 of file Request.inl. References ACE_DECLARE_NEW_CORBA_ENV, and ACE_ENV_ARG_PARAMETER.
00095 { 00096 ACE_DECLARE_NEW_CORBA_ENV; 00097 return this->args_->add_element (CORBA::ARG_IN ACE_ENV_ARG_PARAMETER)->any_; 00098 } |
|
|
|
Definition at line 108 of file Request.inl. References ACE_DECLARE_NEW_CORBA_ENV, and ACE_ENV_ARG_PARAMETER.
00109 { 00110 ACE_DECLARE_NEW_CORBA_ENV; 00111 return this->args_->add_element (CORBA::ARG_INOUT ACE_ENV_ARG_PARAMETER)->any_; 00112 } |
|
|
|
Definition at line 122 of file Request.inl. References ACE_DECLARE_NEW_CORBA_ENV, and ACE_ENV_ARG_PARAMETER.
00123 { 00124 ACE_DECLARE_NEW_CORBA_ENV; 00125 return this->args_->add_element (CORBA::ARG_OUT ACE_ENV_ARG_PARAMETER)->any_; 00126 } |
|
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 154 of file Request.inl. References ctx_.
00155 { 00156 this->ctx_ = ctx; 00157 } |
|
Accessor for the Context member.
Definition at line 148 of file Request.inl. References ctx_.
00149 { 00150 return this->ctx_; 00151 } |
|
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 275 of file Request.cpp. References ACE_CHECK, ACE_ENV_SINGLE_ARG_PARAMETER, and response_received_.
00276 { 00277 while (!this->response_received_) 00278 { 00279 (void) this->orb_->perform_work (ACE_ENV_SINGLE_ARG_PARAMETER); 00280 ACE_CHECK; 00281 } 00282 00283 if (this->lazy_evaluation_) 00284 { 00285 this->args_->evaluate (ACE_ENV_SINGLE_ARG_PARAMETER); 00286 ACE_CHECK; 00287 } 00288 } |
|
Callback method for deferred synchronous requests.
Definition at line 312 of file Request.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_ERROR, ACE_GUARD, ACE_TEXT, ACE_InputCDR::byte_order(), LM_ERROR, response_received_, 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.
00315 { 00316 // If this request was created by a gateway, then result_ 00317 // and/or args_ are shared by a CORBA::ServerRequest, whose 00318 // reply must be in the same byte order as the reply we are 00319 // handling here. So we set the member to be accessed later. 00320 this->byte_order_ = incoming.byte_order (); 00321 00322 switch (reply_status) 00323 { 00324 case TAO_PLUGGABLE_MESSAGE_NO_EXCEPTION: 00325 if (this->result_ != 0) 00326 { 00327 // We can be sure that the impl is a TAO::Unknown_IDL_Type. 00328 this->result_->value ()->impl ()->_tao_decode (incoming 00329 ACE_ENV_ARG_PARAMETER); 00330 ACE_CHECK; 00331 } 00332 00333 this->args_->_tao_incoming_cdr (incoming, 00334 CORBA::ARG_OUT | CORBA::ARG_INOUT, 00335 this->lazy_evaluation_ 00336 ACE_ENV_ARG_PARAMETER); 00337 ACE_CHECK; 00338 00339 { 00340 ACE_GUARD (TAO_SYNCH_MUTEX, 00341 ace_mon, 00342 this->lock_); 00343 00344 this->response_received_ = 1; 00345 } 00346 00347 break; 00348 case TAO_PLUGGABLE_MESSAGE_USER_EXCEPTION: 00349 case TAO_PLUGGABLE_MESSAGE_SYSTEM_EXCEPTION: 00350 case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD: 00351 case TAO_PLUGGABLE_MESSAGE_LOCATION_FORWARD_PERM: 00352 default: 00353 // @@ (JP) Don't know what to do about any of these yet. 00354 ACE_ERROR ((LM_ERROR, 00355 ACE_TEXT ("(%P|%t) unhandled reply status\n"))); 00356 } 00357 } |
|
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 145 of file Request.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, TAO::NamedValue_Argument::byte_order(), and TAO::Invocation_Adapter::invoke().
00146 { 00147 const CORBA::Boolean argument_flag = 00148 this->args_->_lazy_has_arguments (); 00149 00150 TAO::NamedValue_Argument _tao_retval (this->result_); 00151 00152 00153 TAO::NVList_Argument _tao_in_list (this->args_, 00154 this->lazy_evaluation_); 00155 00156 TAO::Argument *_tao_arg_list [] = { 00157 &_tao_retval, 00158 &_tao_in_list 00159 }; 00160 00161 int number_args = 0; 00162 00163 if (argument_flag) 00164 number_args = 2; 00165 else 00166 number_args = 1; 00167 00168 TAO::DII_Invocation_Adapter _tao_call ( 00169 this->target_, 00170 _tao_arg_list, 00171 number_args, 00172 this->opname_, 00173 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00174 this->exceptions_.in (), 00175 this); 00176 00177 _tao_call.invoke (0, 00178 0 00179 ACE_ENV_ARG_PARAMETER); 00180 ACE_CHECK; 00181 00182 // If this request was created by a gateway, then result_ 00183 // and/or args_ are shared by a CORBA::ServerRequest, whose 00184 // reply must be in the same byte order as the reply we are 00185 // handling here. So we set the member to be accessed later. 00186 this->byte_order_ = _tao_retval.byte_order (); 00187 } |
|
Return the operation name for the request.
Definition at line 51 of file Request.inl.
00052 { 00053 return this->opname_; 00054 } |
|
Definition at line 291 of file Request.cpp. References ACE_CHECK_RETURN, ACE_ENV_ARG_PARAMETER, ACE_GUARD_RETURN, response_received_, and TAO_SYNCH_MUTEX.
00292 { 00293 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00294 ace_mon, 00295 this->lock_, 00296 0); 00297 00298 if (!this->response_received_) 00299 { 00300 // If we're single-threaded, the application could starve the ORB, 00301 // and the response never gets received, so let the ORB do an 00302 // atom of work, if necessary, each time we poll. 00303 ACE_Time_Value tv (0, 0); 00304 (void) this->orb_->perform_work (&tv ACE_ENV_ARG_PARAMETER); 00305 ACE_CHECK_RETURN (0); 00306 } 00307 00308 return this->response_received_; 00309 } |
|
Accessor for the input stream containing the exception.
Definition at line 186 of file Request.inl. References raw_user_exception_.
00187 { 00188 return this->raw_user_exception_; 00189 } |
|
Definition at line 178 of file Request.inl. References ACE_Message_Block::length(), raw_user_exception_, ACE_Message_Block::rd_ptr(), and ACE_InputCDR::start().
00179 { 00180 this->raw_user_exception_.set (cdr.start ()->rd_ptr (), 00181 cdr.start ()->length (), 00182 1); 00183 } |
|
Proprietary method to check whether a response has been received. Definition at line 192 of file Request.inl. References ACE_GUARD_RETURN, response_received_, and TAO_SYNCH_MUTEX.
00193 { 00194 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, 00195 ace_mon, 00196 this->lock_, 00197 0); 00198 00199 return this->response_received_; 00200 } |
|
Return the result for the request.
Definition at line 65 of file Request.inl.
00066 { 00067 return this->result_; 00068 } |
|
Returns reference to Any for extraction using >>=.
Definition at line 142 of file Request.inl.
00143 { 00144 return this->result_->any_; 00145 } |
|
Definition at line 229 of file Request.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, ACE_GUARD, TAO::DII_Deferred_Invocation_Adapter::invoke(), response_received_, and TAO_SYNCH_MUTEX.
00230 { 00231 { 00232 ACE_GUARD (TAO_SYNCH_MUTEX, 00233 ace_mon, 00234 this->lock_); 00235 00236 this->response_received_ = 0; 00237 } 00238 00239 const CORBA::Boolean argument_flag = this->args_->count () ? 1 : 0; 00240 00241 TAO::NamedValue_Argument _tao_retval (this->result_); 00242 00243 TAO::NVList_Argument _tao_in_list (this->args_, 00244 this->lazy_evaluation_); 00245 00246 TAO::Argument *_tao_arg_list [] = { 00247 &_tao_retval, 00248 &_tao_in_list 00249 }; 00250 00251 int number_args = 0; 00252 00253 if (argument_flag) 00254 number_args = 2; 00255 else 00256 number_args = 1; 00257 00258 TAO::DII_Deferred_Invocation_Adapter _tao_call ( 00259 this->target_, 00260 _tao_arg_list, 00261 number_args, 00262 this->opname_, 00263 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00264 0, 00265 this->orb_->orb_core (), 00266 this); 00267 00268 _tao_call.invoke (0, 00269 0 00270 ACE_ENV_ARG_PARAMETER); 00271 ACE_CHECK; 00272 } |
|
Send a oneway request.
Definition at line 190 of file Request.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and TAO::Invocation_Adapter::invoke().
00191 { 00192 const CORBA::Boolean argument_flag = 00193 this->args_->_lazy_has_arguments (); 00194 00195 TAO::NamedValue_Argument _tao_retval (this->result_); 00196 00197 00198 TAO::NVList_Argument _tao_in_list (this->args_, 00199 this->lazy_evaluation_); 00200 00201 TAO::Argument *_tao_arg_list [] = { 00202 &_tao_retval, 00203 &_tao_in_list 00204 }; 00205 00206 int number_args = 0; 00207 00208 if (argument_flag) 00209 number_args = 2; 00210 else 00211 number_args = 1; 00212 00213 TAO::Invocation_Adapter _tao_call ( 00214 this->target_, 00215 _tao_arg_list, 00216 number_args, 00217 this->opname_, 00218 static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 00219 0, 00220 TAO::TAO_ONEWAY_INVOCATION); 00221 00222 _tao_call.invoke (0, 00223 0 00224 ACE_ENV_ARG_PARAMETER); 00225 ACE_CHECK; 00226 } |
|
Initialize the return type.
Definition at line 136 of file Request.inl.
00137 { 00138 this->result_->any_._tao_set_typecode (tc); 00139 } |
|
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 239 of file Request.h. Referenced by contexts(). |
|
Context associated with this request.
Definition at line 242 of file Request.h. Referenced by ctx(). |
|
List of exceptions raised by the operation.
Definition at line 236 of file Request.h. Referenced by exceptions(), and Request(). |
|
Invocation flags.
|
|
If not zero then the NVList is not evaluated by default.
|
|
Protect the refcount_ and 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 261 of file Request.h. Referenced by raw_user_exception(). |
|
Reference counting.
|
|
Set to TRUE upon completion of invoke() or handle_response().
Definition at line 254 of file Request.h. Referenced by get_response(), handle_response(), poll_response(), response_received(), and send_deferred(). |
|
Result of the operation.
|
|
Target object.
|