VarOut_T.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    VarOut_T.h
00006  *
00007  *  VarOut_T.h,v 1.10 2006/06/20 06:03:07 jwillemsen Exp
00008  *
00009  *  @author Jeff Parsons
00010  */
00011 //=============================================================================
00012 
00013 #ifndef TAO_VAROUT_T_H
00014 #define TAO_VAROUT_T_H
00015 
00016 #include /**/ "ace/pre.h"
00017 
00018 #include "ace/OS_Memory.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif /* ACE_LACKS_PRAGMA_ONCE */
00023 
00024 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00025 
00026 /**
00027  * @class TAO_Var_Base_T
00028  *
00029  * @brief Parametrized implementation of _var base class for structs,
00030  * unions and exceptions.
00031  *
00032  */
00033 template<typename T>
00034 class TAO_Var_Base_T
00035 {
00036 public:
00037   TAO_Var_Base_T (void);
00038   TAO_Var_Base_T (T *);
00039   TAO_Var_Base_T (const TAO_Var_Base_T<T> &);
00040 
00041   ~TAO_Var_Base_T (void);
00042 
00043   T * operator-> (void);
00044   const T * operator-> (void) const;
00045 
00046   operator const T & () const;
00047   operator T & ();
00048   operator T & () const;
00049 
00050   typedef const T &   _in_type;
00051   typedef       T &   _inout_type;
00052 
00053   // Common mapping for fixed and variable size types.
00054   _in_type      in (void) const;
00055   _inout_type   inout (void);
00056 
00057   // TAO extension.
00058   T * ptr (void) const;
00059 
00060 protected:
00061   T * ptr_;
00062 };
00063 
00064 /**
00065  * @class TAO_Fixed_Var_T
00066  *
00067  * @brief Parametrized implementation of _var class for structs, unions,
00068  * and exceptions with members of fixed size.
00069  *
00070  */
00071 template<typename T>
00072 class TAO_Fixed_Var_T : public TAO_Var_Base_T<T>
00073 {
00074 public:
00075   TAO_Fixed_Var_T (void);
00076   TAO_Fixed_Var_T (T *);
00077   TAO_Fixed_Var_T (const TAO_Fixed_Var_T<T> &);
00078 
00079   // Fixed-size types only.
00080   TAO_Fixed_Var_T (const T &);
00081 
00082   TAO_Fixed_Var_T & operator= (T *);
00083   TAO_Fixed_Var_T & operator= (const TAO_Fixed_Var_T<T> &);
00084 
00085   // Fixed-size types only.
00086   TAO_Fixed_Var_T & operator= (const T &);
00087 
00088   typedef T &   _out_type;
00089   typedef T     _retn_type;
00090 
00091   // Mapping for fixed size types.
00092   _out_type     out (void);
00093   _retn_type    _retn (void);
00094 };
00095 
00096 /**
00097  * @class TAO_Var_Var_T
00098  *
00099  * @brief Parametrized implementation of _var class for structs, unions,
00100  * and exceptions with members of variable size.
00101  *
00102  */
00103 template<typename T>
00104 class TAO_Var_Var_T : public TAO_Var_Base_T<T>
00105 {
00106 public:
00107   TAO_Var_Var_T (void);
00108   TAO_Var_Var_T (T *);
00109   TAO_Var_Var_T (const TAO_Var_Var_T<T> &);
00110 
00111   TAO_Var_Var_T & operator= (T *);
00112   TAO_Var_Var_T & operator= (const TAO_Var_Var_T<T> &);
00113 
00114   // Variable size types only.
00115   operator T *& ();
00116 
00117   typedef T *&  _out_type;
00118   typedef T *   _retn_type;
00119 
00120   // Mapping for variable size types.
00121   _out_type     out (void);
00122   _retn_type    _retn (void);
00123 };
00124 
00125 /**
00126  * @class TAO_Out_T
00127  *
00128  * @brief Parametrized implementation of _out class for structs, unions
00129  * and exceptions..
00130  *
00131  */
00132 template<typename T>
00133 class TAO_Out_T
00134 {
00135 public:
00136   typedef typename T::_var_type T_var;
00137 
00138   TAO_Out_T (T *&);
00139   TAO_Out_T (T_var &);
00140   TAO_Out_T (const TAO_Out_T<T> &);
00141 
00142   TAO_Out_T &operator= (const TAO_Out_T<T> &);
00143   TAO_Out_T &operator= (T *);
00144 
00145   operator T *& ();
00146   T *& ptr (void);
00147   T * operator-> (void);
00148 
00149 private:
00150   T *& ptr_;
00151 
00152   // Assignment from T_var not allowed.
00153   void operator= (const T_var &);
00154 };
00155 
00156 TAO_END_VERSIONED_NAMESPACE_DECL
00157 
00158 #if defined (__ACE_INLINE__)
00159 #include "tao/VarOut_T.inl"
00160 #endif /* __ACE_INLINE__ */
00161 
00162 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00163 #include "tao/VarOut_T.cpp"
00164 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00165 
00166 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00167 #pragma implementation ("VarOut_T.cpp")
00168 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00169 
00170 #include /**/ "ace/post.h"
00171 
00172 #endif /* TAO_VAROUT_T_H */

Generated on Thu Nov 9 11:54:28 2006 for TAO by doxygen 1.3.6