Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Array_VarOut_T.h
blob25bef261e74126f2b098700f1e5edcdce37835d8
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Array_VarOut_T.h
7 * @author Jeff Parsons
8 * @author Johnny Willemsen
9 */
10 //=============================================================================
12 #ifndef TAO_ARRAY_VAROUT_T_H
13 #define TAO_ARRAY_VAROUT_T_H
15 #include /**/ "ace/pre.h"
17 #include /**/ "tao/Versioned_Namespace.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/Basic_Types.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 namespace TAO
29 /**
30 * @struct Array_Traits
32 * @brief Specialized for each array in generated code.
35 template<typename T_forany>
36 struct Array_Traits;
39 /**
40 * @class TAO_Array_Forany_T
42 * @brief Parametrized implementation of _forany class for arrays.
44 template<typename T, typename T_slice, typename TAG>
45 class TAO_Array_Forany_T
47 public:
48 typedef T _array_type;
49 typedef T_slice _slice_type;
50 typedef TAG _tag_type;
52 TAO_Array_Forany_T ();
53 TAO_Array_Forany_T (_slice_type *, CORBA::Boolean nocopy = false);
54 TAO_Array_Forany_T (const TAO_Array_Forany_T<T,T_slice,TAG> &);
55 ~TAO_Array_Forany_T ();
57 static void _tao_any_destructor (void *);
59 TAO_Array_Forany_T & operator= (_slice_type *);
60 TAO_Array_Forany_T & operator= (const TAO_Array_Forany_T<T,T_slice,TAG> &);
62 _slice_type & operator[] (CORBA::ULong index);
63 const _slice_type & operator[] (CORBA::ULong index) const;
65 operator _slice_type * const & () const;
66 operator _slice_type *& ();
68 typedef const _slice_type * _in_type;
69 typedef _slice_type * _inout_type;
70 typedef _slice_type * & _out_type;
71 typedef _slice_type * _retn_type;
72 typedef _slice_type *& _retn_arg_type;
74 // in, inout, out, _retn
75 _in_type in () const;
76 _inout_type inout ();
77 _out_type out ();
78 _retn_type _retn ();
79 _slice_type * ptr () const;
80 CORBA::Boolean nocopy () const;
82 static _slice_type * tao_alloc ();
83 private:
84 typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
85 _slice_type * ptr_;
86 CORBA::Boolean nocopy_;
89 /**
90 * @class TAO_Array_Var_Base_T
92 * @brief Parametrized implementation of _var base class for arrays.
94 template<typename T, typename T_slice, typename TAG>
95 class TAO_Array_Var_Base_T
97 public:
98 typedef T_slice _slice_type;
99 typedef T_slice const & _const_subscript_type;
100 typedef T_slice & _subscript_type;
102 TAO_Array_Var_Base_T ();
103 TAO_Array_Var_Base_T (_slice_type *);
104 TAO_Array_Var_Base_T (const TAO_Array_Var_Base_T<T,T_slice,TAG> &);
105 ~TAO_Array_Var_Base_T ();
107 _subscript_type operator[] (CORBA::ULong index);
108 _const_subscript_type operator[] (CORBA::ULong index) const;
109 operator _slice_type * const & () const;
111 typedef const _slice_type * _in_type;
112 typedef _slice_type * _inout_type;
113 typedef _slice_type * _retn_type;
114 typedef _slice_type *& _retn_arg_type;
116 // in, inout, out, _retn
117 _in_type in () const;
118 _inout_type inout ();
119 _retn_type _retn ();
120 _retn_arg_type _retn_arg ();
122 // TAO extension.
123 _retn_type ptr () const;
124 protected:
125 typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
126 _slice_type * ptr_;
130 * @class TAO_FixedArray_Var_T
132 * @brief Parametrized implementation of _var class for arrays with
133 * elements of fixed size.
135 template<typename T, typename T_slice, typename TAG>
136 class TAO_FixedArray_Var_T : public TAO_Array_Var_Base_T<T,T_slice,TAG>
138 public:
139 typedef T_slice _slice_type;
140 typedef T_slice *_out_type;
142 TAO_FixedArray_Var_T ();
143 TAO_FixedArray_Var_T (_slice_type *);
144 TAO_FixedArray_Var_T (const TAO_FixedArray_Var_T<T,T_slice,TAG> &);
146 TAO_FixedArray_Var_T<T,T_slice,TAG> &operator= (_slice_type *);
147 TAO_FixedArray_Var_T<T,T_slice,TAG> &operator= (
148 const TAO_FixedArray_Var_T<T,T_slice,TAG> &);
150 _out_type out ();
152 private:
153 // Some compilers don't look into the base class when parsing
154 // templates unless they are force to.
155 typedef typename TAO_Array_Var_Base_T<T,T_slice,TAG>::FORANY FORANY;
159 * @class TAO_VarArray_Var_T
161 * @brief Parametrized implementation of _var class for arrays with
162 * elements of variable size.
164 template<typename T, typename T_slice, typename TAG>
165 class TAO_VarArray_Var_T : public TAO_Array_Var_Base_T<T,T_slice,TAG>
167 public:
168 typedef T_slice _slice_type;
169 typedef T_slice *&_out_type;
171 TAO_VarArray_Var_T ();
172 TAO_VarArray_Var_T (_slice_type *);
173 TAO_VarArray_Var_T (const TAO_VarArray_Var_T<T,T_slice,TAG> &);
175 TAO_VarArray_Var_T<T,T_slice,TAG> &operator= (_slice_type *);
176 TAO_VarArray_Var_T<T,T_slice,TAG> &operator= (
177 const TAO_VarArray_Var_T<T,T_slice,TAG> &);
179 _out_type out ();
181 operator _slice_type *& ();
183 private:
184 // Some compilers don't look into the base class when parsing
185 // templates unless they are force to.
186 typedef typename TAO_Array_Var_Base_T<T,T_slice,TAG>::FORANY FORANY;
190 * @class TAO_Array_Out_T
192 * @brief Parametrized implementation of _out class for arrays.
194 template<typename T, typename T_var, typename T_slice, typename TAG>
195 class TAO_Array_Out_T
197 public:
198 typedef T_slice _slice_type;
199 typedef T_var _value_type;
200 typedef T_var _var_type;
202 TAO_Array_Out_T (_slice_type *&);
203 TAO_Array_Out_T (_value_type &);
204 TAO_Array_Out_T (const TAO_Array_Out_T<T,T_var,T_slice,TAG> &);
206 TAO_Array_Out_T<T,T_var,T_slice,TAG> &operator= (
207 const TAO_Array_Out_T<T,T_var,T_slice,TAG> &);
208 TAO_Array_Out_T<T,T_var,T_slice,TAG> &operator= (_slice_type *);
210 operator _slice_type *& ();
211 _slice_type *& ptr ();
213 _slice_type & operator[] (CORBA::ULong index);
214 const _slice_type & operator[] (CORBA::ULong index) const;
215 private:
216 typedef TAO_Array_Forany_T<T,T_slice,TAG> FORANY;
217 typedef TAO_Array_Out_T<T,T_var,T_slice,TAG> THIS_OUT_TYPE;
218 _slice_type *& ptr_;
220 // Assignment from T_var not allowed.
221 void operator= (const _value_type &);
224 TAO_END_VERSIONED_NAMESPACE_DECL
226 #if defined (__ACE_INLINE__)
227 #include "tao/Array_VarOut_T.inl"
228 #endif /* __ACE_INLINE__ */
230 #include "tao/Array_VarOut_T.cpp"
232 #include /**/ "ace/post.h"
234 #endif /* TAO_ARRAY_VAROUT_T_H */