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

Generated on Sun Jan 27 13:07:34 2008 for TAO by doxygen 1.3.6