Class representing the CORBA ServerRequest pseudo-object. More...
#include <Server_Request.h>
Public Types | |
typedef CORBA::ServerRequest_ptr | _ptr_type |
Useful for template programming. | |
typedef CORBA::ServerRequest_var | _var_type |
typedef CORBA::ServerRequest_out | _out_type |
Public Member Functions | |
ServerRequest (TAO_ServerRequest &orb_server_request) | |
Constructor. | |
~ServerRequest (void) | |
Destructor. | |
void | arguments (CORBA::NVList_ptr &list) |
void | set_result (const CORBA::Any &value) |
void | set_exception (const CORBA::Any &value) |
void | dsi_marshal (void) |
Marshal outgoing parameters. | |
CORBA::Context_ptr | ctx (void) const |
Accessor for the Context member. | |
void | ctx (CORBA::Context_ptr) |
Mutator for the Context member. | |
const char * | operation (void) const |
Get the operation name. | |
CORBA::ULong | _incr_refcnt (void) |
CORBA::ULong | _decr_refcnt (void) |
void | _tao_lazy_evaluation (bool lazy_evaluation) |
Set the lazy evaluation flag. | |
int | _tao_incoming_byte_order (void) const |
Get the byte order of the incoming CDR stream. | |
void | _tao_reply_byte_order (int byte_order) |
Set the byte order of the outgoing CDR stream. | |
TAO_ServerRequest & | _tao_server_request (void) |
Return a reference to the underlying TAO_ServerRequest object. | |
void | gateway_exception_reply (ACE_CString &raw_exception) |
Static Public Member Functions | |
static ServerRequest_ptr | _duplicate (ServerRequest_ptr) |
static ServerRequest_ptr | _nil (void) |
Private Attributes | |
bool | lazy_evaluation_ |
If zero then the NVList is evaluated ASAP. | |
CORBA::Context_ptr | ctx_ |
Context associated with this request. | |
CORBA::NVList_ptr | params_ |
Incoming parameters. | |
CORBA::Any_ptr | retval_ |
Return value. | |
CORBA::Any_ptr | exception_ |
Any exception which might be raised. | |
ACE_Atomic_Op< TAO_SYNCH_MUTEX, unsigned long > | refcount_ |
Reference counting. | |
TAO_ServerRequest & | orb_server_request_ |
Request from the ORB. | |
bool | sent_gateway_exception_ |
Have we sent a user exception obtained from a gateway? |
Class representing the CORBA ServerRequest pseudo-object.
Instantiated by the POA for DSI requests and passed up to the application. Contains a reference to the instance of TAO_ServerRequest that is passed up to the POA from the ORB.
Definition at line 66 of file Server_Request.h.
Definition at line 142 of file Server_Request.h.
Useful for template programming.
Definition at line 140 of file Server_Request.h.
Definition at line 141 of file Server_Request.h.
CORBA::ServerRequest::ServerRequest | ( | TAO_ServerRequest & | orb_server_request | ) |
Constructor.
Definition at line 47 of file Server_Request.cpp.
: lazy_evaluation_ (0), ctx_ (CORBA::Context::_nil ()), params_ (CORBA::NVList::_nil ()), retval_ (0), exception_ (0), refcount_ (1), orb_server_request_ (orb_server_request), sent_gateway_exception_ (false) { this->orb_server_request_.is_dsi (); }
CORBA::ServerRequest::~ServerRequest | ( | void | ) |
Destructor.
Definition at line 60 of file Server_Request.cpp.
{ if (this->params_ != 0) { ::CORBA::release (this->params_); } delete this->retval_; delete this->exception_; }
CORBA::ULong CORBA::ServerRequest::_decr_refcnt | ( | void | ) |
Definition at line 37 of file Server_Request.cpp.
{ CORBA::ULong const new_count = --this->refcount_; if (new_count == 0) delete this; return new_count; }
CORBA::ServerRequest_ptr CORBA::ServerRequest::_duplicate | ( | CORBA::ServerRequest_ptr | x | ) | [static] |
Definition at line 27 of file Server_Request.inl.
{ if (x != 0) { x->_incr_refcnt (); } return x; }
CORBA::ULong CORBA::ServerRequest::_incr_refcnt | ( | void | ) |
Definition at line 31 of file Server_Request.cpp.
{ return ++this->refcount_; }
CORBA::ServerRequest_ptr CORBA::ServerRequest::_nil | ( | void | ) | [static] |
Definition at line 38 of file Server_Request.inl.
{ return static_cast <CORBA::ServerRequest_ptr>(0); }
int CORBA::ServerRequest::_tao_incoming_byte_order | ( | void | ) | const |
Get the byte order of the incoming CDR stream.
Definition at line 68 of file Server_Request.inl.
{ return this->orb_server_request_.incoming ()->byte_order (); }
void CORBA::ServerRequest::_tao_lazy_evaluation | ( | bool | lazy_evaluation | ) |
Set the lazy evaluation flag.
Definition at line 62 of file Server_Request.inl.
{ this->lazy_evaluation_ = lazy_evaluation; }
void CORBA::ServerRequest::_tao_reply_byte_order | ( | int | byte_order | ) |
Set the byte order of the outgoing CDR stream.
Definition at line 74 of file Server_Request.inl.
{ this->orb_server_request_.outgoing ()->reset_byte_order (byte_order); }
TAO_ServerRequest & CORBA::ServerRequest::_tao_server_request | ( | void | ) |
Return a reference to the underlying TAO_ServerRequest object.
Definition at line 81 of file Server_Request.inl.
{ return this->orb_server_request_; }
void CORBA::ServerRequest::arguments | ( | CORBA::NVList_ptr & | list | ) |
Implementation uses this to provide the ORB with the operation's parameter list ... on return, their values are available; the list fed in has typecodes and (perhap) memory assigned.
Definition at line 74 of file Server_Request.cpp.
{ // arguments() must be called before either of these. if (this->params_ != 0 || this->exception_ != 0) { throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO); } // In a collocated situation there will not be an incoming CDR stream // in which case we can get the arguments from the // operation_details using the 'collocated argument converter'. if (this->orb_server_request_.collocated ()) { this->params_ = list; if (this->orb_server_request_.operation_details ()->cac () != 0) { TAO_OutputCDR output; this->orb_server_request_.operation_details ()->cac ( )->dsi_convert_request (this->orb_server_request_, output); TAO_InputCDR input(output); this->params_->_tao_decode (input, CORBA::ARG_IN | CORBA::ARG_INOUT); } } else { // Save params for later use when marshaling the reply. this->params_ = list; this->params_->_tao_incoming_cdr (*this->orb_server_request_.incoming (), CORBA::ARG_IN | CORBA::ARG_INOUT, this->lazy_evaluation_); // Pass this alignment back to the TAO_ServerRequest. this->orb_server_request_.dsi_nvlist_align ( this->params_->_tao_target_alignment ()); } }
CORBA::Context_ptr CORBA::ServerRequest::ctx | ( | void | ) | const |
Accessor for the Context member.
Definition at line 44 of file Server_Request.inl.
{ return this->ctx_; }
void CORBA::ServerRequest::ctx | ( | CORBA::Context_ptr | ctx | ) |
Mutator for the Context member.
Definition at line 50 of file Server_Request.inl.
{ this->ctx_ = ctx; }
void CORBA::ServerRequest::dsi_marshal | ( | void | ) |
Marshal outgoing parameters.
Definition at line 166 of file Server_Request.cpp.
{ // There was a user exception, no need to marshal any parameters. if (this->sent_gateway_exception_) { return; } // In a collocated situation there is no outgoing CDR stream. // So, in case of an exception we just raise the UnknownUserException // and for a regular reply we use the 'collocated argument converter'. if (this->orb_server_request_.collocated ()) { if (this->orb_server_request_.reply_status () == GIOP::USER_EXCEPTION) { throw CORBA::UnknownUserException (*this->exception_); } else if (this->orb_server_request_.operation_details ()->cac () != 0) { TAO_OutputCDR output; // marshal the return value if any if (this->retval_ != 0) { this->retval_->impl ()->marshal_value (output); } // marshal the "inout" and "out" parameters. if (this->params_ != 0) { this->params_->_tao_encode ( output, CORBA::ARG_INOUT | CORBA::ARG_OUT); } TAO_InputCDR input (output); // set reply parameters this->orb_server_request_.operation_details ()->cac ( )->dsi_convert_reply (this->orb_server_request_, input); } } else { if (this->orb_server_request_.reply_status () == GIOP::NO_EXCEPTION) { // In DSI, we can't rely on the skeleton to do this. if (this->retval_ == 0 && this->params_ == 0) { this->orb_server_request_.argument_flag (false); } this->orb_server_request_.init_reply (); // Send the return value, if any. if (this->retval_ != 0) { this->retval_->impl ()->marshal_value ( *this->orb_server_request_.outgoing ()); } // Send the "inout" and "out" parameters. if (this->params_ != 0) { this->params_->_tao_encode ( *this->orb_server_request_.outgoing (), CORBA::ARG_INOUT | CORBA::ARG_OUT); } } else { // This defaults to true, but just to be safe... this->orb_server_request_.argument_flag (true); // Write the reply header to the ORB request's outgoing CDR stream. this->orb_server_request_.init_reply (); this->exception_->impl ()->marshal_value ( *this->orb_server_request_.outgoing ()); } } this->orb_server_request_.tao_send_reply (); }
void CORBA::ServerRequest::gateway_exception_reply | ( | ACE_CString & | raw_exception | ) |
Returns a user exception through a TAO gateway without knowing its type.
Definition at line 251 of file Server_Request.cpp.
{ // This defaults to 1, but just to be safe... this->orb_server_request_.argument_flag (true); // This reply path handles only user exceptions. this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION); this->orb_server_request_.init_reply (); // We know nothing about this exception, so we marshal it as a block // of bytes. The outgoing stream's byte order has already been matched // to the original source of the reply. this->orb_server_request_.outgoing ()->write_octet_array ( reinterpret_cast<const CORBA::Octet *> (raw_exception.fast_rep ()), static_cast<CORBA::ULong> (raw_exception.length () + ACE_CDR::MAX_ALIGNMENT) ); // This will prevent the marshaling of any parameters into this reply. this->sent_gateway_exception_ = true; this->orb_server_request_.tao_send_reply (); }
const char * CORBA::ServerRequest::operation | ( | void | ) | const |
Get the operation name.
Definition at line 56 of file Server_Request.inl.
{ return this->orb_server_request_.operation (); }
void CORBA::ServerRequest::set_exception | ( | const CORBA::Any & | value | ) |
Implementation uses this to provide the exception value which is the only result of this particular invocation.
XXX Implementation should be able to assume response has been sent when this returns, and reclaim memory it allocated.
Definition at line 143 of file Server_Request.cpp.
{ CORBA::TypeCode_var tc = value.type (); CORBA::TCKind const kind = tc->kind (); // set_exception() can be called at any time, but the Any arg MUST // contain an exception. if (kind != CORBA::tk_except) { throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 21, CORBA::COMPLETED_MAYBE); } ACE_NEW_THROW_EX (this->exception_, CORBA::Any (value), CORBA::NO_MEMORY ()); this->orb_server_request_.reply_status (GIOP::USER_EXCEPTION); }
void CORBA::ServerRequest::set_result | ( | const CORBA::Any & | value | ) |
Implementation uses this to provide the operation result ... illegal if exception() was called or params() was not called.
XXX Implementation should be able to assume response has been sent when this returns, and reclaim memory it allocated.
Definition at line 119 of file Server_Request.cpp.
{ // Setting a result when another result already exists or if an exception // exists or before the args have been processeed is an error. if (this->retval_ != 0 || this->exception_ != 0 || this->params_ == 0) { throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 8, CORBA::COMPLETED_NO); } ACE_NEW_THROW_EX (this->retval_, CORBA::Any (value), CORBA::NO_MEMORY ()); }
CORBA::Context_ptr CORBA::ServerRequest::ctx_ [private] |
Context associated with this request.
Definition at line 149 of file Server_Request.h.
Any exception which might be raised.
Definition at line 158 of file Server_Request.h.
bool CORBA::ServerRequest::lazy_evaluation_ [private] |
If zero then the NVList is evaluated ASAP.
Definition at line 146 of file Server_Request.h.
Definition at line 164 of file Server_Request.h.
Incoming parameters.
Definition at line 152 of file Server_Request.h.
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> CORBA::ServerRequest::refcount_ [private] |
Reference counting.
Definition at line 161 of file Server_Request.h.
CORBA::Any_ptr CORBA::ServerRequest::retval_ [private] |
Return value.
Definition at line 155 of file Server_Request.h.
bool CORBA::ServerRequest::sent_gateway_exception_ [private] |
Have we sent a user exception obtained from a gateway?
Definition at line 167 of file Server_Request.h.