00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Seq_Var_T.h 00006 * 00007 * $Id: Seq_Var_T.h 90386 2010-06-02 13:52:08Z vzykov $ 00008 * 00009 * @author Jeff Parsons 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_SEQ_VAR_T_H 00014 #define TAO_SEQ_VAR_T_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 # pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #include /**/ "tao/Versioned_Namespace.h" 00023 00024 #include "tao/Basic_Types.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 /** 00029 * @class TAO_Seq_Var_Base_T 00030 * 00031 * @brief Parametrized implementation of _var base class for sequences 00032 * 00033 */ 00034 template <typename T> 00035 class TAO_Seq_Var_Base_T 00036 { 00037 public: 00038 typedef typename T::subscript_type T_elem; 00039 00040 TAO_Seq_Var_Base_T (void); 00041 TAO_Seq_Var_Base_T (T *); 00042 TAO_Seq_Var_Base_T (const TAO_Seq_Var_Base_T<T> &); 00043 00044 ~TAO_Seq_Var_Base_T (void); 00045 00046 T *operator-> (void); 00047 const T *operator-> (void) const; 00048 00049 operator const T & () const; 00050 operator T & (); 00051 operator T & () const; 00052 00053 typedef const T & _in_type; 00054 typedef T & _inout_type; 00055 typedef T *& _out_type; 00056 typedef T * _retn_type; 00057 00058 // in, inout, out, _retn 00059 _in_type in (void) const; 00060 _inout_type inout (void); 00061 _out_type out (void); 00062 _retn_type _retn (void); 00063 00064 /// TAO extension. 00065 _retn_type ptr (void) const; 00066 protected: 00067 T * ptr_; 00068 }; 00069 00070 /** 00071 * @class TAO_FixedSeq_Var_T 00072 * 00073 * @brief Parametrized implementation of _var class for sequences 00074 * whose element is of fixed size.. 00075 */ 00076 template <typename T> 00077 class TAO_FixedSeq_Var_T : public TAO_Seq_Var_Base_T<T> 00078 { 00079 public: 00080 typedef typename T::subscript_type T_elem; 00081 typedef typename T::const_subscript_type T_const_elem; 00082 00083 TAO_FixedSeq_Var_T (void); 00084 TAO_FixedSeq_Var_T (T *); 00085 TAO_FixedSeq_Var_T (const TAO_FixedSeq_Var_T<T> &); 00086 00087 // Fixed-size base types only. 00088 TAO_FixedSeq_Var_T (const T &); 00089 00090 TAO_FixedSeq_Var_T & operator= (T *); 00091 TAO_FixedSeq_Var_T & operator= (const TAO_FixedSeq_Var_T<T> &); 00092 00093 T_elem operator[] (CORBA::ULong index); 00094 T_const_elem operator[] (CORBA::ULong index) const; 00095 00096 /// Fixed-size base types only. 00097 TAO_FixedSeq_Var_T & operator= (const T &); 00098 }; 00099 00100 /** 00101 * @class TAO_VarSeq_Var_T 00102 * 00103 * @brief Parametrized implementation of _var class for sequences 00104 * whose element is of variable size.. 00105 * 00106 */ 00107 template <typename T> 00108 class TAO_VarSeq_Var_T : public TAO_Seq_Var_Base_T<T> 00109 { 00110 public: 00111 typedef typename T::subscript_type T_elem; 00112 typedef typename T::const_subscript_type T_const_elem; 00113 00114 TAO_VarSeq_Var_T (void); 00115 TAO_VarSeq_Var_T (T *); 00116 TAO_VarSeq_Var_T (const TAO_VarSeq_Var_T<T> &); 00117 00118 TAO_VarSeq_Var_T & operator= (T *); 00119 TAO_VarSeq_Var_T & operator= (const TAO_VarSeq_Var_T<T> &); 00120 00121 T_elem operator[] (CORBA::ULong index); 00122 T_const_elem operator[] (CORBA::ULong index) const; 00123 00124 /// Variable-size base types only. 00125 operator T *& (); 00126 }; 00127 00128 TAO_END_VERSIONED_NAMESPACE_DECL 00129 00130 #if defined (__ACE_INLINE__) 00131 #include "tao/Seq_Var_T.inl" 00132 #endif /* defined INLINE */ 00133 00134 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00135 #include "tao/Seq_Var_T.cpp" 00136 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00137 00138 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00139 #pragma implementation ("Seq_Var_T.cpp") 00140 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00141 00142 #include /**/ "ace/post.h" 00143 00144 #endif /* TAO_SEQ_VAROUT_T_H */