TAO_ClientRequestInfo Class Reference

Implementation of the PortableInterceptor::ClientRequestInfo interface. More...

#include <ClientRequestInfo.h>

Inheritance diagram for TAO_ClientRequestInfo:

Inheritance graph
[legend]
Collaboration diagram for TAO_ClientRequestInfo:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_ClientRequestInfo (TAO::Invocation_Base *invocation)
virtual CORBA::ULong request_id (void)
virtual char * operation (void)
 Return the operation name for the current request.
virtual Dynamic::ParameterList * arguments (void)
 Return the list of arguments passed to the current operation.
virtual Dynamic::ExceptionList * exceptions (void)
virtual Dynamic::ContextList * contexts (void)
virtual Dynamic::RequestContext * operation_context (void)
virtual CORBA::Any * result (void)
virtual CORBA::Boolean response_expected (void)
 Returns true for a two-way operation, and false otherwise.
virtual Messaging::SyncScope sync_scope (void)
virtual PortableInterceptor::ReplyStatus reply_status (void)
 Return the reply status for the current request.
virtual CORBA::Object_ptr forward_reference (void)
virtual CORBA::Any * get_slot (PortableInterceptor::SlotId id)
virtual IOP::ServiceContext * get_request_service_context (IOP::ServiceId id)
virtual IOP::ServiceContext * get_reply_service_context (IOP::ServiceId id)
virtual CORBA::Object_ptr target (void)
virtual CORBA::Object_ptr effective_target (void)
virtual IOP::TaggedProfile * effective_profile (void)
virtual CORBA::Any * received_exception (void)
virtual char * received_exception_id (void)
 Return the repository ID for the received exception.
virtual IOP::TaggedComponent * get_effective_component (IOP::ComponentId id)
virtual IOP::TaggedComponentSeq * get_effective_components (IOP::ComponentId id)
virtual CORBA::Policy_ptr get_request_policy (CORBA::PolicyType type)
virtual void add_request_service_context (const IOP::ServiceContext &service_context, CORBA::Boolean replace)
void tao_ft_expiration_time (TimeBase::TimeT time)
 Set the absolute FT expiration time for this request.
TimeBase::TimeT tao_ft_expiration_time (void) const
 Get the absolute FT expiration time for this request.
void tao_ft_retention_id (CORBA::Long request_id)
 Set the FT request retention ID for this request.
CORBA::Long tao_ft_retention_id (void) const
 Get the FT request retention ID for this request.

Private Member Functions

bool parameter_list (Dynamic::ParameterList &param_list)
bool exception_list (Dynamic::ExceptionList &exception_list)
bool result (CORBA::Any *any)
void check_validity (void)
void setup_picurrent (void)
IOP::ServiceContext * get_service_context_i (TAO_Service_Context &service_context_list, IOP::ServiceId id)
 Helper method to get the request and response service contexts.

Private Attributes

TAO::Invocation_Base * invocation_
 Pointer to the invocation object.
TAO::PICurrent_Impl rs_pi_current_

Detailed Description

Implementation of the PortableInterceptor::ClientRequestInfo interface.

Definition at line 71 of file ClientRequestInfo.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_ClientRequestInfo::TAO_ClientRequestInfo ( TAO::Invocation_Base *  invocation  ) 

Definition at line 32 of file ClientRequestInfo.cpp.

References setup_picurrent().

00033   : invocation_ (inv),
00034     rs_pi_current_ ()
00035 {
00036   this->setup_picurrent ();
00037 }


Member Function Documentation

void TAO_ClientRequestInfo::add_request_service_context ( const IOP::ServiceContext &  service_context,
CORBA::Boolean  replace 
) [virtual]

Add the IOP::ServiceContext to the request (outgoing) IOP::ServiceContextList.

Definition at line 302 of file ClientRequestInfo.cpp.

References check_validity(), CORBA::COMPLETED_NO, invocation_, CORBA::OMGVMCID, and TAO_Service_Context::set_context().

00305 {
00306   this->check_validity ();
00307 
00308   // Get the service context from the list
00309   TAO_Service_Context &service_context_list =
00310     this->invocation_->request_service_context ();
00311 
00312   if (service_context_list.set_context (service_context, replace) == 0)
00313     {
00314       throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 15, CORBA::COMPLETED_NO);
00315     }
00316 }

Dynamic::ParameterList * TAO_ClientRequestInfo::arguments ( void   )  [virtual]

Return the list of arguments passed to the current operation.

Definition at line 411 of file ClientRequestInfo.cpp.

References check_validity(), TAO_RequestInfo_Util::make_parameter_list(), and parameter_list().

00412 {
00413   this->check_validity ();
00414 
00415   // Generate the argument list on demand.
00416   Dynamic::ParameterList *parameter_list =
00417     TAO_RequestInfo_Util::make_parameter_list ();
00418 
00419   Dynamic::ParameterList_var safe_parameter_list = parameter_list;
00420 
00421   if (this->parameter_list (*parameter_list) == false)
00422     throw ::CORBA::MARSHAL ();
00423 
00424   return safe_parameter_list._retn ();
00425 }

void TAO_ClientRequestInfo::check_validity ( void   )  [private]

Check if this ClientRequestInfo object is called within the context of a request.

Definition at line 616 of file ClientRequestInfo.cpp.

References CORBA::COMPLETED_NO, and CORBA::OMGVMCID.

Referenced by add_request_service_context(), arguments(), contexts(), effective_profile(), effective_target(), exceptions(), forward_reference(), get_effective_component(), get_effective_components(), get_reply_service_context(), get_request_policy(), get_request_service_context(), get_slot(), operation(), operation_context(), received_exception(), received_exception_id(), reply_status(), request_id(), response_expected(), result(), sync_scope(), and target().

00617 {
00618   if (this->invocation_ == 0)
00619     throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00620 }

Dynamic::ContextList * TAO_ClientRequestInfo::contexts ( void   )  [virtual]

Definition at line 491 of file ClientRequestInfo.cpp.

References check_validity(), CORBA::COMPLETED_NO, and CORBA::OMGVMCID.

00492 {
00493   this->check_validity ();
00494 
00495   throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00496 }

IOP::TaggedProfile * TAO_ClientRequestInfo::effective_profile ( void   )  [virtual]

Definition at line 100 of file ClientRequestInfo.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, check_validity(), CORBA::COMPLETED_NO, TAO_Profile::create_tagged_profile(), invocation_, CORBA::OMGVMCID, TAO_Stub::profile_in_use(), and TAO::VMCID.

00101 {
00102   this->check_validity ();
00103 
00104   IOP::TaggedProfile *tagged_profile = 0;
00105   ACE_NEW_THROW_EX (tagged_profile,
00106                     IOP::TaggedProfile,
00107                     CORBA::NO_MEMORY (
00108                       CORBA::SystemException::_tao_minor_code (
00109                         TAO::VMCID,
00110                         ENOMEM),
00111                       CORBA::COMPLETED_NO));
00112 
00113   IOP::TaggedProfile_var safe_tagged_profile = tagged_profile;
00114 
00115   TAO_Stub *stub =
00116     this->invocation_->effective_target ()->_stubobj ();
00117 
00118   IOP::TaggedProfile *ep =
00119     stub->profile_in_use ()->create_tagged_profile ();
00120 
00121   if (ep == 0)
00122     {
00123       throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, CORBA::COMPLETED_NO);
00124     }
00125 
00126   // @@BAD_PARAM exception
00127   tagged_profile->tag = ep->tag;
00128   tagged_profile->profile_data = ep->profile_data;  // Deep copy
00129 
00130   return safe_tagged_profile._retn ();
00131 }

CORBA::Object_ptr TAO_ClientRequestInfo::effective_target ( void   )  [virtual]

Return the object reference for the current target. The target may change in the even of a location forward.

Definition at line 92 of file ClientRequestInfo.cpp.

References CORBA::Object::_duplicate(), and check_validity().

00093 {
00094   this->check_validity ();
00095 
00096   return CORBA::Object::_duplicate (this->invocation_->effective_target ());
00097 }

bool TAO_ClientRequestInfo::exception_list ( Dynamic::ExceptionList &  exception_list  )  [private]

Definition at line 469 of file ClientRequestInfo.cpp.

References invocation_, and CORBA::is_nil().

Referenced by exceptions().

00470 {
00471   if (this->invocation_->operation_details ().ex_count ())
00472     {
00473       exception_list.length (this->invocation_->operation_details ().ex_count ());
00474 
00475       for (CORBA::ULong i = 0;
00476            i != this->invocation_->operation_details ().ex_count ();
00477            ++i)
00478         {
00479           CORBA::TypeCode_ptr tcp =
00480             this->invocation_->operation_details ().ex_data ()[i].tc_ptr;
00481           if (!CORBA::is_nil (tcp))
00482             {
00483               exception_list[i] = tcp;
00484             }
00485         }
00486     }
00487   return true;
00488 }

Dynamic::ExceptionList * TAO_ClientRequestInfo::exceptions ( void   )  [virtual]

Return the list of exceptions the current operation is capable of throwing.

Definition at line 453 of file ClientRequestInfo.cpp.

References check_validity(), exception_list(), and TAO_RequestInfo_Util::make_exception_list().

00454 {
00455   this->check_validity ();
00456 
00457   Dynamic::ExceptionList *exception_list =
00458     TAO_RequestInfo_Util::make_exception_list ();
00459 
00460   Dynamic::ExceptionList_var safe_exception_list = exception_list;
00461 
00462   if (this->exception_list (*exception_list) == false)
00463     throw ::CORBA::MARSHAL ();
00464 
00465   return safe_exception_list._retn ();
00466 }

CORBA::Object_ptr TAO_ClientRequestInfo::forward_reference ( void   )  [virtual]

If the reply status is PortableInterceptor::LOCATION_FORWARD or return the object reference to which the request was forwarded.

Definition at line 568 of file ClientRequestInfo.cpp.

References check_validity(), CORBA::COMPLETED_NO, invocation_, and CORBA::OMGVMCID.

00569 {
00570   this->check_validity ();
00571 
00572   if (this->invocation_->pi_reply_status() != PortableInterceptor::LOCATION_FORWARD)
00573     {
00574       throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00575     }
00576 
00577   // TAO::Invocation_Base::forward_reference() already duplicates the
00578   // reference before returning it so there is no need to duplicate it
00579   // here.
00580   return this->invocation_->forwarded_reference ();
00581 }

IOP::TaggedComponent * TAO_ClientRequestInfo::get_effective_component ( IOP::ComponentId  id  )  [virtual]

Return the first IOP::TaggedComponent that matches the given IOP::ComponentId in the object reference for the current target.

Definition at line 188 of file ClientRequestInfo.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, check_validity(), CORBA::COMPLETED_NO, TAO_Tagged_Components::components(), invocation_, CORBA::OMGVMCID, TAO_Stub::profile_in_use(), TAO_Profile::tagged_components(), and TAO::VMCID.

00189 {
00190   this->check_validity ();
00191 
00192   TAO_Stub *stub = this->invocation_->effective_target ()->_stubobj ();
00193 
00194   TAO_Tagged_Components &ecs = stub->profile_in_use ()->tagged_components ();
00195 
00196   IOP::MultipleComponentProfile &components = ecs.components ();
00197 
00198   CORBA::ULong const len = components.length ();
00199   for (CORBA::ULong i = 0; i < len; ++i)
00200     {
00201       if (components[i].tag == id)
00202         {
00203           IOP::TaggedComponent *tagged_component = 0;
00204 
00205           // Only allocate a sequence if we have a tagged component
00206           // that matches the given IOP::ComponentId.
00207           ACE_NEW_THROW_EX (tagged_component,
00208                             IOP::TaggedComponent,
00209                             CORBA::NO_MEMORY (
00210                               CORBA::SystemException::_tao_minor_code (
00211                                 TAO::VMCID,
00212                                 ENOMEM),
00213                               CORBA::COMPLETED_NO));
00214 
00215           IOP::TaggedComponent_var safe_tagged_component =
00216             tagged_component;
00217 
00218           (*tagged_component) = components[i];  // Deep copy
00219 
00220           return safe_tagged_component._retn ();
00221         }
00222     }
00223 
00224   // No tagged component was found that matched the given
00225   // IOP::ComponentId.
00226   throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, CORBA::COMPLETED_NO);
00227 }

IOP::TaggedComponentSeq * TAO_ClientRequestInfo::get_effective_components ( IOP::ComponentId  id  )  [virtual]

Return all IOP::TaggedComponent(s) that match the given IOP::ComponentId in the object reference for the current target.

Definition at line 230 of file ClientRequestInfo.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, check_validity(), CORBA::COMPLETED_NO, TAO_Tagged_Components::components(), invocation_, CORBA::OMGVMCID, TAO_Stub::profile_in_use(), TAO_Profile::tagged_components(), and TAO::VMCID.

00231 {
00232   this->check_validity ();
00233 
00234   TAO_Stub *stub = this->invocation_->target ()->_stubobj ();
00235 
00236   TAO_Tagged_Components &ecs = stub->profile_in_use ()->tagged_components ();
00237 
00238   IOP::MultipleComponentProfile &components = ecs.components ();
00239 
00240   IOP::TaggedComponentSeq *tagged_components = 0;
00241   IOP::TaggedComponentSeq_var safe_tagged_components;
00242 
00243   const CORBA::ULong len = components.length ();
00244   for (CORBA::ULong i = 0; i < len; ++i)
00245     {
00246       if (components[i].tag == id)
00247         {
00248           if (tagged_components == 0)
00249             {
00250               // Only allocate a sequence if we have tagged components
00251               // to place into the sequence.
00252               ACE_NEW_THROW_EX (tagged_components,
00253                                 IOP::TaggedComponentSeq,
00254                                 CORBA::NO_MEMORY (
00255                                   CORBA::SystemException::_tao_minor_code (
00256                                     TAO::VMCID,
00257                                     ENOMEM),
00258                                   CORBA::COMPLETED_NO));
00259 
00260               safe_tagged_components = tagged_components;
00261             }
00262 
00263           const CORBA::ULong old_len = safe_tagged_components->length ();
00264           safe_tagged_components->length (old_len + 1);
00265 
00266           safe_tagged_components[old_len] = components[i];  // Deep copy
00267         }
00268     }
00269 
00270   if (tagged_components == 0)
00271     {
00272       // No tagged component sequence was allocated, meaning no tagged
00273       // components were found that matched the given
00274       // IOP::ComponentId.
00275       throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, CORBA::COMPLETED_NO);
00276     }
00277 
00278   return safe_tagged_components._retn ();
00279 }

IOP::ServiceContext * TAO_ClientRequestInfo::get_reply_service_context ( IOP::ServiceId  id  )  [virtual]

Return the IOP::ServiceContext with the given IOP::ServiceId from the reply service context list.

Definition at line 604 of file ClientRequestInfo.cpp.

References check_validity(), get_service_context_i(), and invocation_.

00605 {
00606   this->check_validity ();
00607 
00608   // Get the service context from the list
00609   TAO_Service_Context &service_context_list =
00610     this->invocation_->reply_service_context ();
00611 
00612   return this->get_service_context_i (service_context_list, id);
00613 }

CORBA::Policy_ptr TAO_ClientRequestInfo::get_request_policy ( CORBA::PolicyType  type  )  [virtual]

Return the policy of the given type in effect for the current request.

Definition at line 282 of file ClientRequestInfo.cpp.

References CORBA::SystemException::_tao_minor_code(), check_validity(), CORBA::COMPLETED_NO, ENOTSUP, invocation_, and TAO::VMCID.

00283 {
00284   this->check_validity ();
00285 
00286   // @@ Do we need to look anywhere else for the request policies?
00287 
00288 #if TAO_HAS_CORBA_MESSAGING == 1
00289   return this->invocation_->target ()->_get_policy (type);
00290 #else
00291   ACE_UNUSED_ARG (type);
00292 
00293   throw ::CORBA::NO_IMPLEMENT (
00294     CORBA::SystemException::_tao_minor_code (
00295       TAO::VMCID,
00296       ENOTSUP),
00297     CORBA::COMPLETED_NO);
00298 #endif  /* TAO_HAS_CORBA_MESSAGING == 1 */
00299 }

IOP::ServiceContext * TAO_ClientRequestInfo::get_request_service_context ( IOP::ServiceId  id  )  [virtual]

Return the IOP::ServiceContext with the given IOP::ServiceId from the request service context list.

Definition at line 592 of file ClientRequestInfo.cpp.

References check_validity(), get_service_context_i(), and invocation_.

00593 {
00594   this->check_validity ();
00595 
00596   // Get the service context from the list
00597   TAO_Service_Context &service_context_list =
00598     this->invocation_->request_service_context ();
00599 
00600   return this->get_service_context_i (service_context_list, id);
00601 }

IOP::ServiceContext * TAO_ClientRequestInfo::get_service_context_i ( TAO_Service_Context service_context_list,
IOP::ServiceId  id 
) [private]

Helper method to get the request and response service contexts.

Definition at line 65 of file ClientRequestInfo.cpp.

References CORBA::COMPLETED_NO, TAO_Service_Context::get_context(), and CORBA::OMGVMCID.

Referenced by get_reply_service_context(), and get_request_service_context().

00068 {
00069   IOP::ServiceContext_var service_context;
00070 
00071   if (service_context_list.get_context (id, service_context.out ()) != 0)
00072     {
00073       // Found.
00074       return service_context._retn ();
00075     }
00076   else
00077     {
00078       // Not found.
00079       throw ::CORBA::BAD_PARAM (CORBA::OMGVMCID | 26, CORBA::COMPLETED_NO);
00080     }
00081 }

CORBA::Any * TAO_ClientRequestInfo::get_slot ( PortableInterceptor::SlotId  id  )  [virtual]

Definition at line 584 of file ClientRequestInfo.cpp.

References check_validity(), and rs_pi_current_.

00585 {
00586   this->check_validity ();
00587 
00588   return this->rs_pi_current_.get_slot (id);
00589 }

char * TAO_ClientRequestInfo::operation ( void   )  [virtual]

Return the operation name for the current request.

Definition at line 403 of file ClientRequestInfo.cpp.

References check_validity(), and CORBA::string_dup().

00404 {
00405   this->check_validity ();
00406 
00407   return CORBA::string_dup (this->invocation_->operation_details ().opname  ());
00408 }

Dynamic::RequestContext * TAO_ClientRequestInfo::operation_context ( void   )  [virtual]

Definition at line 499 of file ClientRequestInfo.cpp.

References check_validity(), CORBA::COMPLETED_NO, and CORBA::OMGVMCID.

00500 {
00501   this->check_validity ();
00502 
00503   throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00504 }

bool TAO_ClientRequestInfo::parameter_list ( Dynamic::ParameterList &  param_list  )  [private]

Definition at line 428 of file ClientRequestInfo.cpp.

References invocation_, and TAO::TAO_INVOKE_START.

Referenced by arguments().

00429 {
00430   // Account for the return type that is in the argument list.
00431   param_list.length (this->invocation_->operation_details ().args_num () - 1);
00432 
00433   for (CORBA::ULong i = 1; i != this->invocation_->operation_details ().args_num (); ++i)
00434     {
00435       TAO::Argument *argument =
00436         this->invocation_->operation_details ().args ()[i];
00437       Dynamic::Parameter &p = param_list[i - 1];
00438       p.mode = argument->mode ();
00439       // When we are in send_request and have an out argument, then
00440       // don't copy it, just let the any be empty with typecode tk_null
00441       if ((this->invocation_->invoke_status () != TAO::TAO_INVOKE_START) ||
00442           (this->invocation_->invoke_status () == TAO::TAO_INVOKE_START &&
00443            argument->mode () != CORBA::PARAM_OUT))
00444         {
00445           argument->interceptor_value (&p.argument);
00446         }
00447     }
00448 
00449   return true;
00450 }

CORBA::Any * TAO_ClientRequestInfo::received_exception ( void   )  [virtual]

Note:
There is no trivial way to extract the exception from an Any.

Definition at line 137 of file ClientRequestInfo.cpp.

References CORBA::SystemException::_tao_minor_code(), ACE_NEW_THROW_EX, check_validity(), CORBA::COMPLETED_NO, invocation_, CORBA::OMGVMCID, SYSTEM_EXCEPTION, USER_EXCEPTION, and TAO::VMCID.

00138 {
00139   this->check_validity ();
00140 
00141   if (this->invocation_->pi_reply_status () != PortableInterceptor::SYSTEM_EXCEPTION
00142       && this->invocation_->pi_reply_status () != PortableInterceptor::USER_EXCEPTION)
00143     {
00144       throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00145     }
00146 
00147   // The spec says that if it is a user exception which can't be
00148   // inserted then the UNKNOWN exception needs to be thrown with minor
00149   // code 1.
00150 
00151   CORBA::Any * temp = 0;
00152 
00153   ACE_NEW_THROW_EX (temp,
00154                     CORBA::Any,
00155                     CORBA::NO_MEMORY (
00156                       CORBA::SystemException::_tao_minor_code (
00157                         TAO::VMCID,
00158                         ENOMEM),
00159                       CORBA::COMPLETED_NO));
00160 
00161   CORBA::Any_var caught_exception_var = temp;
00162 
00163   CORBA::Exception *caught_exception =
00164     invocation_->caught_exception ();
00165 
00166   if (caught_exception != 0)
00167     *temp <<= *(caught_exception);
00168 
00169   return caught_exception_var._retn ();
00170 }

char * TAO_ClientRequestInfo::received_exception_id ( void   )  [virtual]

Return the repository ID for the received exception.

Definition at line 173 of file ClientRequestInfo.cpp.

References CORBA::Exception::_rep_id(), check_validity(), CORBA::COMPLETED_NO, invocation_, CORBA::OMGVMCID, and CORBA::string_dup().

00174 {
00175   this->check_validity ();
00176 
00177   CORBA::Exception *caught_exception = invocation_->caught_exception ();
00178 
00179   if (caught_exception == 0)
00180     {
00181       throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00182     }
00183 
00184   return CORBA::string_dup (caught_exception->_rep_id ());
00185 }

PortableInterceptor::ReplyStatus TAO_ClientRequestInfo::reply_status ( void   )  [virtual]

Return the reply status for the current request.

Statuses can be PortableInterceptor::SUCCESSFUL, SYSTEM_EXCEPTION, USER_EXCEPTION, LOCATION_FORWARD, TRANSPORT_RETRY, UNKNOWN.

Definition at line 552 of file ClientRequestInfo.cpp.

References check_validity(), CORBA::COMPLETED_NO, invocation_, and CORBA::OMGVMCID.

00553 {
00554   this->check_validity ();
00555 
00556   PortableInterceptor::ReplyStatus const status =
00557     this->invocation_->pi_reply_status();
00558   if (status == -1 || status == PortableInterceptor::UNKNOWN)
00559     {
00560       // A reply hasn't been received yet.
00561       throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 14, CORBA::COMPLETED_NO);
00562     }
00563 
00564   return status;
00565 }

CORBA::ULong TAO_ClientRequestInfo::request_id ( void   )  [virtual]

Return an ID unique to the current request. This request ID may or may not be the same as the GIOP request ID.

Definition at line 319 of file ClientRequestInfo.cpp.

References ACE_ERROR, check_validity(), invocation_, LM_ERROR, and TAO_debug_level.

00320 {
00321   this->check_validity ();
00322 
00323   // @todo We may have to worry about AMI once we support interceptors
00324   //       in AMI requests since the Invocation object no longer
00325   //       exists once an AMI request has been made.  In that case,
00326   //       the reply dispatcher address should be used.
00327 
00328   // The request ID must be unique across all outstanding requests.
00329   // To avoid synchronization overhead, the address of this Invocation
00330   // object is used as the request ID.  This guarantees that the
00331   // request ID is unique without being forced to acquire a lock.
00332   //
00333   // For 64-bit platforms, we right shift 8 bits and then use the
00334   // lower 32 bits of that shifted value.  Rather than losing the
00335   // upper 32 bits of significant digits by taking the lower 32 bits,
00336   // we only lose the upper 24 by doing the shift.  Basically, the
00337   // resulting request ID will comprised of bits 8 through 39.  This is
00338   // made possible by the fact that this Invocation object is large
00339   // enough to increase the likelihood that those bits (0 through 39)
00340   // are unique.  In particular, this->buffer_ is 512 bytes
00341   // (ACE_CDR::DEFAULT_BUFSIZE) long by default; implying that
00342   // dropping the lower 8 bits of the this Invocation object's 64 bit
00343   // address (i.e. 256 bytes) is not a problem.
00344 
00345   CORBA::ULong id = 0;
00346 
00347   // Note that we reinterpret_cast to an "unsigned long" instead of
00348   // CORBA::ULong since we need to first cast to an integer large
00349   // enough to hold an address to avoid compile-time warnings on some
00350   // 64-bit platforms.
00351 
00352   // 32 bit address
00353   if (sizeof (this) == 4)
00354     id =
00355       static_cast<CORBA::ULong> (
00356         reinterpret_cast<ptrdiff_t> (this->invocation_));
00357 
00358   // 64 bit address -- bits 8 through 39  (see notes above!)
00359   // In this case, we make sure this object is large enough to safely
00360   // do the right shift.  This is necessary since the size of the
00361   // buffer that makes this object is configurable.
00362   else if (sizeof (this) == 8
00363            && sizeof (*(this->invocation_)) > 256 /* 2 << 8 */)
00364     id =
00365       (static_cast<CORBA::ULong> (
00366          reinterpret_cast<ptrdiff_t> (this->invocation_)) >> 8) & 0xFFFFFFFFu;
00367 
00368   // 64 bit address -- lower 32 bits
00369   else if (sizeof (this) == 8)
00370     id =
00371       static_cast<CORBA::ULong> (
00372         reinterpret_cast<ptrdiff_t> (this->invocation_)) & 0xFFFFFFFFu;
00373 
00374   // @@ The following request ID generator prevents the
00375   //    PortableInterceptor::ClientRequestInterceptor::send_request()
00376   //    interception point from occuring before the call to connect,
00377   //    thus preventing us from adding an optimization that itself
00378   //    prevents a connection from being unnecessarily performed.
00379   //    Thus, the ClientRequestInfo object is forced to have its own
00380   //    request ID generator in order to make it possible to implement
00381   //    the above optimization.
00382   //
00383   //    Ideally, this request ID generator should go away, especially
00384   //    since it adds a lock to the critical path.
00385   //   else    // Fallback
00386   //     id = this->invocation_->request_id ();
00387 
00388   else
00389     {
00390       if (TAO_debug_level > 0)
00391         ACE_ERROR ((LM_ERROR,
00392                     "(%P|%t) ClientRequestInfo::request_id() failed\n"
00393                     "(%P|%t) since its request ID generator is not\n"
00394                     "(%P|%t) supported on this platform.\n"));
00395 
00396       throw ::CORBA::INTERNAL ();
00397     }
00398 
00399   return id;
00400 }

CORBA::Boolean TAO_ClientRequestInfo::response_expected ( void   )  [virtual]

Returns true for a two-way operation, and false otherwise.

Definition at line 536 of file ClientRequestInfo.cpp.

References check_validity(), and invocation_.

00537 {
00538   this->check_validity ();
00539 
00540   return this->invocation_->response_expected ();
00541 }

bool TAO_ClientRequestInfo::result ( CORBA::Any *  any  )  [private]

Definition at line 525 of file ClientRequestInfo.cpp.

References invocation_.

00526 {
00527   // Result is always first element in TAO::Argument array.
00528   TAO::Argument * const r = this->invocation_->operation_details ().args ()[0];
00529 
00530   r->interceptor_value (any);
00531 
00532   return true;
00533 }

CORBA::Any * TAO_ClientRequestInfo::result ( void   )  [virtual]

Return the result of the current request. If there is no return value then an Any with tk_void TypeCode is returned. This is method is not valid for oneway operations.

Definition at line 507 of file ClientRequestInfo.cpp.

References check_validity(), and TAO_RequestInfo_Util::make_any().

00508 {
00509   this->check_validity ();
00510 
00511   // Generate the result on demand.
00512   static const CORBA::Boolean tk_void_any = 0;
00513   CORBA::Any *result_any =
00514     TAO_RequestInfo_Util::make_any (tk_void_any);
00515 
00516   CORBA::Any_var safe_result_any = result_any;
00517 
00518   if (this->result (result_any) == false)
00519     throw ::CORBA::MARSHAL ();
00520 
00521   return safe_result_any._retn ();
00522 }

void TAO_ClientRequestInfo::setup_picurrent ( void   )  [private]

Setup thread scope and request scope PortableInterceptor::Current objects.

Definition at line 40 of file ClientRequestInfo.cpp.

References invocation_, and rs_pi_current_.

Referenced by TAO_ClientRequestInfo().

00041 {
00042   // Retrieve the thread scope current (no TSS access incurred yet).
00043   CORBA::Object_ptr pi_current_obj =
00044     this->invocation_->orb_core ()->pi_current ();
00045 
00046   TAO::PICurrent *pi_current =
00047     dynamic_cast <TAO::PICurrent*> (pi_current_obj);
00048 
00049   // If the slot count is zero, then there is nothing to copy.
00050   // Prevent any copying (and hence TSS accesses) from occurring.
00051   if (pi_current != 0 && pi_current->slot_count () != 0)
00052     {
00053       // Retrieve the thread scope current.
00054       TAO::PICurrent_Impl *tsc = pi_current->tsc ();
00055 
00056       if (tsc != 0)
00057         {
00058           // Logically copy the TSC's slot table to the RSC.
00059           this->rs_pi_current_.take_lazy_copy (tsc);
00060        }
00061     }
00062 }

Messaging::SyncScope TAO_ClientRequestInfo::sync_scope ( void   )  [virtual]

Return the sync_scope policy value for the current one-way operation. If the operation is not a one-way, a CORBA::BAD_INV_ORDER exception is thrown.

Definition at line 544 of file ClientRequestInfo.cpp.

References check_validity(), and invocation_.

00545 {
00546   this->check_validity ();
00547 
00548   return this->invocation_->operation_details ().response_flags ();
00549 }

TimeBase::TimeT TAO_ClientRequestInfo::tao_ft_expiration_time ( void   )  const

Get the absolute FT expiration time for this request.

Definition at line 629 of file ClientRequestInfo.cpp.

References invocation_.

00630 {
00631   return this->invocation_->operation_details ().ft_expiration_time ();
00632 }

void TAO_ClientRequestInfo::tao_ft_expiration_time ( TimeBase::TimeT  time  ) 

Set the absolute FT expiration time for this request.

Definition at line 623 of file ClientRequestInfo.cpp.

References invocation_.

00624 {
00625   this->invocation_->operation_details ().ft_expiration_time (time);
00626 }

CORBA::Long TAO_ClientRequestInfo::tao_ft_retention_id ( void   )  const

Get the FT request retention ID for this request.

Definition at line 641 of file ClientRequestInfo.cpp.

References invocation_.

00642 {
00643   return this->invocation_->operation_details ().ft_retention_id ();
00644 }

void TAO_ClientRequestInfo::tao_ft_retention_id ( CORBA::Long  request_id  ) 

Set the FT request retention ID for this request.

Definition at line 635 of file ClientRequestInfo.cpp.

References invocation_.

00636 {
00637   this->invocation_->operation_details ().ft_retention_id (request_id) ;
00638 }

CORBA::Object_ptr TAO_ClientRequestInfo::target ( void   )  [virtual]

Return the (initial, non-forwarded, or permanently forwarded) object reference of the target.

Definition at line 84 of file ClientRequestInfo.cpp.

References CORBA::Object::_duplicate(), and check_validity().

00085 {
00086   this->check_validity ();
00087 
00088   return CORBA::Object::_duplicate (this->invocation_->target ());
00089 }


Member Data Documentation

TAO::Invocation_Base* TAO_ClientRequestInfo::invocation_ [private]

Pointer to the invocation object.

Definition at line 216 of file ClientRequestInfo.h.

Referenced by add_request_service_context(), effective_profile(), exception_list(), forward_reference(), get_effective_component(), get_effective_components(), get_reply_service_context(), get_request_policy(), get_request_service_context(), parameter_list(), received_exception(), received_exception_id(), reply_status(), request_id(), response_expected(), result(), setup_picurrent(), sync_scope(), tao_ft_expiration_time(), and tao_ft_retention_id().

TAO::PICurrent_Impl TAO_ClientRequestInfo::rs_pi_current_ [private]

The "Request Scope Current" (RSC) object, as required by Portable Interceptors.

Definition at line 220 of file ClientRequestInfo.h.

Referenced by get_slot(), and setup_picurrent().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:42:06 2010 for TAO_PI by  doxygen 1.4.7