00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TAO_RECURSIVE_TYPE_TYPECODE_H
00017 #define TAO_RECURSIVE_TYPE_TYPECODE_H
00018
00019 #include "ace/pre.h"
00020
00021 #include "tao/Basic_Types.h"
00022 #include "tao/Typecode_typesC.h"
00023 #include "ace/Recursive_Thread_Mutex.h"
00024
00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00026
00027 namespace TAO
00028 {
00029 namespace TypeCode
00030 {
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 template <class TypeCodeBase,
00045 typename TypeCodeType,
00046 typename MemberArrayType>
00047 class Recursive_Type
00048 : public TypeCodeBase
00049 {
00050 public:
00051
00052
00053 Recursive_Type (CORBA::TCKind kind,
00054 char const * id,
00055 char const * name,
00056 MemberArrayType const & fields,
00057 CORBA::ULong nfields);
00058
00059
00060 Recursive_Type (char const * id,
00061 char const * name,
00062 #if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
00063
00064
00065
00066 TypeCodeType discriminant_type,
00067 #else
00068 TypeCodeType const & discriminant_type,
00069 #endif
00070 MemberArrayType const & cases,
00071 CORBA::ULong ncases,
00072 CORBA::Long default_index);
00073
00074
00075 Recursive_Type (CORBA::TCKind kind,
00076 char const * id,
00077 char const * name,
00078 CORBA::ValueModifier modifier,
00079 #if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
00080
00081
00082
00083 TypeCodeType concrete_base,
00084 #else
00085 TypeCodeType const & concrete_base,
00086 #endif
00087 MemberArrayType const & fields,
00088 CORBA::ULong nfields);
00089
00090
00091 Recursive_Type (CORBA::TCKind kind,
00092 char const * id);
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 virtual bool tao_marshal_kind (TAO_OutputCDR & cdr) const;
00109 virtual bool tao_marshal (TAO_OutputCDR & cdr,
00110 CORBA::ULong offset) const;
00111
00112
00113 protected:
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124 virtual CORBA::Boolean equal_i (CORBA::TypeCode_ptr tc) const;
00125 virtual CORBA::Boolean equivalent_i (CORBA::TypeCode_ptr tc) const;
00126
00127
00128 public:
00129
00130
00131 void struct_parameters (char const * name,
00132 MemberArrayType const & fields,
00133 CORBA::ULong nfields);
00134
00135
00136 void union_parameters (
00137 char const * name,
00138 #if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
00139
00140
00141
00142 TypeCodeType discriminant_type,
00143 #else
00144 TypeCodeType const & discriminant_type,
00145 #endif
00146 MemberArrayType const & cases,
00147 CORBA::ULong ncases,
00148 CORBA::Long default_index);
00149
00150
00151 void valuetype_parameters (char const * name,
00152 CORBA::ValueModifier modifier,
00153 #if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
00154
00155
00156
00157 TypeCodeType concrete_base,
00158 #else
00159 TypeCodeType const & concrete_base,
00160 #endif
00161 MemberArrayType const & fields,
00162 CORBA::ULong nfields);
00163
00164 private:
00165
00166
00167
00168
00169
00170
00171
00172
00173 class Reset
00174 {
00175 public:
00176 Reset (bool & flag) : flag_ (flag) { }
00177 ~Reset (void) { this->flag_ = false; }
00178 private:
00179 bool & flag_;
00180 };
00181
00182 private:
00183
00184
00185 mutable TAO_SYNCH_RECURSIVE_MUTEX lock_;
00186
00187
00188
00189
00190
00191
00192
00193 mutable bool in_recursion_;
00194
00195 };
00196
00197 }
00198 }
00199
00200 TAO_END_VERSIONED_NAMESPACE_DECL
00201
00202
00203 #ifdef __ACE_INLINE__
00204 # include "tao/AnyTypeCode/Recursive_Type_TypeCode.inl"
00205 #endif
00206
00207 #ifdef ACE_TEMPLATES_REQUIRE_SOURCE
00208 # include "tao/AnyTypeCode/Recursive_Type_TypeCode.cpp"
00209 #endif
00210
00211 #ifdef ACE_TEMPLATES_REQUIRE_PRAGMA
00212 # pragma implementation ("Recursive_Type_TypeCode.cpp")
00213 #endif
00214
00215 #include "ace/post.h"
00216
00217 #endif