summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-05-09 09:21:24 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-05-09 09:21:24 +0000
commit703a929a55add1c83da0bd2490e0b310d96cbe75 (patch)
tree59196d46e92c0bb0be108134f37e1c4344df9037
parentbaaca2b3b253251a61925b175dcddde815ede191 (diff)
downloadATCD-703a929a55add1c83da0bd2490e0b310d96cbe75.tar.gz
ChangeLogTag:Mon May 9 01:56:32 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/tao/Recursive_Type_TypeCode.h36
-rw-r--r--TAO/tao/Recursive_Type_TypeCode.inl71
-rw-r--r--TAO/tao/Struct_TypeCode.h11
-rw-r--r--TAO/tao/Struct_TypeCode.inl22
-rw-r--r--TAO/tao/TypeCode_CDR_Extraction.cpp628
-rw-r--r--TAO/tao/TypeCode_CDR_Extraction.h123
-rw-r--r--TAO/tao/Union_TypeCode.h15
-rw-r--r--TAO/tao/Union_TypeCode.inl22
-rw-r--r--TAO/tao/Value_TypeCode.h15
-rw-r--r--TAO/tao/Value_TypeCode.inl22
11 files changed, 791 insertions, 189 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 3d1cfeaea27..e1385d1c99e 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Mon May 9 01:56:32 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
+
+ * tao/Recursive_Type_TypeCode.h:
+ * tao/Recursive_Type_TypeCode.inl:
+ * tao/Struct_TypeCode.h:
+ * tao/Struct_TypeCode.inl:
+ * tao/TypeCode_CDR_Extraction.cpp:
+ * tao/TypeCode_CDR_Extraction.h:
+ * tao/Union_TypeCode.h:
+ * tao/Union_TypeCode.inl:
+ * tao/Value_TypeCode.h:
+ * tao/Value_TypeCode.inl:
+
+ Enabled recursive TypeCode demarshaling/creation.
+
Sun May 8 07:59:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl>
* tao/tao.mpc:
diff --git a/TAO/tao/Recursive_Type_TypeCode.h b/TAO/tao/Recursive_Type_TypeCode.h
index e8b2a8e1ec5..dcb55c99e9b 100644
--- a/TAO/tao/Recursive_Type_TypeCode.h
+++ b/TAO/tao/Recursive_Type_TypeCode.h
@@ -83,6 +83,11 @@ namespace TAO
MemberArrayType const & fields,
CORBA::ULong nfields);
+ /// Dynamic @c Recursive_Type TypeCode constructor.
+ Recursive_Type (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
/**
* @name TAO-specific @c CORBA::TypeCode Methods
*
@@ -111,6 +116,37 @@ namespace TAO
ACE_ENV_ARG_DECL) const;
//@}
+ /// Set @c struct @c TypeCode parameters.
+ void struct_parameters (MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
+ /// Set @c union @c TypeCode parameters.
+ void union_parameters (
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index);
+
+ /// Set @c valuetype or @c eventtype @c TypeCode parameters.
+ void valuetype_parameters (CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ // Borland C++ currently can't handle a
+ // reference to const pointer to const
+ // CORBA::TypeCode_ptr.
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields);
+
private:
/// Internal state thread synchronization mutex.
diff --git a/TAO/tao/Recursive_Type_TypeCode.inl b/TAO/tao/Recursive_Type_TypeCode.inl
index 73d9fd699d4..ef6a97d4ccc 100644
--- a/TAO/tao/Recursive_Type_TypeCode.inl
+++ b/TAO/tao/Recursive_Type_TypeCode.inl
@@ -75,3 +75,74 @@ TAO::TypeCode::Recursive_Type<TypeCodeBase,
, in_recursion_ (false)
{
}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::Recursive_Type (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name)
+ : TypeCodeBase (kind, id, name)
+ , lock_ ()
+ , starting_offset_ (0)
+ , in_recursion_ (false)
+{
+// ACE_ASSERT (kind == CORBA::tk_struct
+// || kind == CORBA::tk_union
+// || kind == CORBA::tk_value
+// || kind == CORBA::tk_event);
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::struct_parameters (
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+{
+ this->fields_ = fields;
+ this->nfields_ = nfields;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::union_parameters (
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType discriminant_type,
+#else
+ TypeCodeType const & discriminant_type,
+#endif
+ MemberArrayType const & cases,
+ CORBA::ULong ncases,
+ CORBA::Long default_index)
+{
+ this->discriminant_type_ = discriminant_type;
+ this->cases_ = cases;
+ this->ncases_ = ncases;
+ this->default_index_ = default_index;
+}
+
+template <class TypeCodeBase, typename TypeCodeType, typename MemberArrayType>
+ACE_INLINE void
+TAO::TypeCode::Recursive_Type<TypeCodeBase,
+ TypeCodeType,
+ MemberArrayType>::valuetype_parameters (
+ CORBA::ValueModifier modifier,
+#if defined (__BORLANDC__) && (__BORLANDC__ < 0x572)
+ TypeCodeType concrete_base,
+#else
+ TypeCodeType const & concrete_base,
+#endif
+ MemberArrayType const & fields,
+ CORBA::ULong nfields)
+{
+ this->type_modifier_ = modifier;
+ this->concrete_base_ = concrete_base;
+ this->fields_ = fields;
+ this->nfields_ = nfields;
+}
diff --git a/TAO/tao/Struct_TypeCode.h b/TAO/tao/Struct_TypeCode.h
index dfde6fe1773..2429f258725 100644
--- a/TAO/tao/Struct_TypeCode.h
+++ b/TAO/tao/Struct_TypeCode.h
@@ -60,6 +60,11 @@ namespace TAO
FieldArrayType const & fields,
CORBA::ULong nfields);
+ /// Constructor used for recursive TypeCodes.
+ Struct (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
/**
* @name TAO-specific @c CORBA::TypeCode Methods
*
@@ -100,7 +105,7 @@ namespace TAO
ACE_ENV_ARG_DECL) const;
//@}
- private:
+ protected:
/**
* @c Struct Attributes
@@ -119,11 +124,11 @@ namespace TAO
Base_Attributes<StringType> const base_attributes_;
/// The number of fields in the OMG IDL structure.
- CORBA::ULong const nfields_;
+ CORBA::ULong nfields_;
/// Array of @c TAO::TypeCode fields representing structure of the
/// OMG IDL defined @c struct.
- FieldArrayType const fields_;
+ FieldArrayType fields_;
//@}
diff --git a/TAO/tao/Struct_TypeCode.inl b/TAO/tao/Struct_TypeCode.inl
index 739c81cf00e..92113c56bac 100644
--- a/TAO/tao/Struct_TypeCode.inl
+++ b/TAO/tao/Struct_TypeCode.inl
@@ -24,3 +24,25 @@ TAO::TypeCode::Struct<StringType,
, fields_ (fields)
{
}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Struct<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Struct (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name)
+ : CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , nfields_ (0)
+ , fields_ ()
+{
+ // CORBA::tk_except is not allowed in the recursive TypeCode case.
+ // ACE_ASSERT (kind == CORBA::tk_struct);
+}
diff --git a/TAO/tao/TypeCode_CDR_Extraction.cpp b/TAO/tao/TypeCode_CDR_Extraction.cpp
index 2d2205b4ef7..28811ed0c48 100644
--- a/TAO/tao/TypeCode_CDR_Extraction.cpp
+++ b/TAO/tao/TypeCode_CDR_Extraction.cpp
@@ -17,6 +17,8 @@
#include "tao/Union_TypeCode.h"
#include "tao/Value_TypeCode.h"
+#include "tao/Recursive_Type_TypeCode.h"
+
#include "tao/TypeCode_Case_T.h"
#include "tao/TypeCode_Struct_Field.h"
#include "tao/TypeCode_Value_Field.h"
@@ -29,6 +31,33 @@ ACE_RCSID (tao,
"$Id$")
+namespace TAO
+{
+ namespace TypeCodeFactory
+ {
+ // An array of TC_Info objects is used instead of a map of
+ // repository IDs to TypeCodes since it is presumed that the
+ // number of directly or indirectly embedded types in a TypeCode
+ // capable of holding another TypeCode will be small enough to
+ // make traversing a list faster than performing a map lookup.
+ // Use a simple array also reduces static and run-time footprint.
+
+ struct TC_Info
+ {
+ /// Constructor.
+ TC_Info (void) : id (0), type () {}
+
+ /// Repository ID.
+ char const * id;
+
+ /// TypeCode
+ CORBA::TypeCode_ptr type;
+ };
+
+ typedef ACE_Array_Base<TC_Info> TC_Info_List;
+ }
+}
+
namespace
{
bool start_cdr_encap_extraction (TAO_InputCDR & cdr)
@@ -48,12 +77,59 @@ namespace
return true;
}
+
+ // ---------------------------------------------------------
+
+ CORBA::ULong const TYPECODE_INDIRECTION = 0xffffffff;
+
+ // ---------------------------------------------------------
+
+ // Use an ACE::Value_Ptr to provide exception safety and proper
+ // copying semantics.
+ typedef ACE::Value_Ptr<TAO::TypeCode::Case<CORBA::String_var, CORBA::TypeCode_var> > union_elem_type;
+ typedef ACE_Array_Base<union_elem_type> union_case_array_type;
+
+ // ------------------------------------------------------------
+
+ /// Demarshal a TypeCode.
+ bool tc_demarshal (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos);
+
+ /// Demarshal an indirected TypeCode.
+ bool tc_demarshal_indirection (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos);
+
+ bool find_recursive_tc (char const * id,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ // See comments above for rationale behind using an array instead
+ // of a map.
+
+ size_t const len = infos.size ();
+
+ for (size_t i = 0; i < len; ++i)
+ {
+ TAO::TypeCodeFactory::TC_Info & info = infos[i];
+
+ if (ACE_OS::strcmp (info.id, id) == 0)
+ {
+ tc = info.type;
+ return true;
+ }
+ }
+
+ return false;
+ }
}
bool
TAO::TypeCodeFactory::tc_null_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_null);
@@ -63,7 +139,8 @@ TAO::TypeCodeFactory::tc_null_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_void_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_void);
@@ -73,7 +150,8 @@ TAO::TypeCodeFactory::tc_void_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_short_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_short);
@@ -83,7 +161,8 @@ TAO::TypeCodeFactory::tc_short_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_long_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_long);
@@ -93,7 +172,8 @@ TAO::TypeCodeFactory::tc_long_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_ushort_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ushort);
@@ -103,7 +183,8 @@ TAO::TypeCodeFactory::tc_ushort_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_ulong_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ulong);
@@ -113,7 +194,8 @@ TAO::TypeCodeFactory::tc_ulong_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_float_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_float);
@@ -123,7 +205,8 @@ TAO::TypeCodeFactory::tc_float_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_double_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_double);
@@ -133,7 +216,8 @@ TAO::TypeCodeFactory::tc_double_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_boolean_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_boolean);
@@ -143,7 +227,8 @@ TAO::TypeCodeFactory::tc_boolean_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_char_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_char);
@@ -153,7 +238,8 @@ TAO::TypeCodeFactory::tc_char_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_octet_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_octet);
@@ -163,7 +249,8 @@ TAO::TypeCodeFactory::tc_octet_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_any_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_any);
@@ -173,7 +260,8 @@ TAO::TypeCodeFactory::tc_any_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_TypeCode_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_TypeCode);
@@ -183,7 +271,8 @@ TAO::TypeCodeFactory::tc_TypeCode_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_Principal_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_Principal);
@@ -193,7 +282,8 @@ TAO::TypeCodeFactory::tc_Principal_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_objref_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
// The remainder of a tk_objref TypeCode is encoded in a CDR
// encapsulation.
@@ -276,7 +366,8 @@ TAO::TypeCodeFactory::tc_objref_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_struct_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
ACE_ASSERT (kind == CORBA::tk_struct || kind == CORBA::tk_except);
@@ -294,31 +385,54 @@ TAO::TypeCodeFactory::tc_struct_factory (CORBA::TCKind kind,
&& cdr >> nfields))
return false;
- ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
- CORBA::TypeCode_var> >
- fields (nfields);
+ typedef ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ member_array_type;
+
+ member_array_type fields (nfields);
for (CORBA::ULong i = 0; i < nfields; ++i)
{
if (!(cdr >> TAO_InputCDR::to_string (fields[i].name.out (), 0)
- && cdr >> fields[i].type.out ()))
+ && tc_demarshal (cdr, fields[i].type.out (), infos)))
return false;
}
typedef TAO::TypeCode::Struct<
CORBA::String_var,
CORBA::TypeCode_var,
- ACE_Array_Base<TAO::TypeCode::Struct_Field<CORBA::String_var,
- CORBA::TypeCode_var> >,
+ member_array_type,
TAO::True_RefCount_Policy> typecode_type;
- ACE_NEW_RETURN (tc,
- typecode_type (kind,
- id.in (),
- name.in (),
- fields, // Will be copied.
- nfields),
- false);
+
+ // Check if struct TypeCode is recursive.
+ if (kind == CORBA::tk_struct && find_recursive_tc (id, tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (tc);
+
+ ACE_ASSERT (rtc);
+
+ rtc->struct_parameters (fields,
+ nfields);
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in (),
+ fields, // Will be copied.
+ nfields),
+ false);
+ }
return true;
}
@@ -326,7 +440,8 @@ TAO::TypeCodeFactory::tc_struct_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
// The remainder of a tk_enum TypeCode is encoded in a CDR
// encapsulation.
@@ -343,7 +458,7 @@ TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
&& cdr >> TAO_InputCDR::to_string (name.out (), 0)
- && cdr >> discriminant_type.out ()))
+ && cdr >> discriminant_type.out ())) // No need to use tc_demarshal()
return false;
ACE_DECLARE_NEW_CORBA_ENV;
@@ -368,11 +483,8 @@ TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
&& cdr >> ncases))
return false;
- // Use an ACE::Value_Ptr to provide exception safety and proper
- // copying semantics.
- typedef ACE::Value_Ptr<TAO::TypeCode::Case<CORBA::String_var,
- CORBA::TypeCode_var> > elem_type;
- typedef ACE_Array_Base<elem_type> case_array_type;
+ typedef union_elem_type elem_type;
+ typedef union_case_array_type case_array_type;
case_array_type cases (ncases);
@@ -519,7 +631,7 @@ TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
CORBA::TypeCode_var the_type;
if (!(cdr >> TAO_InputCDR::to_string (the_name.out (), 0)
- && cdr >> the_type.out ()))
+ && tc_demarshal (cdr, the_type.out (), infos)))
return false;
member->name (the_name.in ());
@@ -531,14 +643,37 @@ TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
case_array_type,
TAO::True_RefCount_Policy> typecode_type;
- ACE_NEW_RETURN (tc,
- typecode_type (id.in (),
- name.in (),
- discriminant_type,
- cases, // Will be copied.
- ncases,
- default_index),
- false);
+ // Check if union TypeCode is recursive.
+ if (find_recursive_tc (id, tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ case_array_type>
+ recursive_typecode_type;
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (tc);
+
+ ACE_ASSERT (rtc);
+
+ rtc->union_parameters (discriminant_type,
+ cases, // Will be copied.
+ ncases,
+ default_index);
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (id.in (),
+ name.in (),
+ discriminant_type,
+ cases, // Will be copied.
+ ncases,
+ default_index),
+ false);
+ }
return true;
}
@@ -546,7 +681,8 @@ TAO::TypeCodeFactory::tc_union_factory (CORBA::TCKind /* kind */,
bool
TAO::TypeCodeFactory::tc_enum_factory (CORBA::TCKind /* kind */,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
// The remainder of a tk_enum TypeCode is encoded in a CDR
// encapsulation.
@@ -589,7 +725,8 @@ TAO::TypeCodeFactory::tc_enum_factory (CORBA::TCKind /* kind */,
bool
TAO::TypeCodeFactory::tc_string_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
// A tk_string/tk_wstring TypeCode has a simple parameter list,
// i.e. it is not encoded in a CDR encapsulation.
@@ -623,7 +760,8 @@ TAO::TypeCodeFactory::tc_string_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_sequence_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
// The remainder of a tk_sequence TypeCode is encoded in a CDR
// encapsulation.
@@ -635,7 +773,7 @@ TAO::TypeCodeFactory::tc_sequence_factory (CORBA::TCKind kind,
CORBA::TypeCode_var content_type;
CORBA::ULong length;
- if (!(cdr >> content_type.out ()
+ if (!(tc_demarshal (cdr, content_type.out (), infos)
&& cdr >> length))
return false;
@@ -653,15 +791,17 @@ TAO::TypeCodeFactory::tc_sequence_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_array_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_sequence_factory (kind, cdr, tc);
+ return tc_sequence_factory (kind, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
// The remainder of a tk_alias or tk_value_box TypeCode is encoded
// in a CDR encapsulation.
@@ -674,7 +814,7 @@ TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind kind,
CORBA::TypeCode_var content_type;
if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
&& cdr >> TAO_InputCDR::to_string (name.out (), 0)
- && cdr >> content_type.out ()))
+ && tc_demarshal (cdr, content_type.out (), infos)))
return false;
typedef TAO::TypeCode::Alias<
@@ -695,15 +835,17 @@ TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_except_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_struct_factory (kind, cdr, tc);
+ return tc_struct_factory (kind, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_longlong_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_longlong);
@@ -713,7 +855,8 @@ TAO::TypeCodeFactory::tc_longlong_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_ulonglong_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_ulonglong);
@@ -723,7 +866,8 @@ TAO::TypeCodeFactory::tc_ulonglong_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_longdouble_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_longdouble);
@@ -733,7 +877,8 @@ TAO::TypeCodeFactory::tc_longdouble_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_wchar_factory (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
tc = CORBA::TypeCode::_duplicate (CORBA::_tc_wchar);
@@ -743,15 +888,17 @@ TAO::TypeCodeFactory::tc_wchar_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_wstring_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_string_factory (kind, cdr, tc);
+ return tc_string_factory (kind, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_fixed_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List &)
{
// A tk_fixed TypeCode has a simple parameter list, i.e. it is not
// encoded in a CDR encapsulation.
@@ -772,7 +919,8 @@ TAO::TypeCodeFactory::tc_fixed_factory (CORBA::TCKind,
bool
TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
// The remainder of a tk_value/tk_event TypeCode is encoded in a
// CDR encapsulation
@@ -814,9 +962,11 @@ TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
&& cdr >> nfields))
return false;
- ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
- CORBA::TypeCode_var> >
- fields (nfields);
+ typedef ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
+ CORBA::TypeCode_var> >
+ member_array_type;
+
+ member_array_type fields (nfields);
for (CORBA::ULong i = 0; i < nfields; ++i)
{
@@ -824,7 +974,7 @@ TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
CORBA::TypeCode_var> & field = fields[i];
if (!(cdr >> TAO_InputCDR::to_string (field.name.out (), 0)
- && cdr >> field.type.out ()
+ && tc_demarshal (cdr, field.type.out (), infos)
&& cdr >> field.visibility))
return false;
}
@@ -832,19 +982,41 @@ TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
typedef TAO::TypeCode::Value<
CORBA::String_var,
CORBA::TypeCode_var,
- ACE_Array_Base<TAO::TypeCode::Value_Field<CORBA::String_var,
- CORBA::TypeCode_var> >,
+ member_array_type,
TAO::True_RefCount_Policy> typecode_type;
- ACE_NEW_RETURN (tc,
- typecode_type (kind,
- id.in (),
- name.in (),
- type_modifier,
+ // Check if valuetype/eventtype TypeCode is recursive.
+ if (find_recursive_tc (id, tc, infos))
+ {
+ // Set remaining parameters.
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ recursive_typecode_type * const rtc =
+ dynamic_cast<recursive_typecode_type *> (tc);
+
+ ACE_ASSERT (rtc);
+
+ rtc->valuetype_parameters (type_modifier,
concrete_base,
fields, // Will be copied.
- nfields),
- false);
+ nfields);
+ }
+ else
+ {
+ ACE_NEW_RETURN (tc,
+ typecode_type (kind,
+ id.in (),
+ name.in (),
+ type_modifier,
+ concrete_base,
+ fields, // Will be copied.
+ nfields),
+ false);
+ }
return true;
}
@@ -852,57 +1024,284 @@ TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind,
bool
TAO::TypeCodeFactory::tc_value_box_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_alias_factory (kind, cdr, tc);
+ return tc_alias_factory (kind, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_native_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_objref_factory (CORBA::tk_native, cdr, tc);
+ return tc_objref_factory (CORBA::tk_native, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_abstract_interface_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_objref_factory (CORBA::tk_abstract_interface, cdr, tc);
+ return tc_objref_factory (CORBA::tk_abstract_interface, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_local_interface_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_objref_factory (CORBA::tk_local_interface, cdr, tc);
+ return tc_objref_factory (CORBA::tk_local_interface, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_component_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_objref_factory (CORBA::tk_component, cdr, tc);
+ return tc_objref_factory (CORBA::tk_component, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_home_factory (CORBA::TCKind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_objref_factory (CORBA::tk_home, cdr, tc);
+ return tc_objref_factory (CORBA::tk_home, cdr, tc, infos);
}
bool
TAO::TypeCodeFactory::tc_event_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc)
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos)
{
- return tc_value_factory (kind, cdr, tc);
+ return tc_value_factory (kind, cdr, tc, infos);
+}
+
+// ---------------------------------------------------------------
+
+namespace
+{
+ bool
+ tc_demarshal (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ CORBA::TCKind kind;
+ if (!(cdr >> kind)
+ || (kind >= CORBA::TAO_TC_KIND_COUNT
+ && static_cast<CORBA::ULong> (kind) != TYPECODE_INDIRECTION))
+ return false;
+
+ if (static_cast<CORBA::ULong> (kind) == TYPECODE_INDIRECTION)
+ return tc_demarshal_indirection (cdr, tc, infos);
+
+ using namespace TAO::TypeCodeFactory;
+
+ static factory const factory_map[] =
+ {
+ tc_null_factory,
+ tc_void_factory,
+ tc_short_factory,
+ tc_long_factory,
+ tc_ushort_factory,
+ tc_ulong_factory,
+ tc_float_factory,
+ tc_double_factory,
+ tc_boolean_factory,
+ tc_char_factory,
+ tc_octet_factory,
+ tc_any_factory,
+ tc_TypeCode_factory,
+ tc_Principal_factory,
+ tc_objref_factory,
+ tc_struct_factory,
+ tc_union_factory,
+ tc_enum_factory,
+ tc_string_factory,
+ tc_sequence_factory,
+ tc_array_factory,
+ tc_alias_factory,
+ tc_except_factory,
+ tc_longlong_factory,
+ tc_ulonglong_factory,
+ tc_longdouble_factory,
+ tc_wchar_factory,
+ tc_wstring_factory,
+ tc_fixed_factory,
+ tc_value_factory,
+ tc_value_box_factory,
+ tc_native_factory,
+ tc_abstract_interface_factory,
+ tc_local_interface_factory,
+ tc_component_factory,
+ tc_home_factory,
+ tc_event_factory
+ };
+
+ return factory_map[kind] (kind, cdr, tc, infos);
+ }
+
+ bool
+ tc_demarshal_indirection (TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TAO::TypeCodeFactory::TC_Info_List & infos)
+ {
+ CORBA::Long offset;
+
+ if (!(cdr >> offset) || offset < -4)
+ {
+ // Offsets must be negative since they point back to a
+ // TypeCode found earlier in the CDR stream. They must be
+ // less than -4 since an offset of -4 points back to the
+ // indirection TypeCode itself, meaning that it would be
+ // self-indirecting.
+ return false;
+ }
+
+ ACE_Message_Block * const mb =
+ const_cast<ACE_Message_Block *> (cdr.start ());
+
+ TAO_InputCDR indir_stream (mb->rd_ptr () + offset - 4,
+ -1 * (offset - 4),
+ cdr.byte_order ());
+
+ if (!indir_stream.good_bit ())
+ {
+ return false;
+ }
+
+ CORBA::TCKind kind;
+ if (!(cdr >> kind)
+
+ // Indirected TypeCode must point to top-level TypeCode.
+ || static_cast<CORBA::ULong> (kind) == TYPECODE_INDIRECTION
+
+ // Only struct, union and valuetype TypeCodes may be recursive.
+ || !(kind == CORBA::tk_struct
+ || kind == CORBA::tk_union
+ || kind == CORBA::tk_value
+ || kind == CORBA::tk_event)
+
+ // Currently all recursive TypeCodes have complex parameter
+ // lists, meaning they are encoded as CDR encapsulations.
+ || !start_cdr_encap_extraction (indir_stream))
+ return false;
+
+ /**
+ * @todo Recursive TypeCode demarshaling is currently suboptimal
+ * due to redundant demarshaling of TypeCode parameters,
+ * such as repository ID, and excessive
+ * allocations/copying.
+ */
+
+ CORBA::String_var id, name;
+ if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0)
+ && cdr >> TAO_InputCDR::to_string (name.out (), 0)))
+ return false;
+
+ // Don't bother demarshaling the rest of the parameters. They will
+ // be handled by the top-level TypeCode demarshaling call.
+
+ switch (kind)
+ {
+ case CORBA::tk_struct:
+ {
+ typedef ACE_Array_Base<
+ TAO::TypeCode::Struct_Field<
+ CORBA::String_var,
+ CORBA::TypeCode_var> > member_array_type;
+
+ typedef TAO::TypeCode::Struct<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in (),
+ name.in ()),
+ false);
+ }
+ break;
+ case CORBA::tk_union:
+ {
+ typedef union_case_array_type member_array_type;
+
+ typedef TAO::TypeCode::Union<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in (),
+ name.in ()),
+ false);
+ }
+ break;
+ case CORBA::tk_value:
+ case CORBA::tk_event:
+ {
+ typedef ACE_Array_Base<
+ TAO::TypeCode::Value_Field<
+ CORBA::String_var,
+ CORBA::TypeCode_var> > member_array_type;
+
+ typedef TAO::TypeCode::Value<
+ CORBA::String_var,
+ CORBA::TypeCode_var,
+ member_array_type,
+ TAO::True_RefCount_Policy> typecode_type;
+
+ typedef TAO::TypeCode::Recursive_Type<typecode_type,
+ CORBA::TypeCode_var,
+ member_array_type>
+ recursive_typecode_type;
+
+ ACE_NEW_RETURN (tc,
+ recursive_typecode_type (kind,
+ id.in (),
+ name.in ()),
+ false);
+ }
+ break;
+ default:
+ return false; // We should never get here.
+ };
+
+ size_t const old_size = infos.size ();
+ if (infos.size (old_size + 1) == -1) // Incremental growth -- *sigh*
+ return false;
+
+ TAO::TypeCodeFactory::TC_Info & info = infos[old_size];
+
+ ACE_DECLARE_NEW_CORBA_ENV;
+ info.id = tc->id (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (false); // Should never throw!
+
+ info.type = tc;
+
+ return true;
+ }
}
// ----------------------------------------------------------------
@@ -911,52 +1310,7 @@ bool
operator>> (TAO_InputCDR & cdr,
CORBA::TypeCode_ptr & tc)
{
- CORBA::TCKind kind;
- if (!(cdr >> kind) || kind >= CORBA::TAO_TC_KIND_COUNT)
- return false;
-
- using namespace TAO::TypeCodeFactory;
-
- static factory const factory_map[] =
- {
- tc_null_factory,
- tc_void_factory,
- tc_short_factory,
- tc_long_factory,
- tc_ushort_factory,
- tc_ulong_factory,
- tc_float_factory,
- tc_double_factory,
- tc_boolean_factory,
- tc_char_factory,
- tc_octet_factory,
- tc_any_factory,
- tc_TypeCode_factory,
- tc_Principal_factory,
- tc_objref_factory,
- tc_struct_factory,
- tc_union_factory,
- tc_enum_factory,
- tc_string_factory,
- tc_sequence_factory,
- tc_array_factory,
- tc_alias_factory,
- tc_except_factory,
- tc_longlong_factory,
- tc_ulonglong_factory,
- tc_longdouble_factory,
- tc_wchar_factory,
- tc_wstring_factory,
- tc_fixed_factory,
- tc_value_factory,
- tc_value_box_factory,
- tc_native_factory,
- tc_abstract_interface_factory,
- tc_local_interface_factory,
- tc_component_factory,
- tc_home_factory,
- tc_event_factory
- };
+ TAO::TypeCodeFactory::TC_Info_List infos;
- return factory_map[kind] (kind, cdr, tc);
+ return tc_demarshal (cdr, tc, infos);
}
diff --git a/TAO/tao/TypeCode_CDR_Extraction.h b/TAO/tao/TypeCode_CDR_Extraction.h
index 7c648ea4e62..b7571fbfbf4 100644
--- a/TAO/tao/TypeCode_CDR_Extraction.h
+++ b/TAO/tao/TypeCode_CDR_Extraction.h
@@ -24,123 +24,168 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
+template <class T> class ACE_Array_Base;
+
namespace TAO
{
namespace TypeCodeFactory
{
+ struct TC_Info;
+ typedef ACE_Array_Base<TC_Info> TC_Info_List;
typedef bool (*factory) (CORBA::TCKind,
TAO_InputCDR &,
- CORBA::TypeCode_ptr &);
+ CORBA::TypeCode_ptr &,
+ TC_Info_List &);
bool tc_null_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_void_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_short_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_long_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_ushort_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_ulong_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_float_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_double_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_boolean_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_char_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_octet_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_any_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_TypeCode_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_Principal_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_objref_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_struct_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_union_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_enum_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_string_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_sequence_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_array_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_alias_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_except_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_longlong_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_ulonglong_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_longdouble_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_wchar_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_wstring_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_fixed_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_value_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_value_box_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
- bool tc_native_factory (CORBA::TCKind kind, TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
+ bool tc_native_factory (CORBA::TCKind kind,
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_abstract_interface_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_local_interface_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_component_factory (CORBA::TCKind kind,
TAO_InputCDR & cdr,
- CORBA::TypeCode_ptr & tc);
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_home_factory (CORBA::TCKind kind,
- TAO_InputCDR & cdr, CORBA::TypeCode_ptr & tc);
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
bool tc_event_factory (CORBA::TCKind kind,
- TAO_InputCDR & cdr, CORBA::TypeCode_ptr & tc);
+ TAO_InputCDR & cdr,
+ CORBA::TypeCode_ptr & tc,
+ TC_Info_List & infos);
} // End namespace TypeCodeFactory
} // End namespace TAO
diff --git a/TAO/tao/Union_TypeCode.h b/TAO/tao/Union_TypeCode.h
index 0d04fd9798e..c8977ec5115 100644
--- a/TAO/tao/Union_TypeCode.h
+++ b/TAO/tao/Union_TypeCode.h
@@ -68,6 +68,11 @@ namespace TAO
CORBA::ULong ncases,
CORBA::Long default_index);
+ /// Constructor used for recursive TypeCodes.
+ Union (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
/**
* @name TAO-specific @c CORBA::TypeCode Methods
*
@@ -112,7 +117,7 @@ namespace TAO
virtual CORBA::Long default_index_i (ACE_ENV_SINGLE_ARG_DECL) const;
//@}
- private:
+ protected:
/**
* @c Union Attributes
@@ -131,22 +136,22 @@ namespace TAO
Base_Attributes<StringType> const base_attributes_;
/// Type of IDL @c union discriminant.
- TypeCodeType const discriminant_type_;
+ TypeCodeType discriminant_type_;
/// Index of the default union case.
/**
* This value will be -1 if no default case is found in the
* union.
*/
- CORBA::Long const default_index_;
+ CORBA::Long default_index_;
/// The number of cases in the OMG IDL union, excluding the
/// @c default case.
- CORBA::ULong const ncases_;
+ CORBA::ULong ncases_;
/// Array of @c TAO::TypeCode::Case representing structure of
/// the OMG IDL defined @c union.
- CaseArrayType const cases_;
+ CaseArrayType cases_;
//@}
diff --git a/TAO/tao/Union_TypeCode.inl b/TAO/tao/Union_TypeCode.inl
index 758d3a8ecab..8d1143bfb07 100644
--- a/TAO/tao/Union_TypeCode.inl
+++ b/TAO/tao/Union_TypeCode.inl
@@ -32,3 +32,25 @@ TAO::TypeCode::Union<StringType,
, cases_ (cases)
{
}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class CaseArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Union<StringType,
+ TypeCodeType,
+ CaseArrayType,
+ RefCountPolicy>::Union (
+ CORBA::TCKind,
+ char const * id,
+ char const * name)
+ : CORBA::TypeCode (CORBA::tk_union)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , discriminant_type_ (0)
+ , default_index_ (-1)
+ , ncases_ (0)
+ , cases_ ()
+{
+}
diff --git a/TAO/tao/Value_TypeCode.h b/TAO/tao/Value_TypeCode.h
index 773514d4020..77cbf51f801 100644
--- a/TAO/tao/Value_TypeCode.h
+++ b/TAO/tao/Value_TypeCode.h
@@ -69,6 +69,11 @@ namespace TAO
FieldArrayType const & fields,
CORBA::ULong nfields);
+ /// Constructor used for recursive TypeCodes.
+ Value (CORBA::TCKind kind,
+ char const * id,
+ char const * name);
+
/**
* @name TAO-specific @c CORBA::TypeCode Methods
*
@@ -115,7 +120,7 @@ namespace TAO
ACE_ENV_SINGLE_ARG_DECL) const;
//@}
- private:
+ protected:
/**
* @c Valuetype Attributes
@@ -135,18 +140,18 @@ namespace TAO
/// The @c ValueModifier of the @c valuetype of @c eventtype
/// represented by this @c TypeCode.
- CORBA::ValueModifier const type_modifier_;
+ CORBA::ValueModifier type_modifier_;
/// The @c TypeCode corresponding to the concrete base
/// @c valuetype or @c eventtype.
- TypeCodeType const concrete_base_;
+ TypeCodeType concrete_base_;
/// The number of fields in the OMG IDL value.
- CORBA::ULong const nfields_;
+ CORBA::ULong nfields_;
/// Array of @c TAO::TypeCode fields representing structure of the
/// OMG IDL defined @c value.
- FieldArrayType const fields_;
+ FieldArrayType fields_;
//@}
diff --git a/TAO/tao/Value_TypeCode.inl b/TAO/tao/Value_TypeCode.inl
index 7a98d173246..cc53a493250 100644
--- a/TAO/tao/Value_TypeCode.inl
+++ b/TAO/tao/Value_TypeCode.inl
@@ -34,3 +34,25 @@ TAO::TypeCode::Value<StringType,
, fields_ (fields)
{
}
+
+template <typename StringType,
+ typename TypeCodeType,
+ class FieldArrayType,
+ class RefCountPolicy>
+ACE_INLINE
+TAO::TypeCode::Value<StringType,
+ TypeCodeType,
+ FieldArrayType,
+ RefCountPolicy>::Value (
+ CORBA::TCKind kind,
+ char const * id,
+ char const * name)
+ : CORBA::TypeCode (kind)
+ , RefCountPolicy ()
+ , base_attributes_ (id, name)
+ , type_modifier_ (CORBA::VM_NONE)
+ , concrete_base_ ()
+ , nfields_ (0)
+ , fields_ ()
+{
+}