Objref_VarOut_T.h

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

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7