00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Objref_VarOut_T.h 00006 * 00007 * Objref_VarOut_T.h,v 1.14 2006/04/19 08:43:17 jwillemsen Exp 00008 * 00009 * @author Jeff Parsons 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_OBJREF_VAROUT_T_H 00014 #define TAO_OBJREF_VAROUT_T_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "ace/CORBA_macros.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Basic_Types.h" 00025 #include "tao/varbase.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 class TAO_OutputCDR; 00030 00031 namespace TAO 00032 { 00033 /** 00034 * struct Objref_Traits 00035 * 00036 * @brief Specialized for each interface in generated code. Just forward 00037 * declare, a specialization must always be there, if not, we get a 00038 * compile error. 00039 */ 00040 template<typename T> struct Objref_Traits; 00041 } 00042 00043 /** 00044 * @class TAO_Objref_Var_T 00045 * 00046 * @brief Parameterized implementation of @c _var class for object 00047 * references. 00048 * 00049 */ 00050 template <typename T> 00051 class TAO_Objref_Var_T : private TAO_Base_var 00052 { 00053 public: 00054 TAO_Objref_Var_T (void); 00055 TAO_Objref_Var_T (T * p) : ptr_ (p) {} 00056 TAO_Objref_Var_T (const TAO_Objref_Var_T<T> &); 00057 ~TAO_Objref_Var_T (void); 00058 00059 TAO_Objref_Var_T<T> & operator= (T *); 00060 TAO_Objref_Var_T<T> & operator= ( 00061 const TAO_Objref_Var_T<T> & 00062 ); 00063 T * operator-> (void) const; 00064 00065 // Cast operators. 00066 operator T * const & () const; 00067 operator T *& (); 00068 00069 typedef T _obj_type; 00070 typedef T * _in_type; 00071 typedef T *& _inout_type; 00072 typedef T *& _out_type; 00073 typedef T * _retn_type; 00074 00075 _in_type in (void) const; 00076 _inout_type inout (void); 00077 _out_type out (void); 00078 _retn_type _retn (void); 00079 00080 // TAO extension. 00081 _retn_type ptr (void) const; 00082 00083 protected: 00084 T * ptr_; 00085 void free (void); 00086 void reset (T *); 00087 00088 private: 00089 // Unimplemented - prevents widening assignment. 00090 TAO_Objref_Var_T (const TAO_Base_var &); 00091 void operator= (const TAO_Base_var &); 00092 }; 00093 00094 /** 00095 * @class TAO_Objref_Out_T 00096 * 00097 * @brief Parametrized implementation of _out class for object references. 00098 * 00099 */ 00100 template <typename T> 00101 class TAO_Objref_Out_T 00102 { 00103 public: 00104 TAO_Objref_Out_T (T *&); 00105 TAO_Objref_Out_T (TAO_Objref_Var_T<T> &); 00106 TAO_Objref_Out_T (const TAO_Objref_Out_T<T> &); 00107 00108 TAO_Objref_Out_T &operator= (const TAO_Objref_Out_T<T> &); 00109 TAO_Objref_Out_T &operator= (T *); 00110 00111 // Cast operator. 00112 operator T *& (); 00113 00114 T *& ptr (void); 00115 T * operator-> (void); 00116 00117 private: 00118 T *& ptr_; 00119 00120 /// Assignment from _var not allowed. 00121 TAO_Objref_Out_T &operator= (const TAO_Objref_Var_T<T> &); 00122 }; 00123 00124 TAO_END_VERSIONED_NAMESPACE_DECL 00125 00126 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00127 #include "tao/Objref_VarOut_T.cpp" 00128 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00129 00130 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00131 #pragma implementation ("Objref_VarOut_T.cpp") 00132 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00133 00134 #include /**/ "ace/post.h" 00135 00136 #endif /* TAO_OBJREF_VAROUT_T_H */