Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tao / PortableServer / get_arg.h
bloba2cd9cdb7dca62e63a1163a3bcdbe9dcbfa7e5ea
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file get_arg.h
7 * Thru-POA/skeleton argument selection function templates.
8 * @par
9 * These function templates are used to choose between arguments
10 * supplied in thru-POA collocated invocations and arguments in
11 * uncollocated invocations.
13 * @note A function template approach is used to avoid complicated
14 * argument conversions between stub supplied arguments and
15 * skeleton supplied ones. For example, it is possible to make
16 * argument selection more transparent by taking advantage of
17 * run-time polymorphism. However, that approach would incur
18 * additional footprint overhead on the client side due to the
19 * introduction of virtual tables, etc.
21 * @author Ossama Othman
23 //=============================================================================
25 #ifndef TAO_GET_ARG_H
26 #define TAO_GET_ARG_H
28 #include /**/ "ace/pre.h"
30 #include "tao/PortableServer/SArg_Traits_T.h"
31 #include "tao/operation_details.h"
33 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
35 namespace TAO
37 namespace Portable_Server
39 /// Get return value/argument.
40 template<typename T>
41 typename TAO::SArg_Traits<T>::ret_arg_type
42 get_ret_arg (TAO_Operation_Details const * details,
43 TAO::Argument * const * skel_args)
45 return
46 (details != 0 && details->use_stub_args ())
47 ? static_cast<typename TAO::Arg_Traits<T>::ret_val *> (
48 details->args ()[0])->arg ()
49 : static_cast<typename TAO::SArg_Traits<T>::ret_val *> (
50 skel_args[0])->arg ();
53 /// Get "in" argument.
54 template<typename T>
55 typename TAO::SArg_Traits<T>::in_arg_type
56 get_in_arg (TAO_Operation_Details const * details,
57 TAO::Argument * const * skel_args,
58 size_t i)
60 return
61 (details != 0 && details->use_stub_args ())
62 ? static_cast<typename TAO::Arg_Traits<T>::in_arg_val *> (
63 details->args ()[i])->arg ()
64 : static_cast<typename TAO::SArg_Traits<T>::in_arg_val *> (
65 skel_args[i])->arg ();
68 /// Get "inout" argument.
69 template<typename T>
70 typename TAO::SArg_Traits<T>::inout_arg_type
71 get_inout_arg (TAO_Operation_Details const * details,
72 TAO::Argument * const * skel_args,
73 size_t i)
75 return
76 (details != 0 && details->use_stub_args ())
77 ? static_cast<typename TAO::Arg_Traits<T>::inout_arg_val *> (
78 details->args ()[i])->arg ()
79 : static_cast<typename TAO::SArg_Traits<T>::inout_arg_val *> (
80 skel_args[i])->arg ();
83 /// Get "out" argument.
84 template<typename T>
85 typename TAO::SArg_Traits<T>::out_arg_type
86 get_out_arg (TAO_Operation_Details const * details,
87 TAO::Argument * const * skel_args,
88 size_t i)
90 return
91 (details != 0 && details->use_stub_args ())
92 ? static_cast<typename TAO::Arg_Traits<T>::out_arg_val *> (
93 details->args ()[i])->arg ()
94 : static_cast<typename TAO::SArg_Traits<T>::out_arg_val *> (
95 skel_args[i])->arg ();
100 TAO_END_VERSIONED_NAMESPACE_DECL
102 #include /**/ "ace/post.h"
104 #endif /* TAO_GET_ARG_H*/