operation_details.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //=============================================================================
00003 /**
00004  *  @file    operation_details.h
00005  *
00006  *  $Id: operation_details.h 80140 2007-11-30 00:40:17Z jtc $
00007  *
00008  *  @author Bala Natarajan <bala@cs.wustl.edu>
00009  */
00010 //=============================================================================
00011 
00012 #ifndef TAO_OPERATION_DETAILS_H
00013 #define TAO_OPERATION_DETAILS_H
00014 
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "tao/Service_Context.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "tao/Exception.h"
00024 #include "tao/TimeBaseC.h"
00025 #include "tao/target_specification.h"
00026 
00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 /// Forward declarations
00030 namespace Dynamic
00031 {
00032   class ParameterList;
00033   class ExceptionList;
00034 }
00035 
00036 namespace TAO
00037 {
00038   class Argument;
00039   class Collocated_Arguments_Converter;
00040   struct Exception_Data;
00041 }
00042 
00043 namespace TAO
00044 {
00045   namespace CSD
00046   {
00047     class FW_Server_Request_Wrapper;
00048   }
00049 }
00050 
00051 class TAO_Reply_Dispatcher;
00052 
00053 /**
00054  * @class TAO_Operation_Details
00055  *
00056  * @brief Class with operation details
00057  *
00058  * This class stores some of the "operation" details that would be
00059  * required by the invocation classes.  This class is in its
00060  * infancy now but I expect this one to grow as we come with
00061  * different varieties of use cases.
00062  *
00063  * @todo Put this in namespace TAO.
00064  */
00065 class TAO_Export TAO_Operation_Details
00066 {
00067 public:
00068 
00069   /// Declare FW_Server_Request_Wrapper a friend
00070   /// This friendship makes the FW_Server_Request_Wrapper be able to
00071   /// clone the TAO_Operation_Details data member in TAO_ServerRequest.
00072   friend class TAO::CSD::FW_Server_Request_Wrapper;
00073 
00074   /// Constructor
00075   TAO_Operation_Details (const char *name,
00076                          CORBA::ULong len,
00077                          TAO::Argument **args = 0,
00078                          CORBA::ULong num_args = 0,
00079                          TAO::Exception_Data *ex_data = 0,
00080                          CORBA::ULong ex_count = 0);
00081 
00082   /// Operation name
00083   const char* opname (void) const;
00084 
00085   /// Length of the operation name
00086   CORBA::ULong opname_len (void) const;
00087 
00088   /// Return the flag that indicates whether the operation has any
00089   /// arguments
00090   CORBA::Boolean argument_flag (void) const;
00091 
00092   /// Set the response flags
00093   void response_flags (CORBA::Octet flags);
00094 
00095   /// Get the response flags
00096   CORBA::Octet response_flags (void) const;
00097 
00098   /// Accessors for the service context list
00099   IOP::ServiceContextList &request_service_info (void);
00100   const IOP::ServiceContextList &request_service_info (void) const;
00101   IOP::ServiceContextList &reply_service_info (void);
00102   const IOP::ServiceContextList &reply_service_info (void) const;
00103 
00104   /// Access the TAO_Service_Context
00105   TAO_Service_Context &request_service_context (void);
00106   const TAO_Service_Context &request_service_context (void) const;
00107   TAO_Service_Context &reply_service_context (void);
00108   const TAO_Service_Context &reply_service_context (void) const;
00109 
00110   /// Reset the contents of the service context lists that we hold.
00111   void reset_request_service_info (void);
00112   void reset_reply_service_info (void);
00113 
00114   /// Cache the request id.
00115   void request_id (CORBA::ULong id);
00116 
00117   /// Return the request ID associated with the operation
00118   CORBA::ULong request_id (void) const;
00119 
00120   /// Accessor method for the addressing mode
00121   TAO_Target_Specification::TAO_Target_Address addressing_mode (void) const;
00122 
00123   /// Set method for the addressing mode
00124   void addressing_mode (CORBA::Short addr);
00125 
00126   /// Creates and returns a CORBA::Exception object whose repository
00127   /// id \a ex matches the exception list that this operation
00128   /// specified.
00129   /**
00130    * This step is important to decode the exception that the client
00131    * got from the server. If the exception received from the server
00132    * is not found in the list of exceptions specified by the operation
00133    * this call would raise an UNKNOWN exception.
00134    */
00135   CORBA::Exception *corba_exception (const char *ex) const;
00136 
00137   /// Check whether exception @a ex is in the signature of this operation
00138   bool has_exception (::CORBA::Exception& ex) const;
00139 
00140   /**
00141    * @name Helper methods used by the Invocation classes.
00142    */
00143   //@{
00144 
00145   /// Marshals the list of <this->arg_> into the \a cdr.
00146   bool marshal_args (TAO_OutputCDR &cdr);
00147 
00148   /// Demarshals the list of <this->arg_> into the \a cdr.
00149   bool demarshal_args (TAO_InputCDR &cdr);
00150 
00151   /// Accessors for the argument list
00152   TAO::Argument ** args (void) const;
00153   CORBA::ULong args_num (void) const ;
00154 
00155   /// Exception count
00156   CORBA::ULong ex_count (void) const;
00157 
00158   TAO::Exception_Data const * ex_data (void) const;
00159 
00160   CORBA::Boolean use_stub_args (void) const;
00161   void use_stub_args (CORBA::Boolean use_stub_arguments);
00162 
00163 #if TAO_HAS_INTERCEPTORS == 1
00164   void ft_expiration_time (TimeBase::TimeT time);
00165   TimeBase::TimeT ft_expiration_time (void) const;
00166 
00167   void ft_retention_id (CORBA::Long request_id);
00168   CORBA::Long ft_retention_id (void) const;
00169 #endif /*TAO_HAS_INTERCEPTORS == 1*/
00170 
00171   /// Accessor for cac_ pointer.
00172   TAO::Collocated_Arguments_Converter *cac (void) const;
00173   void cac (TAO::Collocated_Arguments_Converter *cac);
00174 
00175   TAO_Reply_Dispatcher *reply_dispatcher (void) const;
00176   void reply_dispatcher (TAO_Reply_Dispatcher *rd);
00177 
00178 private:
00179 
00180   /// Name of the operation being invoked.
00181   const char *opname_;
00182 
00183   /// Precalculated length of opname_.
00184   CORBA::ULong opname_len_;
00185 
00186   /// Request ID of this operation.
00187   CORBA::ULong request_id_;
00188 
00189   /// Response flags
00190   CORBA::Octet response_flags_;
00191 
00192   /// The ServiceContextList sent to the server side. Only valid
00193   /// when sending a request.
00194   TAO_Service_Context request_service_info_;
00195 
00196   /// The ServiceContextList received from the server side. Only
00197   /// valid when sending a request.
00198   TAO_Service_Context reply_service_info_;
00199 
00200   /// Addressing  mode for this request.
00201   TAO_Target_Specification::TAO_Target_Address addressing_mode_;
00202 
00203   /**
00204    * The arguments of this operation. Note that the return value is also
00205    * an argument
00206    */
00207   TAO::Argument **args_;
00208 
00209   /// Number of arguments including the return value
00210   CORBA::ULong num_args_;
00211 
00212   /// The type of exceptions that the operations can throw.
00213   TAO::Exception_Data *ex_data_;
00214 
00215   /// Count of the exceptions that operations can throw.
00216   CORBA::ULong ex_count_;
00217 
00218   /// Boolean flag to indicate whether in the skeletons the stub arguments
00219   /// stored in these operation details should be used or not.
00220   CORBA::Boolean use_stub_args_;
00221 
00222 #if TAO_HAS_INTERCEPTORS == 1
00223   /// FT request expiration time (absolute gregorian)
00224   TimeBase::TimeT ft_expiration_time_;
00225 
00226   /// FT request retention id
00227   CORBA::Long ft_retention_id_;
00228 #endif /*TAO_HAS_INTERCEPTORS == 1*/
00229 
00230   /// The optional collocated arguments converter
00231   TAO::Collocated_Arguments_Converter *cac_;
00232 
00233   /// The optional reply dispatcher
00234   TAO_Reply_Dispatcher *reply_dispatcher_;
00235 };
00236 
00237 TAO_END_VERSIONED_NAMESPACE_DECL
00238 
00239 #if defined (__ACE_INLINE__)
00240 # include "tao/operation_details.inl"
00241 #endif /* __ACE_INLINE__ */
00242 
00243 #include /**/ "ace/post.h"
00244 
00245 #endif  /* TAO_OPERATION_DETAILS_H */

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7