00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Pseudo_VarOut_T.h 00006 * 00007 * $Id: Pseudo_VarOut_T.h 73128 2006-06-19 14:51:36Z parsons $ 00008 * 00009 * @note This header should be included after all types to be passed 00010 * as template parameters to the TAO_Pseudo_{Var,Out}_T template 00011 * classes have been declared. If the types in question are defined 00012 * in another header, include that header before this one. 00013 * @par 00014 * Including other headers like "tao/CORBA_methods.h" here can cause 00015 * circular dependency related problems when using compilers that 00016 * lookup and bind non-dependent names in templates at definition time 00017 * (i.e. while parsing the code) instead of at instantiation time. 00018 * 00019 * @todo Look into adding a template parameter to each of the 00020 * templates in question that would be a trait containing the 00021 * means for releasing references managed by the templates. 00022 * Doing so should work around the non-dependent name issues in 00023 * g++ 3.4, thus easing the requirement that this header be 00024 * parsed last. 00025 * 00026 * -Ossama 00027 * 00028 * 00029 * @author Jeff Parsons 00030 */ 00031 //============================================================================= 00032 00033 00034 #ifndef TAO_PSEUDO_VAROUT_T_H 00035 #define TAO_PSEUDO_VAROUT_T_H 00036 00037 #include /**/ "ace/pre.h" 00038 00039 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00040 # pragma once 00041 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00042 00043 #include "tao/varbase.h" 00044 00045 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00046 00047 /** 00048 * @class TAO_Pseudo_Var_T 00049 * 00050 * @brief Parametrized implementation of _var class for 00051 * TypeCode, Object, AbstractBase, NamedValue, NVList, 00052 * Principal, Request, Context, ORB, LocalObject, 00053 * and Environment. 00054 * 00055 */ 00056 template <typename T> 00057 class TAO_Pseudo_Var_T : private TAO_Base_var 00058 { 00059 public: 00060 TAO_Pseudo_Var_T (void); 00061 TAO_Pseudo_Var_T (typename T::_ptr_type); 00062 TAO_Pseudo_Var_T (const TAO_Pseudo_Var_T<T> &); 00063 00064 ~TAO_Pseudo_Var_T (void); 00065 00066 TAO_Pseudo_Var_T<T> & operator= (typename T::_ptr_type); 00067 TAO_Pseudo_Var_T<T> & operator= (const TAO_Pseudo_Var_T<T> &); 00068 00069 typename T::_ptr_type operator-> (void) const; 00070 00071 operator typename T::_ptr_type const & () const; 00072 operator typename T::_ptr_type & (); 00073 00074 typedef typename T::_ptr_type _in_type; 00075 typedef typename T::_ptr_type & _inout_type; 00076 typedef typename T::_ptr_type & _out_type; 00077 typedef typename T::_ptr_type _retn_type; 00078 00079 _in_type in (void) const; 00080 _inout_type inout (void); 00081 _out_type out (void); 00082 _retn_type _retn (void); 00083 00084 // TAO extension. 00085 _retn_type ptr (void) const; 00086 private: 00087 00088 // Unimplemented - prevents widening assignment. 00089 TAO_Pseudo_Var_T (const TAO_Base_var &); 00090 void operator= (const TAO_Base_var &); 00091 00092 private: 00093 typename T::_ptr_type ptr_; 00094 }; 00095 00096 /** 00097 * @class TAO_Pseudo_Out_T 00098 * 00099 * @brief Parametrized implementation of _out class for 00100 * TypeCode, Object, AbstractBase, NamedValue, NVList, 00101 * Principal, Request, Context, ORB, LocalObject, 00102 * and Environment. 00103 * 00104 */ 00105 template <typename T> 00106 class TAO_Pseudo_Out_T 00107 { 00108 public: 00109 TAO_Pseudo_Out_T (typename T::_ptr_type &); 00110 TAO_Pseudo_Out_T (typename T::_var_type &); 00111 TAO_Pseudo_Out_T (const TAO_Pseudo_Out_T<T> &); 00112 00113 TAO_Pseudo_Out_T<T> & operator= (const TAO_Pseudo_Out_T<T> &); 00114 TAO_Pseudo_Out_T<T> & operator= (typename T::_ptr_type); 00115 00116 operator typename T::_ptr_type & (); 00117 typename T::_ptr_type & ptr (void); 00118 typename T::_ptr_type operator-> (void); 00119 00120 private: 00121 typename T::_ptr_type & ptr_; 00122 00123 /// Assignment from _var not allowed. 00124 TAO_Pseudo_Out_T<T> & operator= (const typename T::_var_type &); 00125 }; 00126 00127 TAO_END_VERSIONED_NAMESPACE_DECL 00128 00129 #if defined (__ACE_INLINE__) 00130 #include "tao/Pseudo_VarOut_T.inl" 00131 #endif /* __ACE_INLINE__ */ 00132 00133 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00134 #include "tao/Pseudo_VarOut_T.cpp" 00135 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00136 00137 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00138 #pragma implementation ("Pseudo_VarOut_T.cpp") 00139 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00140 00141 #include /**/ "ace/post.h" 00142 00143 #endif /* TAO_PSEUDO_VAROUT_T_H */