Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / operation_details.h
bloba7f15528ab75b35fd472487043f017fa3c48c34b
1 // -*- C++ -*-
2 //=============================================================================
3 /**
4 * @file operation_details.h
6 * @author Bala Natarajan <bala@cs.wustl.edu>
7 */
8 //=============================================================================
10 #ifndef TAO_OPERATION_DETAILS_H
11 #define TAO_OPERATION_DETAILS_H
13 #include /**/ "ace/pre.h"
15 #include "tao/Service_Context.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Exception.h"
22 #include "tao/TimeBaseC.h"
23 #include "tao/target_specification.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 /// Forward declarations
28 namespace Dynamic
30 class ParameterList;
31 class ExceptionList;
34 namespace TAO
36 class Argument;
37 class Collocated_Arguments_Converter;
38 struct Exception_Data;
41 namespace TAO
43 namespace CSD
45 class FW_Server_Request_Wrapper;
49 class TAO_Reply_Dispatcher;
51 /**
52 * @class TAO_Operation_Details
54 * @brief Class with operation details
56 * This class stores some of the "operation" details that would be
57 * required by the invocation classes. This class is in its
58 * infancy now but I expect this one to grow as we come with
59 * different varieties of use cases.
61 * @todo Put this in namespace TAO.
63 class TAO_Export TAO_Operation_Details
65 public:
66 /// Declare FW_Server_Request_Wrapper a friend
67 /// This friendship makes the FW_Server_Request_Wrapper be able to
68 /// clone the TAO_Operation_Details data member in TAO_ServerRequest.
69 friend class TAO::CSD::FW_Server_Request_Wrapper;
71 /// Constructor
72 TAO_Operation_Details (const char *name,
73 const CORBA::ULong len,
74 TAO::Argument **args = 0,
75 const CORBA::ULong num_args = 0,
76 const CORBA::Boolean has_in_args = true,
77 const TAO::Exception_Data *ex_data = 0,
78 const CORBA::ULong ex_count = 0);
80 /// Operation name
81 const char* opname () const;
83 /// Length of the operation name
84 CORBA::ULong opname_len () const;
86 /// Return the flag that indicates whether the operation has any
87 /// arguments
88 CORBA::Boolean argument_flag () const;
89 CORBA::Boolean in_argument_flag () const;
91 /// Set the response flags
92 void response_flags (CORBA::Octet flags);
94 /// Get the response flags
95 CORBA::Octet response_flags () const;
97 /// Accessors for the service context list
98 IOP::ServiceContextList &request_service_info ();
99 const IOP::ServiceContextList &request_service_info () const;
100 IOP::ServiceContextList &reply_service_info ();
101 const IOP::ServiceContextList &reply_service_info () const;
103 /// Access the TAO_Service_Context
104 TAO_Service_Context &request_service_context ();
105 const TAO_Service_Context &request_service_context () const;
106 TAO_Service_Context &reply_service_context ();
107 const TAO_Service_Context &reply_service_context () const;
109 /// Reset the contents of the service context lists that we hold.
110 void reset_request_service_info ();
111 void reset_reply_service_info ();
113 /// Cache the request id.
114 void request_id (CORBA::ULong id);
116 /// Return the request ID associated with the operation
117 CORBA::ULong request_id () const;
119 /// Accessor method for the addressing mode
120 TAO_Target_Specification::TAO_Target_Address addressing_mode () const;
122 /// Set method for the addressing mode
123 void addressing_mode (CORBA::Short addr);
125 /// Creates and returns a CORBA::Exception object whose repository
126 /// id \a ex matches the exception list that this operation
127 /// specified.
129 * This step is important to decode the exception that the client
130 * got from the server. If the exception received from the server
131 * is not found in the list of exceptions specified by the operation
132 * this call would raise an UNKNOWN exception.
134 CORBA::Exception *corba_exception (const char *ex) const;
136 /// Check whether exception @a ex is in the signature of this operation
137 bool has_exception (::CORBA::Exception& ex) const;
140 * @name Helper methods used by the Invocation classes.
142 //@{
143 /// Marshals the list of @c this->arg_ into the \a cdr.
144 bool marshal_args (TAO_OutputCDR &cdr);
146 /// Demarshals the list of @c this->arg_ into the \a cdr.
147 bool demarshal_args (TAO_InputCDR &cdr);
149 /// Accessors for the argument list
150 TAO::Argument ** args () const;
151 CORBA::ULong args_num () const;
153 /// Exception count
154 CORBA::ULong ex_count () const;
156 TAO::Exception_Data const * ex_data () const;
158 CORBA::Boolean use_stub_args () const;
159 void use_stub_args (CORBA::Boolean use_stub_arguments);
161 #if TAO_HAS_INTERCEPTORS == 1
162 void ft_expiration_time (TimeBase::TimeT time);
163 TimeBase::TimeT ft_expiration_time () const;
165 void ft_retention_id (CORBA::Long request_id);
166 CORBA::Long ft_retention_id () const;
167 #endif /*TAO_HAS_INTERCEPTORS == 1*/
169 /// Accessor for cac_ pointer.
170 TAO::Collocated_Arguments_Converter *cac () const;
171 void cac (TAO::Collocated_Arguments_Converter *cac);
173 TAO_Reply_Dispatcher *reply_dispatcher () const;
174 void reply_dispatcher (TAO_Reply_Dispatcher *rd);
176 private:
177 /// Name of the operation being invoked.
178 const char *opname_;
180 /// Precalculated length of opname_.
181 const CORBA::ULong opname_len_;
183 /// Request ID of this operation.
184 CORBA::ULong request_id_;
186 /// Response flags
187 CORBA::Octet response_flags_;
189 /// The ServiceContextList sent to the server side. Only valid
190 /// when sending a request.
191 TAO_Service_Context request_service_info_;
193 /// The ServiceContextList received from the server side. Only
194 /// valid when sending a request.
195 TAO_Service_Context reply_service_info_;
197 /// Addressing mode for this request.
198 TAO_Target_Specification::TAO_Target_Address addressing_mode_;
201 * The arguments of this operation. Note that the return value is also
202 * an argument
204 TAO::Argument **args_;
206 /// Number of arguments including the return value
207 const CORBA::ULong num_args_;
209 /// A flag indicating any args are sent with the request
210 const CORBA::Boolean has_in_args_;
212 /// The type of exceptions that the operations can throw.
213 const TAO::Exception_Data *ex_data_;
215 /// Count of the exceptions that operations can throw.
216 const CORBA::ULong ex_count_;
218 /// Boolean flag to indicate whether in the skeletons the stub arguments
219 /// stored in these operation details should be used or not.
220 CORBA::Boolean use_stub_args_;
222 #if TAO_HAS_INTERCEPTORS == 1
223 /// FT request expiration time (absolute gregorian)
224 TimeBase::TimeT ft_expiration_time_;
226 /// FT request retention id
227 CORBA::Long ft_retention_id_;
228 #endif /*TAO_HAS_INTERCEPTORS == 1*/
230 /// The optional collocated arguments converter
231 TAO::Collocated_Arguments_Converter *cac_;
233 /// The optional reply dispatcher
234 TAO_Reply_Dispatcher *reply_dispatcher_;
237 TAO_END_VERSIONED_NAMESPACE_DECL
239 #if defined (__ACE_INLINE__)
240 # include "tao/operation_details.inl"
241 #endif /* __ACE_INLINE__ */
243 #include /**/ "ace/post.h"
245 #endif /* TAO_OPERATION_DETAILS_H */