#include <Request.h>
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, GIOP::ReplyStatusType 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. | |
void | send_deferred (void) |
void | get_response (void) |
CORBA::Boolean | poll_response (void) |
Static Public Member Functions | |
static void | _tao_reply_stub (TAO_InputCDR &_tao_reply_cdr, Messaging::ReplyHandler_ptr _tao_reply_handler, CORBA::ULong reply_status) |
static CORBA::Request * | _duplicate (CORBA::Request *) |
Pseudo object methods. | |
static 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 73 of file Request.h.
CORBA::Request::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 | |||
) | [private] |
Definition at line 54 of file Request.cpp.
: target_ (CORBA::Object::_duplicate (obj)), orb_ (CORBA::ORB::_duplicate (orb)), opname_ (CORBA::string_dup (op)), args_ (CORBA::NVList::_duplicate (args)), result_ (CORBA::NamedValue::_duplicate (result)), flags_ (flags), // env_ (env), exceptions_ (CORBA::ExceptionList::_duplicate (exceptions)), contexts_ (0), ctx_ (CORBA::Context::_nil ()), refcount_ (1), lazy_evaluation_ (false), response_received_ (false), byte_order_ (TAO_ENCAP_BYTE_ORDER) { if (this->exceptions_.in () == 0) { CORBA::ExceptionList *tmp = 0; ACE_NEW (tmp, CORBA::ExceptionList); this->exceptions_ = tmp; } }
CORBA::Request::Request | ( | CORBA::Object_ptr | obj, | |
CORBA::ORB_ptr | orb, | |||
const CORBA::Char * | op | |||
) | [private] |
Definition at line 86 of file Request.cpp.
: target_ (CORBA::Object::_duplicate (obj)), orb_ (CORBA::ORB::_duplicate (orb)), opname_ (CORBA::string_dup (op)), flags_ (0), // env_ (env), contexts_ (0), ctx_ (CORBA::Context::_nil ()), refcount_ (1), lazy_evaluation_ (false), response_received_ (false), byte_order_ (TAO_ENCAP_BYTE_ORDER) { CORBA::ExceptionList *tmp = 0; ACE_NEW (tmp, CORBA::ExceptionList); this->exceptions_ = tmp; ACE_NEW (this->args_, CORBA::NVList); ACE_NEW (this->result_, CORBA::NamedValue); }
CORBA::Request::~Request | ( | void | ) | [private] |
Definition at line 114 of file Request.cpp.
{ ACE_ASSERT (refcount_ == 0); ::CORBA::release (this->target_); ::CORBA::string_free ((char*) this->opname_); this->opname_ = 0; ::CORBA::release (this->args_); ::CORBA::release (this->result_); }
CORBA::ULong CORBA::Request::_decr_refcnt | ( | void | ) |
Definition at line 42 of file Request.cpp.
{ CORBA::ULong const new_count = --this->refcount_; if (new_count == 0) delete this; return new_count; }
static CORBA::Request* CORBA::Request::_duplicate | ( | CORBA::Request * | ) | [static] |
Pseudo object methods.
CORBA::ULong CORBA::Request::_incr_refcnt | ( | void | ) |
Definition at line 36 of file Request.cpp.
{ return ++this->refcount_; }
CORBA::Request_ptr CORBA::Request::_nil | ( | void | ) | [static] |
Definition at line 38 of file Request.inl.
{
return 0;
}
int CORBA::Request::_tao_byte_order | ( | void | ) | const |
Get the byte order member.
Definition at line 160 of file Request.inl.
{ return this->byte_order_; }
void CORBA::Request::_tao_byte_order | ( | int | byte_order | ) |
Set the byte order member.
Definition at line 166 of file Request.inl.
{ this->byte_order_ = byte_order; }
void CORBA::Request::_tao_lazy_evaluation | ( | bool | lazy_evaluation | ) |
Set the lazy evaluation flag.
Definition at line 154 of file Request.inl.
{ this->lazy_evaluation_ = lazy_evaluation; }
void CORBA::Request::_tao_reply_stub | ( | TAO_InputCDR & | _tao_reply_cdr, | |
Messaging::ReplyHandler_ptr | _tao_reply_handler, | |||
CORBA::ULong | reply_status | |||
) | [static] |
Definition at line 260 of file Request.cpp.
{ // Retrieve Reply Handler object. TAO_DII_Reply_Handler* reply_handler = dynamic_cast<TAO_DII_Reply_Handler*> (rh); // Exception handling switch (reply_status) { case TAO_AMI_REPLY_OK: case TAO_AMI_REPLY_NOT_OK: { reply_handler->handle_response(_tao_in); break; } case TAO_AMI_REPLY_USER_EXCEPTION: case TAO_AMI_REPLY_SYSTEM_EXCEPTION: { reply_handler->handle_excep (_tao_in, reply_status); break; } case TAO_AMI_REPLY_LOCATION_FORWARD: case TAO_AMI_REPLY_LOCATION_FORWARD_PERM: { reply_handler->handle_location_forward (_tao_in, reply_status); break; } } }
CORBA::Any& CORBA::Request::add_in_arg | ( | const char * | name | ) |
CORBA::Any & CORBA::Request::add_in_arg | ( | void | ) |
Definition at line 94 of file Request.inl.
{ return this->args_->add_element (CORBA::ARG_IN)->any_; }
CORBA::Any & CORBA::Request::add_inout_arg | ( | void | ) |
Definition at line 106 of file Request.inl.
{ return this->args_->add_element (CORBA::ARG_INOUT)->any_; }
CORBA::Any& CORBA::Request::add_inout_arg | ( | const char * | name | ) |
CORBA::Any & CORBA::Request::add_out_arg | ( | void | ) |
Definition at line 118 of file Request.inl.
{ return this->args_->add_element (CORBA::ARG_OUT)->any_; }
CORBA::Any& CORBA::Request::add_out_arg | ( | const char * | name | ) |
CORBA::NVList_ptr CORBA::Request::arguments | ( | void | ) |
Return the arguments for the request.
Definition at line 58 of file Request.inl.
{ return this->args_; }
CORBA::ContextList_ptr CORBA::Request::contexts | ( | void | ) |
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.
{ return this->contexts_; }
CORBA::Context_ptr CORBA::Request::ctx | ( | void | ) | const |
void CORBA::Request::ctx | ( | CORBA::Context_ptr | ctx | ) |
CORBA::ExceptionList_ptr CORBA::Request::exceptions | ( | void | ) |
Return the exceptions resulting from this request.
Definition at line 72 of file Request.inl.
{ return this->exceptions_.in (); }
void CORBA::Request::get_response | ( | void | ) |
Definition at line 294 of file Request.cpp.
{ while (!this->response_received_) { (void) this->orb_->perform_work (); } if (this->lazy_evaluation_) { this->args_->evaluate (); } }
void CORBA::Request::handle_response | ( | TAO_InputCDR & | incoming, | |
GIOP::ReplyStatusType | reply_status | |||
) |
Callback method for deferred synchronous requests.
Definition at line 341 of file Request.cpp.
{ // If this request was created by a gateway, then result_ // and/or args_ are shared by a CORBA::ServerRequest, whose // reply must be in the same byte order as the reply we are // handling here. So we set the member to be accessed later. this->byte_order_ = incoming.byte_order (); switch (reply_status) { case GIOP::NO_EXCEPTION: if (this->result_ != 0) { // We can be sure that the impl is a TAO::Unknown_IDL_Type. this->result_->value ()->impl ()->_tao_decode (incoming); } this->args_->_tao_incoming_cdr (incoming, CORBA::ARG_OUT | CORBA::ARG_INOUT, this->lazy_evaluation_); { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); this->response_received_ = true; } break; case GIOP::USER_EXCEPTION: case GIOP::SYSTEM_EXCEPTION: case GIOP::LOCATION_FORWARD: case GIOP::LOCATION_FORWARD_PERM: default: // @@ (JP) Don't know what to do about any of these yet. ACE_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) unhandled reply status\n"))); } }
void CORBA::Request::invoke | ( | void | ) |
Perform method resolution and invoke an appropriate method.
If the method returns successfully, its result is placed in the result argument specified on create_request
. The behavior is undefined if this Request
has already been used with a previous call to invoke>
, send>
, or .
Definition at line 133 of file Request.cpp.
{ TAO::NamedValue_Argument _tao_retval (this->result_); TAO::NVList_Argument _tao_in_list (this->args_, this->lazy_evaluation_); TAO::Argument *_tao_arg_list [] = { &_tao_retval, &_tao_in_list }; TAO::DII_Invocation_Adapter _tao_call ( this->target_, _tao_arg_list, sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), this->opname_, static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), this->exceptions_.in (), this); _tao_call.invoke (0, 0); // If we returned without an exception being thrown the response // (if any) is assumed to be received. this->response_received_ = true; // If this request was created by a gateway, then result_ // and/or args_ are shared by a CORBA::ServerRequest, whose // reply must be in the same byte order as the reply we are // handling here. So we set the member to be accessed later. this->byte_order_ = _tao_retval.byte_order (); }
const CORBA::Char * CORBA::Request::operation | ( | void | ) | const |
Return the operation name for the request.
Definition at line 51 of file Request.inl.
{ return this->opname_; }
CORBA::Boolean CORBA::Request::poll_response | ( | void | ) |
Definition at line 308 of file Request.cpp.
{ CORBA::Boolean response_received = false; { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, false); response_received = this->response_received_; } if (!response_received) { // If we're single-threaded, the application could starve the ORB, // and the response never gets received, so let the ORB do an // atom of work, if necessary, each time we poll. ACE_Time_Value tv (0, 0); (void) this->orb_->perform_work (&tv); { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, false); response_received = this->response_received_; } } return response_received; }
void CORBA::Request::raw_user_exception | ( | TAO_InputCDR & | cdr | ) |
Definition at line 172 of file Request.inl.
ACE_CString & CORBA::Request::raw_user_exception | ( | void | ) |
Accessor for the input stream containing the exception.
Definition at line 180 of file Request.inl.
{ return this->raw_user_exception_; }
CORBA::Boolean CORBA::Request::response_received | ( | void | ) |
Proprietary method to check whether a response has been received.
Definition at line 186 of file Request.inl.
{ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, false); return this->response_received_; }
CORBA::NamedValue_ptr CORBA::Request::result | ( | void | ) |
Return the result for the request.
Definition at line 65 of file Request.inl.
{ return this->result_; }
CORBA::Any & CORBA::Request::return_value | ( | void | ) |
Returns reference to Any for extraction using >>=.
Definition at line 136 of file Request.inl.
void CORBA::Request::send_deferred | ( | void | ) |
Definition at line 192 of file Request.cpp.
{ { ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); this->response_received_ = false; } CORBA::Boolean const argument_flag = this->args_->count () ? true : false; TAO::NamedValue_Argument _tao_retval (this->result_); TAO::NVList_Argument _tao_in_list (this->args_, this->lazy_evaluation_); TAO::Argument *_tao_arg_list [] = { &_tao_retval, &_tao_in_list }; size_t number_args = 0; if (argument_flag) number_args = 2; else number_args = 1; TAO::DII_Deferred_Invocation_Adapter _tao_call ( this->target_, _tao_arg_list, number_args, this->opname_, static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 0, this->orb_->orb_core (), this); _tao_call.invoke (0, 0); }
void CORBA::Request::send_oneway | ( | void | ) |
Send a oneway request.
Definition at line 168 of file Request.cpp.
{ TAO::NamedValue_Argument _tao_retval (this->result_); TAO::NVList_Argument _tao_in_list (this->args_, this->lazy_evaluation_); TAO::Argument *_tao_arg_list [] = { &_tao_retval, &_tao_in_list }; TAO::DII_Oneway_Invocation_Adapter _tao_call ( this->target_, _tao_arg_list, sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), this->opname_, static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), TAO::TAO_SYNCHRONOUS_INVOCATION); _tao_call.invoke (0, 0); }
void CORBA::Request::sendc | ( | CORBA::Object_ptr | handler | ) |
The 'asychronous' send method. The object is a DSI based callback handler. This handler must implement Messaging::ReplyHandler
Definition at line 235 of file Request.cpp.
{ TAO::NamedValue_Argument _tao_retval (this->result_); TAO::NVList_Argument _tao_in_list (this->args_, this->lazy_evaluation_); TAO::Argument *_tao_arg_list [] = { &_tao_retval, &_tao_in_list }; TAO::Asynch_Invocation_Adapter _tao_call ( this->target_, _tao_arg_list, sizeof( _tao_arg_list ) / sizeof( TAO::Argument* ), const_cast<char *> (this->opname_), static_cast<CORBA::ULong> (ACE_OS::strlen (this->opname_)), 0); // collocation proxy broker _tao_call.invoke (dynamic_cast<Messaging::ReplyHandler_ptr>(handler), &CORBA::Request::_tao_reply_stub); }
void CORBA::Request::set_return_type | ( | CORBA::TypeCode_ptr | tc | ) |
Initialize the return type.
Definition at line 130 of file Request.inl.
CORBA::Object_ptr CORBA::Request::target | ( | void | ) | const |
Return the target of this request.
Definition at line 44 of file Request.inl.
{ return this->target_; }
friend class ::TAO_Dynamic_Adapter_Impl [friend] |
CORBA::NVList_ptr CORBA::Request::args_ [private] |
int CORBA::Request::byte_order_ [private] |
CORBA::Context_ptr CORBA::Request::ctx_ [private] |
List of exceptions raised by the operation.
CORBA::Flags CORBA::Request::flags_ [private] |
bool CORBA::Request::lazy_evaluation_ [private] |
TAO_SYNCH_MUTEX CORBA::Request::lock_ [private] |
const char* CORBA::Request::opname_ [private] |
CORBA::ORB_var CORBA::Request::orb_ [private] |
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> CORBA::Request::refcount_ [private] |
Set to true upon completion of invoke() or handle_response().
CORBA::NamedValue_ptr CORBA::Request::result_ [private] |
CORBA::Object_ptr CORBA::Request::target_ [private] |