diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-01-08 17:01:10 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-01-08 17:01:10 +0000 |
commit | 8398a2529ea32d551d4c7b238ac1ecc527fb2a4e (patch) | |
tree | 6de26cbe41d155370e3641d620c1f7153f3d3d46 | |
parent | 1a43c355bbd12987536b2634e161e4912409daea (diff) | |
download | ATCD-8398a2529ea32d551d4c7b238ac1ecc527fb2a4e.tar.gz |
ChangeLogTag: Wed Jan 8 10:53:44 2003 Jeff Parsons <j.parsons@vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 23 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl | 9 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactoryC.h | 15 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp | 410 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h | 126 | ||||
-rw-r--r-- | TAO/tao/Typecode.cpp | 506 | ||||
-rw-r--r-- | TAO/tao/Typecode.h | 2 |
7 files changed, 759 insertions, 332 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 21df0e98ebf..6ffa8e5acb8 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,26 @@ +Wed Jan 8 10:53:44 2003 Jeff Parsons <j.parsons@vanderbilt.edu> + + * tao/Typecode.cpp: + * tao/Typecode.h: + + Added valuetype case to private_member_name, added + eventtype, component and home cases to other methods, + and updated comments in the header file. + + * tao/TypeCodeFactory/TypeCodeFactory.pidl: + * tao/TypeCodeFactory/TypeCodeFactoryC.cpp: + * tao/TypeCodeFactory/TypeCodeFactoryC.h: + * tao/TypeCodeFactory/TypeCodeFactoryC.inl: + + Added 'create_event_tc' to the TypeCodeFactory interface and + regenerated the code. + + * tao/TypeCodeFactory/TypeCodeFactory_i.cpp: + * tao/TypeCodeFactory/TypeCodeFactory_i.h: + + Filled in 'create_value_tc' method, added 'create_event_tc' + method, and factored out some common code. + Tue Dec 17 15:36:19 2002 Jeff Parsons <j.parsons@vanderbilt.edu> * tao/Any_T.inl(demarshal_value): diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl b/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl index 32bf8914593..4d2705ab82e 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory.pidl @@ -162,6 +162,7 @@ module CORBA in RepositoryId id, in Identifier name ); + TypeCode create_component_tc ( in RepositoryId id, in Identifier name @@ -171,6 +172,14 @@ module CORBA in RepositoryId id, in Identifier name ); + + TypeCode create_event_tc ( + in RepositoryId id, + in Identifier name, + in ValueModifier type_modifier, + in TypeCode concrete_base, + in ValueMemberSeq members + ); }; }; diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactoryC.h b/TAO/tao/TypeCodeFactory/TypeCodeFactoryC.h index 064f5160f51..c7a5be49bf9 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactoryC.h +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactoryC.h @@ -420,6 +420,21 @@ TAO_NAMESPACE CORBA )) = 0; // TAO_IDL - Generated from + // W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_operation/operation_ch.cpp:46 + + virtual CORBA::TypeCode_ptr create_event_tc ( + const char * id, + const char * name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq & members + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC (( + CORBA::SystemException + )) = 0; + + // TAO_IDL - Generated from // W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_interface/interface_ch.cpp:267 virtual void *_tao_QueryInterface (ptr_arith_t type); diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp index a4f1960780d..c2c527af796 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.cpp @@ -64,7 +64,7 @@ TAO_TypeCodeFactory_i::create_struct_tc ( const CORBA::StructMemberSeq &members ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->struct_except_tc_common (id, name, @@ -81,7 +81,7 @@ TAO_TypeCodeFactory_i::create_union_tc ( const CORBA::UnionMemberSeq &members ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { if (name != 0 && !this->valid_name (name)) { @@ -327,7 +327,7 @@ TAO_TypeCodeFactory_i::create_enum_tc ( const CORBA::EnumMemberSeq &members ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { if (name != 0 && !this->valid_name (name)) { @@ -400,7 +400,7 @@ TAO_TypeCodeFactory_i::create_alias_tc ( CORBA::TypeCode_ptr original_type ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { if (name != 0 && !this->valid_name (name)) { @@ -465,7 +465,7 @@ TAO_TypeCodeFactory_i::create_exception_tc ( const CORBA::StructMemberSeq &members ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->struct_except_tc_common (id, name, @@ -480,7 +480,7 @@ TAO_TypeCodeFactory_i::create_interface_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -493,27 +493,11 @@ TAO_TypeCodeFactory_i::create_string_tc ( CORBA::ULong bound ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO_OutputCDR cdr; - - cdr << TAO_ENCAP_BYTE_ORDER; - - cdr << bound; - - CORBA::TypeCode_ptr string_typecode = - CORBA::TypeCode::_nil (); - - ACE_NEW_THROW_EX (string_typecode, - CORBA_TypeCode (CORBA::tk_string, - cdr.total_length (), - cdr.buffer (), - 0, - 0), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - return string_typecode; + return this->string_wstring_tc_common (bound, + CORBA::tk_string + ACE_ENV_ARG_PARAMETER); } CORBA::TypeCode_ptr @@ -521,27 +505,11 @@ TAO_TypeCodeFactory_i::create_wstring_tc ( CORBA::ULong bound ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - TAO_OutputCDR cdr; - - cdr << TAO_ENCAP_BYTE_ORDER; - - cdr << bound; - - CORBA::TypeCode_ptr wstring_typecode = - CORBA::TypeCode::_nil (); - - ACE_NEW_THROW_EX (wstring_typecode, - CORBA_TypeCode (CORBA::tk_wstring, - cdr.total_length (), - cdr.buffer (), - 0, - 0), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - return wstring_typecode; + return this->string_wstring_tc_common (bound, + CORBA::tk_wstring + ACE_ENV_ARG_PARAMETER); } CORBA::TypeCode_ptr @@ -550,7 +518,7 @@ TAO_TypeCodeFactory_i::create_fixed_tc ( CORBA::UShort /* scale */ ACE_ENV_ARG_DECL_NOT_USED ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { // TODO return 0; @@ -562,46 +530,12 @@ TAO_TypeCodeFactory_i::create_sequence_tc ( CORBA::TypeCode_ptr element_type ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::Boolean valid_element = - this->valid_content_type (element_type - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - if (!valid_element) - { - ACE_THROW_RETURN (CORBA::BAD_TYPECODE (2, - CORBA::COMPLETED_NO), - CORBA::TypeCode::_nil ()); - } - - TAO_OutputCDR cdr; - - cdr << TAO_ENCAP_BYTE_ORDER; - - cdr << element_type; - - cdr << bound; - - ACE_Message_Block consolidated_block; - - ACE_CDR::consolidate (&consolidated_block, - cdr.begin ()); - - CORBA::TypeCode_ptr sequence_typecode = - CORBA::TypeCode::_nil (); - - ACE_NEW_THROW_EX (sequence_typecode, - CORBA_TypeCode (CORBA::tk_sequence, - consolidated_block.length (), - consolidated_block.rd_ptr (), - 0, - 0), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - return sequence_typecode; + return sequence_array_tc_common (bound, + element_type, + CORBA::tk_sequence + ACE_ENV_ARG_DECL); } CORBA::TypeCode_ptr @@ -610,61 +544,32 @@ TAO_TypeCodeFactory_i::create_array_tc ( CORBA::TypeCode_ptr element_type ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - CORBA::Boolean valid_element = - this->valid_content_type (element_type - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - if (!valid_element) - { - ACE_THROW_RETURN (CORBA::BAD_TYPECODE (2, - CORBA::COMPLETED_NO), - CORBA::TypeCode::_nil ()); - } - - TAO_OutputCDR cdr; - - cdr << TAO_ENCAP_BYTE_ORDER; - - cdr << element_type; - - cdr << length; - - ACE_Message_Block consolidated_block; - - ACE_CDR::consolidate (&consolidated_block, - cdr.begin ()); - - CORBA::TypeCode_ptr array_typecode = - CORBA::TypeCode::_nil (); - - ACE_NEW_THROW_EX (array_typecode, - CORBA_TypeCode (CORBA::tk_array, - consolidated_block.length (), - consolidated_block.rd_ptr (), - 0, - 0), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); - - return array_typecode; + return sequence_array_tc_common (length, + element_type, + CORBA::tk_array + ACE_ENV_ARG_DECL); } CORBA::TypeCode_ptr TAO_TypeCodeFactory_i::create_value_tc ( - const char * /* id */, - const char * /* name */, - CORBA::ValueModifier /* type_modifier */, - CORBA::TypeCode_ptr /* concrete_base */, - const CORBA::ValueMemberSeq & /* members */ - ACE_ENV_ARG_DECL_NOT_USED + const char *id, + const char *name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq &members + ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { - // TODO - return 0; + return this->value_event_tc_common (id, + name, + type_modifier, + concrete_base, + members, + CORBA::tk_value + ACE_ENV_ARG_DECL); } CORBA::TypeCode_ptr @@ -674,7 +579,7 @@ TAO_TypeCodeFactory_i::create_value_box_tc ( CORBA::TypeCode_ptr boxed_type ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { if (name != 0 && !this->valid_name (name)) { @@ -739,7 +644,7 @@ TAO_TypeCodeFactory_i::create_native_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -752,7 +657,7 @@ TAO_TypeCodeFactory_i::create_recursive_tc ( const char * /* id */ ACE_ENV_ARG_DECL_NOT_USED ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { // TODO return 0; @@ -764,7 +669,7 @@ TAO_TypeCodeFactory_i::create_abstract_interface_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -778,7 +683,7 @@ TAO_TypeCodeFactory_i::create_local_interface_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -792,7 +697,7 @@ TAO_TypeCodeFactory_i::create_component_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -806,7 +711,7 @@ TAO_TypeCodeFactory_i::create_home_tc ( const char *name ACE_ENV_ARG_DECL ) - ACE_THROW_SPEC ((CORBA::SystemException)) + ACE_THROW_SPEC ((CORBA::SystemException)) { return this->create_tc_common (id, name, @@ -814,6 +719,28 @@ TAO_TypeCodeFactory_i::create_home_tc ( ACE_ENV_ARG_PARAMETER); } +CORBA::TypeCode_ptr +TAO_TypeCodeFactory_i::create_event_tc ( + const char *id, + const char *name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq &members + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return this->value_event_tc_common (id, + name, + type_modifier, + concrete_base, + members, + CORBA::tk_event + ACE_ENV_ARG_DECL); +} + +// ===================================================================== + void TAO_TypeCodeFactory_i::compute_default_label ( CORBA::TCKind kind, @@ -1048,6 +975,84 @@ TAO_TypeCodeFactory_i::create_tc_common ( } CORBA::TypeCode_ptr +TAO_TypeCodeFactory_i::string_wstring_tc_common ( + CORBA::ULong bound, + CORBA::TCKind kind + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + TAO_OutputCDR cdr; + + cdr << TAO_ENCAP_BYTE_ORDER; + + cdr << bound; + + CORBA::TypeCode_ptr new_typecode = + CORBA::TypeCode::_nil (); + + ACE_NEW_THROW_EX (new_typecode, + CORBA_TypeCode (kind, + cdr.total_length (), + cdr.buffer (), + 0, + 0), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); + + return new_typecode; +} + +CORBA::TypeCode_ptr +TAO_TypeCodeFactory_i::sequence_array_tc_common ( + CORBA::ULong bound, + CORBA::TypeCode_ptr element_type, + CORBA::TCKind kind + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + CORBA::Boolean valid_element = + this->valid_content_type (element_type + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); + + if (!valid_element) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (2, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + TAO_OutputCDR cdr; + + cdr << TAO_ENCAP_BYTE_ORDER; + + cdr << element_type; + + cdr << bound; + + ACE_Message_Block consolidated_block; + + ACE_CDR::consolidate (&consolidated_block, + cdr.begin ()); + + CORBA::TypeCode_ptr new_typecode = + CORBA::TypeCode::_nil (); + + ACE_NEW_THROW_EX (new_typecode, + CORBA_TypeCode (kind, + consolidated_block.length (), + consolidated_block.rd_ptr (), + 0, + 0), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); + + return new_typecode; +} + +CORBA::TypeCode_ptr TAO_TypeCodeFactory_i::struct_except_tc_common ( const char *id, const char *name, @@ -1152,6 +1157,124 @@ TAO_TypeCodeFactory_i::struct_except_tc_common ( return new_typecode; } +CORBA::TypeCode_ptr +TAO_TypeCodeFactory_i::value_event_tc_common ( + const char *id, + const char *name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq &members, + CORBA::TCKind kind + ACE_ENV_ARG_DECL + ) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (name != 0 && !this->valid_name (name)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (15, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + // Repo id may not be null for valueboxtype. + if (id == 0 || !this->valid_id (id)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (16, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + TAO_OutputCDR cdr; + + cdr << TAO_ENCAP_BYTE_ORDER; + + cdr << id; + + cdr << name; + + cdr << type_modifier; + + if (CORBA::is_nil (concrete_base)) + { + cdr << CORBA::tk_null; + } + else + { + cdr << concrete_base; + } + + CORBA::ULong len = members.length (); + + cdr << len; + + CORBA::TypeCode_ptr tc_holder = CORBA::TypeCode::_nil (); + CORBA::Boolean valid_member = 1; + const char *member_name = 0; + ACE_Hash_Map_Manager<ACE_CString, int, ACE_Null_Mutex> map; + + for (CORBA::ULong index = 0; index < len; ++index) + { + // Valid member type? + tc_holder = members[index].type.in (); + + valid_member = this->valid_content_type (tc_holder + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); + + if (!valid_member) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (2, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + member_name = members[index].name; + + if (member_name == 0 || !this->valid_name (member_name)) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (15, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + ACE_CString ext_id (member_name); + int int_id = 0; + + // Is there a duplicate member name? + if (map.trybind (ext_id, int_id) != 0) + { + ACE_THROW_RETURN (CORBA::BAD_PARAM (17, + CORBA::COMPLETED_NO), + CORBA::TypeCode::_nil ()); + } + + cdr << member_name; + + cdr << tc_holder; + + cdr << members[index].access; + } + + ACE_Message_Block consolidated_block; + + ACE_CDR::consolidate (&consolidated_block, + cdr.begin ()); + + CORBA::TypeCode_ptr new_typecode = + CORBA::TypeCode::_nil (); + + ACE_NEW_THROW_EX (new_typecode, + CORBA_TypeCode (kind, + consolidated_block.length (), + consolidated_block.rd_ptr (), + 0, + 0), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); + + return new_typecode; +} + CORBA::Boolean TAO_TypeCodeFactory_i::valid_name (const char *name) { @@ -1180,7 +1303,9 @@ TAO_TypeCodeFactory_i::valid_name (const char *name) CORBA::Boolean TAO_TypeCodeFactory_i::valid_id (const char *id) { - ACE_CString safety (id); + ACE_CString safety (id, + 0, + 0); int pos = safety.find (':'); @@ -1386,7 +1511,6 @@ TAO_TypeCodeFactory_i::valid_disc_type (CORBA::TypeCode_ptr tc || kind == CORBA::tk_ushort || kind == CORBA::tk_short || kind == CORBA::tk_char - || kind == CORBA::tk_wchar || kind == CORBA::tk_boolean || kind == CORBA::tk_longlong || kind == CORBA::tk_ulonglong) diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h index 5bc62f0b2b6..72dcbdaee62 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_i.h @@ -58,8 +58,8 @@ public: const char *id, const char *name, const CORBA::StructMemberSeq &members - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_union_tc ( @@ -67,72 +67,72 @@ public: const char *name, CORBA::TypeCode_ptr discriminator_type, const CORBA::UnionMemberSeq &members - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_enum_tc ( const char *id, const char *name, const CORBA::EnumMemberSeq &members - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_alias_tc ( const char *id, const char *name, CORBA::TypeCode_ptr original_type - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_exception_tc ( const char *id, const char *name, const CORBA::StructMemberSeq &members - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_interface_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_string_tc ( CORBA::ULong bound - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_wstring_tc ( CORBA::ULong bound - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_fixed_tc ( CORBA::UShort digits, CORBA::UShort scale - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_sequence_tc ( CORBA::ULong bound, CORBA::TypeCode_ptr element_type - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_array_tc ( CORBA::ULong length, CORBA::TypeCode_ptr element_type - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_value_tc ( @@ -141,57 +141,67 @@ public: CORBA::ValueModifier type_modifier, CORBA::TypeCode_ptr concrete_base, const CORBA::ValueMemberSeq &members - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_value_box_tc ( const char *id, const char *name, CORBA::TypeCode_ptr boxed_type - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_native_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_recursive_tc ( const char *id - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_abstract_interface_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_local_interface_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_component_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) - + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); virtual CORBA::TypeCode_ptr create_home_tc ( const char *id, const char *name - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + virtual CORBA::TypeCode_ptr create_event_tc ( + const char *id, + const char *name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq &members + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); private: @@ -206,8 +216,25 @@ private: const char *id, const char *name, CORBA::TCKind kind - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Code for strings and wstrings is identical except for TCKind. + CORBA::TypeCode_ptr string_wstring_tc_common ( + CORBA::ULong bound, + CORBA::TCKind kind + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + /// Code for arrays and sequences is identical except for TCKind. + CORBA::TypeCode_ptr sequence_array_tc_common ( + CORBA::ULong bound, + CORBA::TypeCode_ptr element_type, + CORBA::TCKind kind + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); /// Code for structs and unions is identical except for TCKind. @@ -216,8 +243,29 @@ private: const char *name, const CORBA::StructMemberSeq &members, CORBA::TCKind kind - ACE_ENV_ARG_DECL_WITH_DEFAULTS) + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + + /// Code for aliases and boxed valuetypes is identical except for TCKind. + CORBA::TypeCode_ptr alias_value_box_tc_common ( + const char *id, + const char *name, + CORBA::TypeCode_ptr underlying_type, + CORBA::TCKiond kind + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) + ACE_THROW_SPEC ((CORBA::SystemException)); + CORBA::TypeCode_ptr value_event_tc_common ( + const char *id, + const char *name, + CORBA::ValueModifier type_modifier, + CORBA::TypeCode_ptr concrete_base, + const CORBA::ValueMemberSeq &members, + CORBA::TCKind kind + ACE_ENV_ARG_DECL_WITH_DEFAULTS + ) ACE_THROW_SPEC ((CORBA::SystemException)); /// If any of these fail, we raise a spec-defined minor code diff --git a/TAO/tao/Typecode.cpp b/TAO/tao/Typecode.cpp index 8fe41e5999a..3738b0dbd32 100644 --- a/TAO/tao/Typecode.cpp +++ b/TAO/tao/Typecode.cpp @@ -854,10 +854,11 @@ CORBA_TypeCode::equ_common (CORBA::TypeCode_ptr tc, ACE_CHECK_RETURN (0); if (kind != other_kind) - // simple case - return 0; + { + return 0; + } - // typecode kinds are same + // Typecode kinds are same. return rcvr->private_equal (tcvar.in (), equiv_only ACE_ENV_ARG_PARAMETER); @@ -865,14 +866,16 @@ CORBA_TypeCode::equ_common (CORBA::TypeCode_ptr tc, CORBA::TCKind kind = tc->kind (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); + if (this->kind_ != kind) - // simple case - return 0; + { + return 0; + } // typecode kinds are same return this->private_equal (tc, equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); } // check if typecodes are equal. Equality is based on a mix of structural @@ -952,7 +955,10 @@ CORBA_TypeCode::private_equal (CORBA::TypeCode_ptr tc, return this->private_equal_valuetype (tc, equiv_only ACE_ENV_ARG_PARAMETER); - + case CORBA::tk_component: + case CORBA::tk_home: + case CORBA::tk_event: + // TODO case ~0u: // indirection { // indirection offset must be same @@ -996,18 +1002,23 @@ CORBA_TypeCode::private_equal_objref ( const char *tcname = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - if ((ACE_OS::strlen (myname) > 1) && - (ACE_OS::strlen (tcname) > 1)) + if (ACE_OS::strlen (myname) > 1 && ACE_OS::strlen (tcname) > 1) { - // both of them specify names, compare them - if (!ACE_OS::strcmp (myname, tcname)) - return 1; // success + // Both of them specify names, compare them + if (ACE_OS::strcmp (myname, tcname) == 0) + { + return 1; // success + } else - return 0; // failed + { + return 0; // failed + } } + return 1; // success } } + return 0; // failed } @@ -1037,7 +1048,9 @@ CORBA_TypeCode::private_equal_struct ( { // Equality of repoIDs is sufficient for equivalence. if (equiv_only) - return 1; + { + return 1; + } } } @@ -1054,7 +1067,9 @@ CORBA_TypeCode::private_equal_struct ( if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1 && ACE_OS::strcmp (my_name, tc_name)) // not same - return 0; + { + return 0; + } } // Check if the member count is same. @@ -1065,7 +1080,9 @@ CORBA_TypeCode::private_equal_struct ( ACE_CHECK_RETURN (0); if (my_count != tc_count) - return 0; // number of members don't match + { + return 0; // number of members don't match + } // The checks below tell if we have a recursive struct. CORBA::TypeCode_ptr par = this->parent_; @@ -1166,7 +1183,9 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, { // Equality of repoIDs is sufficient for equivalence. if (equiv_only) - return 1; + { + return 1; + } } } @@ -1182,9 +1201,10 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, // Compare names if they exist. if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1 - && ACE_OS::strcmp (my_name, - tc_name)) // not same - return 0; + && ACE_OS::strcmp (my_name, tc_name)) // not same + { + return 0; + } } // check if the discriminant type is same @@ -1198,13 +1218,15 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, CORBA::Boolean status = my_discrim->equ_common (tc_discrim.in (), equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (!status) - return 0; + { + return 0; + } - // check the default used + // Check the default used. CORBA::Long my_default = this->default_index (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -1212,7 +1234,9 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, ACE_CHECK_RETURN (0); if (my_default != tc_default) - return 0; + { + return 0; + } // check if the member count is same CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -1222,57 +1246,72 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, ACE_CHECK_RETURN (0); if (my_count != tc_count) - return 0; // number of members don't match + { + return 0; + } // The checks below indicate that we have a recursive union. CORBA::TypeCode_ptr par = this->parent_; + if (par != 0) { if (this->tc_base_ == this->root_tc_base_) - return 1; + { + return 1; + } CORBA::TypeCode_ptr tc_par = tc->parent_; + if (tc_par) { CORBA::TypeCode_ptr gpar = par->parent_; CORBA::TypeCode_ptr tc_gpar = tc_par->parent_; + if (gpar != 0 && tc_gpar != 0 && this->tc_base_ == gpar->tc_base_ && tc->tc_base_ == tc_gpar->tc_base_) - return 1; + { + return 1; + } } } - for (CORBA::ULong i = 0; i < my_count; i++) + for (CORBA::ULong i = 0; i < my_count; ++i) { // First check if labels are same. // Check if member names are same - skipped by equivalent(). if (!equiv_only) { - const char *my_member_name = this->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *my_member_name = + this->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - const char *tc_member_name = tc->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *tc_member_name = + tc->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (ACE_OS::strlen (my_member_name) > 1 && ACE_OS::strlen (tc_member_name) > 1 && ACE_OS::strcmp (my_member_name, tc_member_name)) // not same - return 0; + { + return 0; + } } // now compare the typecodes of the members - CORBA::TypeCode_var my_member_tc = this->member_type (i - ACE_ENV_ARG_PARAMETER); + CORBA::TypeCode_var my_member_tc = + this->member_type (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - CORBA::TypeCode_var tc_member_tc = tc->member_type (i - ACE_ENV_ARG_PARAMETER); + CORBA::TypeCode_var tc_member_tc = + tc->member_type (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); // One of our members may be recursive, but not through us. @@ -1280,15 +1319,19 @@ CORBA_TypeCode::private_equal_union (CORBA::TypeCode_ptr tc, && my_member_tc->parent_ == tc_member_tc->parent_ && my_member_tc->tc_base_ == tc_member_tc->tc_base_ && my_member_tc->root_tc_base_ == tc_member_tc->root_tc_base_) - continue; + { + continue; + } CORBA::Boolean flag = my_member_tc->equ_common (tc_member_tc.in (), equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - if (!flag) - return 0; + if (flag == 0) + { + return 0; + } } return 1; // success @@ -1318,7 +1361,9 @@ CORBA_TypeCode::private_equal_enum (CORBA::TypeCode_ptr tc, { // Equality of repoIDs is sufficient for equivalence. if (equiv_only) - return 1; + { + return 1; + } } } @@ -1334,12 +1379,13 @@ CORBA_TypeCode::private_equal_enum (CORBA::TypeCode_ptr tc, // Compare names if they exist. if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1 - && ACE_OS::strcmp (my_name, - tc_name)) // not same - return 0; + && ACE_OS::strcmp (my_name, tc_name)) // not same + { + return 0; + } } - // check if the member count is same + // Check if the member count is same. CORBA::ULong my_count = this->member_count (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -1347,26 +1393,31 @@ CORBA_TypeCode::private_equal_enum (CORBA::TypeCode_ptr tc, ACE_CHECK_RETURN (0); if (my_count != tc_count) - return 0; // number of members don't match + { + return 0; + } - for (CORBA::ULong i=0; i < my_count; i++) + for (CORBA::ULong i=0; i < my_count; ++i) { // Check if member names are same - skipped by equivalent(). if (!equiv_only) { - const char *my_member_name = this->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *my_member_name = + this->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - const char *tc_member_name = tc->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *tc_member_name = + tc->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (ACE_OS::strlen (my_member_name) > 1 && ACE_OS::strlen (tc_member_name) > 1 - && ACE_OS::strcmp (my_member_name, - tc_member_name)) // not same - return 0; + && ACE_OS::strcmp (my_member_name, tc_member_name)) // not same + { + return 0; + } } } @@ -1416,19 +1467,23 @@ CORBA_TypeCode::private_equal_sequence ( { // this involves comparing the typecodes of the element type as well // as the bounds - CORBA::TypeCode_var my_elem = this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TypeCode_var my_elem = + this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - CORBA::TypeCode_var tc_elem = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TypeCode_var tc_elem = + tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); CORBA::Boolean status = my_elem->equ_common (tc_elem.in (), equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - if (!status) - return 0; + if (status == 0) + { + return 0; + } // now check if bounds are same CORBA::ULong my_len = this->length (ACE_ENV_SINGLE_ARG_PARAMETER); @@ -1445,10 +1500,10 @@ CORBA_TypeCode::private_equal_array (CORBA::TypeCode_ptr tc, CORBA::Boolean equiv_only ACE_ENV_ARG_DECL) const { - // exactly like sequence + // Exactly like sequence return this->private_equal_sequence (tc, equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); } CORBA::Boolean @@ -1456,7 +1511,7 @@ CORBA_TypeCode::private_equal_alias (CORBA::TypeCode_ptr tc, CORBA::Boolean equiv_only ACE_ENV_ARG_DECL) const { - // for structs the repoID and names are optional. However, if provided, + // For structs the repoID and names are optional. However, if provided, // we must compare them const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -1470,26 +1525,36 @@ CORBA_TypeCode::private_equal_alias (CORBA::TypeCode_ptr tc, const char *tc_name = tc->name (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - // compare repoIDs if they exist + // Compare repoIDs if they exist. if (ACE_OS::strlen (my_id) > 1 && ACE_OS::strlen (tc_id) > 1) - if (ACE_OS::strcmp (my_id, tc_id)) // not same - return 0; + { + if (ACE_OS::strcmp (my_id, tc_id)) // not same + { + return 0; + } + } - // compare names if they exist + // Compare names if they exist. if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1) - if (ACE_OS::strcmp (my_name, tc_name)) // not same - return 0; + { + if (ACE_OS::strcmp (my_name, tc_name)) // not same + { + return 0; + } + } // now compare element typecodes - CORBA::TypeCode_var my_elem = this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TypeCode_var my_elem = + this->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); - CORBA::TypeCode_var tc_elem = tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::TypeCode_var tc_elem = + tc->content_type (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); return my_elem->equ_common (tc_elem.in (), equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); } CORBA::Boolean @@ -1497,7 +1562,7 @@ CORBA_TypeCode::private_equal_except (CORBA::TypeCode_ptr tc, CORBA::Boolean equiv_only ACE_ENV_ARG_DECL) const { - // exactly similar to structs, except that the repository ID is mandatory + // Exactly similar to structs, except that the repository ID is mandatory const char *my_id = this->id (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (0); @@ -1513,7 +1578,9 @@ CORBA_TypeCode::private_equal_except (CORBA::TypeCode_ptr tc, { // Equality of repoIDs is sufficient for equivalence. if (equiv_only) - return 1; + { + return 1; + } } // Now compare names. They may be optional - skipped by equivalent(). @@ -1528,9 +1595,10 @@ CORBA_TypeCode::private_equal_except (CORBA::TypeCode_ptr tc, // Compare names if they exist. if (ACE_OS::strlen (my_name) > 1 && ACE_OS::strlen (tc_name) > 1 - && ACE_OS::strcmp (my_name, - tc_name)) // not same - return 0; + && ACE_OS::strcmp (my_name, tc_name)) // not same + { + return 0; + } } // check if the member count is same @@ -1541,42 +1609,51 @@ CORBA_TypeCode::private_equal_except (CORBA::TypeCode_ptr tc, ACE_CHECK_RETURN (0); if (my_count != tc_count) - return 0; // number of members don't match + { + return 0; // number of members don't match + } - for (CORBA::ULong i=0; i < my_count; i++) + for (CORBA::ULong i=0; i < my_count; ++i) { // Check if member names are same - skipped by equivalent(). if (!equiv_only) { - const char *my_member_name = this->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *my_member_name = + this->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - const char *tc_member_name = tc->member_name (i - ACE_ENV_ARG_PARAMETER); + const char *tc_member_name = + tc->member_name (i + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (ACE_OS::strlen (my_member_name) > 1 && ACE_OS::strlen (tc_member_name) > 1 - && ACE_OS::strcmp (my_member_name, - tc_member_name)) // not same - return 0; + && ACE_OS::strcmp (my_member_name, tc_member_name)) // not same + { + return 0; + } } // now compare the typecodes of the members - CORBA::TypeCode_var my_member_tc = this->member_type (i ACE_ENV_ARG_PARAMETER); + CORBA::TypeCode_var my_member_tc = + this->member_type (i ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - CORBA::TypeCode_var tc_member_tc = tc->member_type (i ACE_ENV_ARG_PARAMETER); + CORBA::TypeCode_var tc_member_tc = + tc->member_type (i ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); CORBA::Boolean flag = my_member_tc->equ_common (tc_member_tc.in (), equiv_only - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - if (!flag) - return 0; + if (flag == 0) + { + return 0; + } } return 1; // success @@ -1620,14 +1697,20 @@ CORBA_TypeCode::private_equal_valuetype ( (ACE_OS::strlen (tcname) > 1)) { // both of them specify names, compare them - if (!ACE_OS::strcmp (myname, tcname)) - return 1; // success + if (ACE_OS::strcmp (myname, tcname) == 0) + { + return 1; // success + } else - return 0; // failed + { + return 0; // failed + } } + return 1; // success } } + return 0; // failed } @@ -1655,12 +1738,20 @@ CORBA_TypeCode::private_id (ACE_ENV_SINGLE_ARG_DECL) const case CORBA::tk_alias: case CORBA::tk_except: case CORBA::tk_value: + case CORBA::tk_component: + case CORBA::tk_home: + case CORBA::tk_event: { // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - this->private_state_->mutex_, 0); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->private_state_->mutex_, + 0); + if (this->private_state_->tc_id_known_) - return this->private_state_->tc_id_; + { + return this->private_state_->tc_id_; + } this->private_state_->tc_id_known_ = 1; this->private_state_->tc_id_ = (ACE_const_cast (char *, buffer_) @@ -1673,7 +1764,8 @@ CORBA_TypeCode::private_id (ACE_ENV_SINGLE_ARG_DECL) const } // No other typecodes ever have type IDs default: - ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0); + ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), + 0); } } @@ -1695,12 +1787,20 @@ CORBA_TypeCode::private_name (ACE_ENV_SINGLE_ARG_DECL) const case CORBA::tk_alias: case CORBA::tk_except: case CORBA::tk_value: + case CORBA::tk_component: + case CORBA::tk_home: + case CORBA::tk_event: { // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - this->private_state_->mutex_, 0); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->private_state_->mutex_, + 0); + if (this->private_state_->tc_name_known_) - return this->private_state_->tc_name_; + { + return this->private_state_->tc_name_; + } // setup an encapsulation. TAO_InputCDR stream (this->buffer_ + 4, @@ -1718,7 +1818,10 @@ CORBA_TypeCode::private_name (ACE_ENV_SINGLE_ARG_DECL) const return this->private_state_->tc_name_; } else - ACE_THROW_RETURN (CORBA::INTERNAL (), (char*)0); + { + ACE_THROW_RETURN (CORBA::INTERNAL (), + 0); + } } // No other typecodes ever have type IDs. default: @@ -1738,6 +1841,7 @@ CORBA_TypeCode::private_member_count (ACE_ENV_SINGLE_ARG_DECL) const switch (kind_) { case CORBA::tk_alias: + case CORBA::tk_value_box: return 1; case CORBA::tk_enum: @@ -1891,7 +1995,8 @@ CORBA::TypeCode_ptr CORBA_TypeCode::private_member_type (CORBA::ULong slot ACE_ENV_ARG_DECL) const { - CORBA::ULong temp, mcount; + CORBA::ULong temp = 0; + CORBA::ULong mcount = 0; // Build the de-encapsulating CDR stream, bypassing the stringent // alignment tests (we're a bit looser in what we need here, and we @@ -1899,7 +2004,7 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot TAO_InputCDR stream (this->buffer_+4, this->length_-4, this->byte_order_); - CORBA::TypeCode_var tc = 0; + CORBA::TypeCode_var tc; switch (kind_) { @@ -1914,6 +2019,7 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot guard, this->private_state_->mutex_, CORBA::TypeCode::_nil ()); + if (this->private_state_->tc_member_type_list_known_) { if (slot < mcount) @@ -2083,17 +2189,17 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot CORBA::TypeCode::_nil ()); if (this->private_state_->tc_member_type_list_known_) - { - if (slot < mcount) - { - return this->private_state_->tc_member_type_list_[slot]; - } - else - { - ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), - CORBA::TypeCode::_nil ()); - } - } + { + if (slot < mcount) + { + return this->private_state_->tc_member_type_list_[slot]; + } + else + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + CORBA::TypeCode::_nil ()); + } + } // the first time in. Precompute and store types of all members @@ -2101,7 +2207,6 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot ACE_NEW_THROW_EX (this->private_state_->tc_member_type_list_, CORBA::TypeCode_ptr [mcount], CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); // skip rest of header (type ID, name, etc) and collect the @@ -2152,7 +2257,7 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot // compute the typecodes for all the members and // return the required one. - for (CORBA::ULong i = 0; i < mcount; i++) + for (CORBA::ULong i = 0; i < mcount; ++i) // the ith entry will have the typecode of the ith guy { if (!stream.skip_string ()) // skip the name @@ -2199,8 +2304,8 @@ CORBA_TypeCode::private_member_type (CORBA::ULong slot } // Return the name for the nth member -// Applicable only to CORBA::tk_struct, CORBA::tk_union, CORBA::tk_enum, and -// CORBA::tk_except +// Applicable only to CORBA::tk_struct, CORBA::tk_union, CORBA::tk_enum, +// CORBA::tk_except, tk_value and tk_event. const char * CORBA_TypeCode::private_member_name (CORBA::ULong slot ACE_ENV_ARG_DECL) const @@ -2210,7 +2315,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot // Build the de-encapsulating CDR stream, bypassing the stringent // alignment tests (we're a bit looser in what we need here, and we // _know_ we're OK). Then skip the byte order code. - TAO_InputCDR stream (this->buffer_+4, this->length_-4, + TAO_InputCDR stream (this->buffer_+4, + this->length_-4, this->byte_order_); CORBA::TypeCode_var tc = 0; @@ -2219,14 +2325,23 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot ACE_CHECK_RETURN ((char *)0); // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, - this->private_state_->mutex_, 0); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, + this->private_state_->mutex_, + 0); if (this->private_state_->tc_member_name_list_known_) - if (slot < mcount) - return this->private_state_->tc_member_name_list_[slot]; - else - ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0); + { + if (slot < mcount) + { + return this->private_state_->tc_member_name_list_[slot]; + } + else + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); + } + } // the first time in. Precompute and store names of all members // Allocate a list to hold the member names @@ -2234,11 +2349,13 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot char* [mcount], CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); - // this->private_state_->tc_member_name_list_ = new char* [mcount]; if (this->private_state_->tc_member_name_list_ == 0) - // no memory for the member_list - ACE_THROW_RETURN (CORBA::NO_MEMORY (), (char *)0); + { + // No memory for the member_list. + ACE_THROW_RETURN (CORBA::NO_MEMORY (), + 0); + } switch (kind_) { @@ -2282,10 +2399,13 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot for (CORBA::ULong i = 0; i < mcount; i++) { if (!stream.read_string ( - this->private_state_->tc_member_name_list_ [i] + this->private_state_->tc_member_name_list_[i] ) - || !this->skip_typecode (stream)) - ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), 0); + || !this->skip_typecode (stream)) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } } this->private_state_->tc_member_name_list_known_ = 1; @@ -2317,13 +2437,13 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot // required one ACE_CHECK_RETURN (0); - for (CORBA::ULong i = 0; i < mcount; i++) + for (CORBA::ULong i = 0; i < mcount; ++i) { // the ith entry will have the name of the ith member CORBA::TypeCode::traverse_status status = TAO_Marshal_Object::perform_skip (disc_tc, &stream - ACE_ENV_ARG_PARAMETER); + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (status != CORBA::TypeCode::TRAVERSE_CONTINUE) @@ -2340,19 +2460,101 @@ CORBA_TypeCode::private_member_name (CORBA::ULong slot this->private_state_->tc_member_name_list_known_ = 1; if (slot < mcount) - return this->private_state_->tc_member_name_list_[slot]; + { + return this->private_state_->tc_member_name_list_[slot]; + } else - ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), (char *)0); + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); + } + } + } + ACE_NOTREACHED (break;) + + case CORBA::tk_value: + { + // Skip rest of header (type ID, name, etc) and skip the + // number of value members. + CORBA::ULong tc_kind_holder; + CORBA::TCKind tc_kind; + if (!stream.skip_string () // ID + || !stream.skip_string () // Name + || !stream.skip_short () // ValueModifier + || !stream.read_ulong (tc_kind_holder)) // Base's TCKind + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } + + tc_kind = ACE_static_cast (CORBA::TCKind, tc_kind_holder); + + // The tc_kind can be either tk_null or tk_value. + // In the latter case we should skip encapsulation or + // indirection - whatever comes in. + CORBA::ULong encap_length; + + if (tc_kind != CORBA::tk_null) + { + if (!stream.read_ulong (encap_length)) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } + + if (tc_kind_holder != 0xffffffff) // check for indirection + { + if (!stream.skip_bytes (encap_length)) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } + } + } + + // Now skip member count. + if (!stream.skip_ulong ()) + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } + + // Compute the names for all the members, skip the other + // member parameters and return the required name. + for (CORBA::ULong i = 0; i < mcount; ++i) + { + if (!stream.read_string ( + this->private_state_->tc_member_name_list_[i] + ) + || !this->skip_typecode (stream) // member typecode + || !stream.skip_short ()) // member visibility + { + ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), + 0); + } + } + + this->private_state_->tc_member_name_list_known_ = 1; + + if (slot < mcount) + { + return this->private_state_->tc_member_name_list_[slot]; + } + else + { + ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), + 0); } } ACE_NOTREACHED (break;) default: - // bad kind - ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), (char *)0); + // Bad kind. + ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), + 0); } - ACE_NOTREACHED (return (char *)0;) + ACE_NOTREACHED (return 0;) } // Return member labels for CORBA::tk_union typecodes. @@ -2721,7 +2923,8 @@ CORBA::Visibility CORBA_TypeCode::private_member_visibility (CORBA::ULong slot ACE_ENV_ARG_DECL) const { - if (this->kind_ != CORBA::tk_value) + if (this->kind_ != CORBA::tk_value + && this->kind_ != CORBA::tk_event) { ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), CORBA::PRIVATE_MEMBER); @@ -2737,7 +2940,8 @@ CORBA_TypeCode::private_member_visibility (CORBA::ULong slot } // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, this->private_state_->mutex_, 0); @@ -2790,14 +2994,16 @@ CORBA_TypeCode::private_member_visibility (CORBA::ULong slot CORBA::ValueModifier CORBA_TypeCode::private_type_modifier (ACE_ENV_SINGLE_ARG_DECL) const { - if (this->kind_ != CORBA::tk_value) + if (this->kind_ != CORBA::tk_value + && this->kind_ != CORBA::tk_event) { ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), 0); } // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, this->private_state_->mutex_, 0); @@ -2833,16 +3039,18 @@ CORBA_TypeCode::private_type_modifier (ACE_ENV_SINGLE_ARG_DECL) const CORBA::TypeCode_ptr CORBA_TypeCode::private_concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const { - if (this->kind_ != CORBA::tk_value) + if (this->kind_ != CORBA::tk_value + && this->kind_ != CORBA::tk_event) { ACE_THROW_RETURN (CORBA::TypeCode::BadKind (), - 0); + CORBA::TypeCode::_nil ()); } // Double checked locking... - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + guard, this->private_state_->mutex_, - 0); + CORBA::TypeCode::_nil ()); if (this->private_state_->tc_concrete_base_type_known_) { @@ -2861,7 +3069,7 @@ CORBA_TypeCode::private_concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const || !stream.skip_short ()) // ValueModifier { ACE_THROW_RETURN (CORBA::BAD_TYPECODE (), - 0); + CORBA::TypeCode::_nil ()); } // Retrieve the concrete base typecode. @@ -2869,7 +3077,7 @@ CORBA_TypeCode::private_concrete_base_type (ACE_ENV_SINGLE_ARG_DECL) const stream, this->private_state_->tc_concrete_base_type_ ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + ACE_CHECK_RETURN (CORBA::TypeCode::_nil ()); this->private_state_->tc_concrete_base_type_known_ = 1; return this->private_state_->tc_concrete_base_type_; diff --git a/TAO/tao/Typecode.h b/TAO/tao/Typecode.h index 8de4c4c04ba..45a56af938a 100644 --- a/TAO/tao/Typecode.h +++ b/TAO/tao/Typecode.h @@ -131,7 +131,7 @@ public: CORBA::ULong member_count (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS) const; /// Returns member_name (...), raises (BadKind, Bounds); Useful for - /// tk_struct, tk_union, tk_enum, tk_alias, and tk_except. + /// tk_struct, tk_union, tk_enum, tk_alias, tk_except and tk_value. const char *member_name (CORBA::ULong slot ACE_ENV_ARG_DECL_WITH_DEFAULTS) const; |