Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / VarOut_T.h
blobd436d415ade9d2f245dc29337ce1801a4504f01f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file VarOut_T.h
7 * @author Jeff Parsons
8 */
9 //=============================================================================
11 #ifndef TAO_VAROUT_T_H
12 #define TAO_VAROUT_T_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/Versioned_Namespace.h"
18 #include "ace/OS_Memory.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
26 /**
27 * @class TAO_Var_Base_T
29 * @brief Parametrized implementation of _var base class for structs,
30 * unions and exceptions.
32 template<typename T>
33 class TAO_Var_Base_T
35 public:
36 TAO_Var_Base_T ();
37 TAO_Var_Base_T (T *);
38 TAO_Var_Base_T (const TAO_Var_Base_T<T> &);
40 ~TAO_Var_Base_T ();
42 T * operator-> ();
43 const T * operator-> () const;
45 typedef const T & _in_type;
46 typedef T & _inout_type;
48 // Common mapping for fixed and variable size types.
49 _in_type in () const;
50 _inout_type inout ();
52 // TAO extension.
53 T * ptr () const;
54 operator T *& ();
56 protected:
57 T * ptr_;
60 /**
61 * @class TAO_Fixed_Var_T
63 * @brief Parametrized implementation of _var class for structs, unions,
64 * and exceptions with members of fixed size.
66 template<typename T>
67 class TAO_Fixed_Var_T : public TAO_Var_Base_T<T>
69 public:
70 TAO_Fixed_Var_T ();
71 TAO_Fixed_Var_T (T *);
72 TAO_Fixed_Var_T (const TAO_Fixed_Var_T<T> &);
74 // Fixed-size types only.
75 TAO_Fixed_Var_T (const T &);
77 TAO_Fixed_Var_T & operator= (T *);
78 TAO_Fixed_Var_T & operator= (const TAO_Fixed_Var_T<T> &);
80 // Fixed-size types only.
81 TAO_Fixed_Var_T & operator= (const T &);
83 operator const T & () const;
84 operator T & ();
85 operator T & () const;
87 typedef T & _out_type;
88 typedef T _retn_type;
90 // Mapping for fixed size types.
91 _out_type out ();
92 _retn_type _retn ();
95 /**
96 * @class TAO_Var_Var_T
98 * @brief Parametrized implementation of _var class for structs, unions,
99 * and exceptions with members of variable size.
101 template<typename T>
102 class TAO_Var_Var_T : public TAO_Var_Base_T<T>
104 public:
105 TAO_Var_Var_T ();
106 TAO_Var_Var_T (T *);
107 TAO_Var_Var_T (const TAO_Var_Var_T<T> &);
109 TAO_Var_Var_T & operator= (T *);
110 TAO_Var_Var_T & operator= (const TAO_Var_Var_T<T> &);
112 operator const T & () const;
113 operator T & ();
114 operator T & () const;
116 typedef T *& _out_type;
117 typedef T * _retn_type;
119 // Mapping for variable size types.
120 _out_type out ();
121 _retn_type _retn ();
125 * @class TAO_Out_T
127 * @brief Parametrized implementation of _out class for structs, unions
128 * and exceptions..
130 template<typename T>
131 class TAO_Out_T
133 public:
134 typedef typename T::_var_type T_var;
136 TAO_Out_T (T *&);
137 TAO_Out_T (T_var &);
138 TAO_Out_T (const TAO_Out_T<T> &);
140 TAO_Out_T &operator= (const TAO_Out_T<T> &);
141 TAO_Out_T &operator= (T *);
143 operator T *& ();
144 T *& ptr ();
145 T * operator-> ();
147 private:
148 T *& ptr_;
150 /// Assignment from T_var not allowed.
151 void operator= (const T_var &);
154 TAO_END_VERSIONED_NAMESPACE_DECL
156 #if defined (__ACE_INLINE__)
157 #include "tao/VarOut_T.inl"
158 #endif /* __ACE_INLINE__ */
160 #include "tao/VarOut_T.cpp"
162 #include /**/ "ace/post.h"
164 #endif /* TAO_VAROUT_T_H */