diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-04-14 22:08:59 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-04-14 22:08:59 +0000 |
commit | 5c07c2b08a78f000c47b1c8685c52c2381845db8 (patch) | |
tree | 81c8603b0f712b7abc6486e9dc68b5b0a37cb986 | |
parent | c6885f6fe94b7fc47ac62bac511e28c0c20a3761 (diff) | |
download | ATCD-5c07c2b08a78f000c47b1c8685c52c2381845db8.tar.gz |
ChangeLogTag:Thu Apr 14 15:03:01 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
-rw-r--r-- | TAO/ChangeLog | 29 | ||||
-rw-r--r-- | TAO/tao/Makefile.am | 3 | ||||
-rw-r--r-- | TAO/tao/Objref_TypeCode_Factory.h | 278 | ||||
-rw-r--r-- | TAO/tao/TypeCode.cpp | 27 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/Objref_TypeCode_Factory.h | 159 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp | 55 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h | 4 | ||||
-rw-r--r-- | TAO/tao/TypeCodeFactory_Adapter.h | 4 | ||||
-rw-r--r-- | TAO/tao/TypeCode_CDR_Extraction.cpp (renamed from TAO/tao/TypeCodeFactory/Factory_Map.cpp) | 137 | ||||
-rw-r--r-- | TAO/tao/TypeCode_CDR_Extraction.h (renamed from TAO/tao/TypeCodeFactory/Factory_Map.h) | 10 | ||||
-rw-r--r-- | TAO/tao/tao.mpc | 2 |
11 files changed, 402 insertions, 306 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index d5c1d751974..a075af152dd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,32 @@ +Thu Apr 14 15:03:01 2005 Ossama Othman <ossama@dre.vanderbilt.edu> + + * tao/TypeCode.cpp (operator>>): + + Moved TypeCode CDR extraction operator to the new + TypeCode_CDR_Extraction.* file. + + * tao/Objref_TypeCode_Factory.h: + * tao/TypeCode_CDR_Extraction.cpp: + * tao/TypeCode_CDR_Extraction.h: + * tao/TypeCodeFactory/Factory_Map.cpp: + * tao/TypeCodeFactory/Factory_Map.h: + * tao/TypeCodeFactory/Objref_TypeCode_Factory.h: + + Moved CDR extraction code back to core TAO library. It will be + moved to a separate library in the next beta. + + * tao/TypeCodeFactory_Adapter.h (extract_typecode): + * tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp: + * tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h: + + Removed the extract_typecode() virtual method. CDR TypeCode + extraction is now done in the core TAO library. + + * tao/Makefile.am: + * tao/tao.mpc: + + Updated source file lists in accordance with the above changes. + Thu Apr 14 14:33:22 2005 Ossama Othman <ossama@dre.vanderbilt.edu> * tao/TypeCode.h (unaliased_kind): diff --git a/TAO/tao/Makefile.am b/TAO/tao/Makefile.am index ca1a016aed4..2c11c4d823f 100644 --- a/TAO/tao/Makefile.am +++ b/TAO/tao/Makefile.am @@ -2463,7 +2463,6 @@ libTAO_TypeCodeFactory_la_CPPFLAGS = \ -DTAO_TYPECODEFACTORY_BUILD_DLL libTAO_TypeCodeFactory_la_SOURCES = \ - TypeCodeFactory/Factory_Map.cpp \ TypeCodeFactory/TypeCodeFactoryA.cpp \ TypeCodeFactory/TypeCodeFactoryC.cpp \ TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp \ @@ -2479,8 +2478,6 @@ libTAO_TypeCodeFactory_la_LIBADD = \ $(ACE_BUILDDIR)/ace/libACE.la nobase_include_HEADERS += \ - TypeCodeFactory/Factory_Map.h \ - TypeCodeFactory/Objref_TypeCode_Factory.h \ TypeCodeFactory/TypeCodeFactory.pidl \ TypeCodeFactory/TypeCodeFactoryC.h \ TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h \ diff --git a/TAO/tao/Objref_TypeCode_Factory.h b/TAO/tao/Objref_TypeCode_Factory.h new file mode 100644 index 00000000000..3f2b0f62d23 --- /dev/null +++ b/TAO/tao/Objref_TypeCode_Factory.h @@ -0,0 +1,278 @@ +// -*- C++ -*- + +//============================================================================= +/** + * @file Objref_TypeCode_Factory.h + * + * $Id$ + * + * Header file for + * @c tk_abstract_interface, + * @c tk_component, + * @c tk_local_interface, + * @c tk_native and + * @c tk_objref + * @c CORBA::TypeCode factories. + * + * @author Ossama Othman <ossama@dre.vanderbilt.edu> + */ +//============================================================================= + +#ifndef TAO_OBJREF_TYPECODE_FACTORY_H +#define TAO_OBJREF_TYPECODE_FACTORY_H + +#include /**/ "ace/pre.h" + + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Objref_TypeCode.h" +#include "tao/True_RefCount_Policy.h" + +namespace TAO +{ + namespace TypeCodeFactory + { + + template <CORBA::TCKind Kind> struct Objref_Traits; + + template<> + struct Objref_Traits<CORBA::tk_abstract_interface> + { + static char const * tc_constant_id (void) + { + return ""; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::TypeCode::_nil (); + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_abstract_interface, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + }; + + template <> + struct Objref_Traits<CORBA::tk_component> + { + static char const * tc_constant_id (void) + { + return "IDL:omg.org/CORBA/CCMObject:1.0"; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::_tc_Component; + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_component, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + + }; + + template <> + struct Objref_Traits<CORBA::tk_home> + { + static char const * tc_constant_id (void) + { + return "IDL:omg.org/CORBA/CCMHome:1.0"; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::_tc_Home; + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_home, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + }; + + template<> + struct Objref_Traits<CORBA::tk_local_interface> + { + static char const * tc_constant_id (void) + { + return ""; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::TypeCode::_nil (); + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_local_interface, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + }; + + template<> + struct Objref_Traits<CORBA::tk_native> + { + static char const * tc_constant_id (void) + { + return ""; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::TypeCode::_nil (); + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_native, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + }; + + template <> + struct Objref_Traits<CORBA::tk_objref> + { + static char const * tc_constant_id (void) + { + return "IDL:omg.org/CORBA/Object:1.0"; + } + + static CORBA::TypeCode_ptr tc_constant (void) + { + return CORBA::_tc_Object; + } + + static CORBA::TypeCode_ptr create_typecode (char const * id, + char const * name) + { + typedef TAO::TypeCode::Objref< + CORBA::String_var, + CORBA::tk_objref, + TAO::True_RefCount_Policy> typecode_type; + + CORBA::TypeCode_ptr tc = CORBA::TypeCode::_nil (); + ACE_NEW_RETURN (tc, + typecode_type (id, name), + tc); + + return tc; + } + }; + + // -------------------------------------------------------- + + /** + * @func tc_objref_factory + * + * @brief TypeCode factory function template for an OMG IDL + * @c object TypeCode and TypeCodes for object-like types. + * + * This function template @c CORBA::TypeCode factory for an OMG + * IDL @c object (interface) and object-like types (abstract + * interface, component, local interface and native). + */ + template<CORBA::TCKind Kind> + bool + tc_objref_factory (TAO_InputCDR & cdr, + CORBA::TypeCode_ptr & tc) + { + CORBA::Boolean byte_order; + + // The remainder of a tk_objref TypeCode is encoded in a CDR + // encapsulation. + if (!(cdr >> TAO_InputCDR::to_boolean (byte_order))) + return false; + + cdr.reset_byte_order (byte_order); + + // Extract the repository ID and name. + CORBA::String_var id; + if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0))) + return false; + + if (ACE_OS::strcmp (id.in (), // len >= 0!!! + Objref_Traits<Kind>::tc_constant_id ()) == 0) + { + // No need to create a TypeCode. Just use the TypeCode + // constant. + tc = + CORBA::TypeCode::_duplicate (Objref_Traits<Kind>::tc_constant ()); + + return true; + } + + CORBA::String_var name; + if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0))) + return false; + + return Objref_Traits<Kind>::create_typecode (id.in (), + name.in ()); + } + + } // End namespace TypeCodeFactory +} // End namespace TAO + + +#include /**/ "ace/post.h" + +#endif /* TAO_OBJREF_TYPECODE_FACTORY_H */ diff --git a/TAO/tao/TypeCode.cpp b/TAO/tao/TypeCode.cpp index aaa3f9f1c20..31ea8c7931c 100644 --- a/TAO/tao/TypeCode.cpp +++ b/TAO/tao/TypeCode.cpp @@ -298,33 +298,6 @@ operator<< (TAO_OutputCDR & cdr, return (cdr << kind) && tc->tao_marshal (cdr); } -bool -operator>> (TAO_InputCDR & cdr, - CORBA::TypeCode_ptr & tc) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - TAO_TypeCodeFactory_Adapter * const adapter = - ACE_Dynamic_Service<TAO_TypeCodeFactory_Adapter>::instance ( - TAO_ORB_Core::typecodefactory_adapter_name () - ); - - if (adapter == 0) - { - if (TAO_debug_level > 0) - { - ACE_ERROR ((LM_ERROR, - "%N:%l - Unable to load TypeCodeFactory_Adapter\n")); - } - - ACE_THROW_RETURN (CORBA::INTERNAL (), - false); - } - - return adapter->extract_typecode (cdr, tc); - -} - // --------------------------------------------------------------- CORBA::TypeCode_ptr diff --git a/TAO/tao/TypeCodeFactory/Objref_TypeCode_Factory.h b/TAO/tao/TypeCodeFactory/Objref_TypeCode_Factory.h deleted file mode 100644 index d7d09c88532..00000000000 --- a/TAO/tao/TypeCodeFactory/Objref_TypeCode_Factory.h +++ /dev/null @@ -1,159 +0,0 @@ -// -*- C++ -*- - -//============================================================================= -/** - * @file Objref_TypeCode_Factory.h - * - * $Id$ - * - * Header file for - * @c tk_abstract_interface, - * @c tk_component, - * @c tk_local_interface, - * @c tk_native and - * @c tk_objref - * @c CORBA::TypeCode factories. - * - * @author Ossama Othman <ossama@dre.vanderbilt.edu> - */ -//============================================================================= - -#ifndef TAO_OBJREF_TYPECODE_FACTORY_H -#define TAO_OBJREF_TYPECODE_FACTORY_H - -#include /**/ "ace/pre.h" - - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/Objref_TypeCode.h" - - -namespace TAO -{ - namespace TypeCodeFactory - { - template <CORBA::TCKind Kind> - struct Objref_Traits - { - static char const * tc_constant_id (void) - { - return ""; - } - - static CORBA::TypeCode_ptr tc_constant (void) - { - return CORBA::TypeCode::_nil (); - } - }; - - template <> - struct Objref_Traits<CORBA::tk_component> - { - static char const * tc_constant_id (void) - { - return "IDL:omg.org/CORBA/CCMObject:1.0"; - } - - static CORBA::TypeCode_ptr tc_constant (void) - { - return CORBA::_tc_Component; - } - }; - - - template <> - struct Objref_Traits<CORBA::tk_home> - { - static char const * tc_constant_id (void) - { - return "IDL:omg.org/CORBA/CCMHome:1.0"; - } - - static CORBA::TypeCode_ptr tc_constant (void) - { - return CORBA::_tc_Home; - } - }; - - template <> - struct Objref_Traits<CORBA::tk_objref> - { - static char const * tc_constant_id (void) - { - return "IDL:omg.org/CORBA/Object:1.0"; - } - - static CORBA::TypeCode_ptr tc_constant (void) - { - return CORBA::_tc_Object; - } - }; - - // -------------------------------------------------------- - - /** - * @func tc_objref_factory - * - * @brief TypeCode factory function template for an OMG IDL - * @c object TypeCode and TypeCodes for object-like types. - * - * This function template @c CORBA::TypeCode factory for an OMG - * IDL @c object (interface) and object-like types (abstract - * interface, component, local interface and native). - */ - template<CORBA::TCKind Kind> - bool - tc_objref_factory (TAO_InputCDR & cdr, - CORBA::TypeCode_ptr & tc) - { - CORBA::Boolean byte_order; - - // The remainder of a tk_objref TypeCode is encoded in a CDR - // encapsulation. - if (!(cdr >> TAO_InputCDR::to_boolean (byte_order))) - return false; - - cdr.reset_byte_order (byte_order); - - // Extract the repository ID and name. - CORBA::String_var id; - if (!(cdr >> TAO_InputCDR::to_string (id.out (), 0))) - return false; - - if (ACE_OS::strcmp (id.in (), - Objref_Traits<Kind>::tc_constant_id ()) == 0) - { - // No need to create a TypeCode. Just use the TypeCode - // constant. - tc = - CORBA::TypeCode::_duplicate (Objref_Traits<Kind>::tc_constant ()); - - return true; - } - - CORBA::String_var name; - if (!(cdr >> TAO_InputCDR::to_string (name.out (), 0))) - return false; - - typedef TAO::TypeCode::Objref< - CORBA::String_var, - Kind, - TAO::True_RefCount_Policy> typecode_type; - - ACE_NEW_RETURN (tc, - typecode_type (id.in (), name.in ()), - false); - - return true; - } - - } // End namespace TypeCodeFactory -} // End namespace TAO - - -#include /**/ "ace/post.h" - -#endif /* TAO_OBJREF_TYPECODE_FACTORY_H */ diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp index b2fa4fa4c28..a05ece0076a 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.cpp @@ -2,7 +2,6 @@ #include "TypeCodeFactory_Adapter_Impl.h" #include "TypeCodeFactory_i.h" -#include "Factory_Map.h" #include "tao/ORB_Core.h" @@ -338,60 +337,6 @@ TAO_TypeCodeFactory_Adapter_Impl::create_event_tc ( // -- -bool -TAO_TypeCodeFactory_Adapter_Impl::extract_typecode (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 - }; - - return factory_map[kind] (kind, cdr, tc); -} - CORBA::TypeCode_ptr TAO_TypeCodeFactory_Adapter_Impl::create_enum_tc ( char const * /* id */, diff --git a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h index 4eb6ea1d584..4ce6eed861c 100644 --- a/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h +++ b/TAO/tao/TypeCodeFactory/TypeCodeFactory_Adapter_Impl.h @@ -197,10 +197,6 @@ public: * i.e. they are specific to TAO. */ //@{ - /// Extract a TypeCode @a tc from the given CDR stream @a cdr. - virtual bool extract_typecode (TAO_InputCDR & cdr, - CORBA::TypeCode_ptr & tc); - /// Create an enumeration TypeCode. virtual CORBA::TypeCode_ptr create_enum_tc ( char const * id, diff --git a/TAO/tao/TypeCodeFactory_Adapter.h b/TAO/tao/TypeCodeFactory_Adapter.h index 7fd6a19e36b..2b266ba61c0 100644 --- a/TAO/tao/TypeCodeFactory_Adapter.h +++ b/TAO/tao/TypeCodeFactory_Adapter.h @@ -223,10 +223,6 @@ public: * i.e. they are specific to TAO. */ //@{ - /// Extract a TypeCode @a tc from the given CDR stream @a cdr. - virtual bool extract_typecode (TAO_InputCDR & cdr, - CORBA::TypeCode_ptr & tc) = 0; - /// Create an enumeration TypeCode. virtual CORBA::TypeCode_ptr create_enum_tc ( char const * id, diff --git a/TAO/tao/TypeCodeFactory/Factory_Map.cpp b/TAO/tao/TypeCode_CDR_Extraction.cpp index 6e95edd7382..f8005c0fcde 100644 --- a/TAO/tao/TypeCodeFactory/Factory_Map.cpp +++ b/TAO/tao/TypeCode_CDR_Extraction.cpp @@ -1,4 +1,6 @@ -#include "Factory_Map.h" +// $Id$ + +#include "TypeCode_CDR_Extraction.h" #include "Objref_TypeCode_Factory.h" @@ -10,7 +12,6 @@ #include "tao/Alias_TypeCode.h" #include "tao/Enum_TypeCode.h" #include "tao/Fixed_TypeCode.h" -#include "tao/Objref_TypeCode.h" #include "tao/Sequence_TypeCode.h" #include "tao/String_TypeCode.h" #include "tao/Struct_TypeCode.h" @@ -21,8 +22,8 @@ #include "tao/TypeCode_Value_Field.h" -ACE_RCSID (TypeCodeFactory, - Factory_Map, +ACE_RCSID (tao, + TypeCode_CDR_Extraction, "$Id$") @@ -360,14 +361,14 @@ TAO::TypeCodeFactory::tc_array_factory (CORBA::TCKind kind, } bool -TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind /* kind */, +TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind kind, TAO_InputCDR & cdr, CORBA::TypeCode_ptr & tc) { CORBA::Boolean byte_order; - // The remainder of a tk_alias TypeCode is encoded in a CDR - // encapsulation. + // The remainder of a tk_alias or tk_value_box TypeCode is encoded + // in a CDR encapsulation. if (!(cdr >> TAO_InputCDR::to_boolean (byte_order))) return false; @@ -381,17 +382,30 @@ TAO::TypeCodeFactory::tc_alias_factory (CORBA::TCKind /* kind */, && cdr >> content_type.out ())) return false; - typedef TAO::TypeCode::Alias< - CORBA::String_var, - CORBA::TypeCode_var, - CORBA::tk_alias, - TAO::True_RefCount_Policy> typecode_type; - - ACE_NEW_RETURN (tc, - typecode_type (id.in (), - name.in (), - content_type), - false); + if (kind == CORBA::tk_alias) + { + typedef TAO::TypeCode::Alias< + CORBA::String_var, + CORBA::TypeCode_var, + CORBA::tk_alias, + TAO::True_RefCount_Policy> typecode_type; + + ACE_NEW_RETURN (tc, + typecode_type (id.in (), name.in (), content_type), + false); + } + else + { + typedef TAO::TypeCode::Alias< + CORBA::String_var, + CORBA::TypeCode_var, + CORBA::tk_value_box, + TAO::True_RefCount_Policy> typecode_type; + + ACE_NEW_RETURN (tc, + typecode_type (id.in (), name.in (), content_type), + false); + } return true; } @@ -557,40 +571,11 @@ TAO::TypeCodeFactory::tc_value_factory (CORBA::TCKind kind, } bool -TAO::TypeCodeFactory::tc_value_box_factory (CORBA::TCKind /* kind */, +TAO::TypeCodeFactory::tc_value_box_factory (CORBA::TCKind kind, TAO_InputCDR & cdr, CORBA::TypeCode_ptr & tc) { - CORBA::Boolean byte_order; - - // The remainder of a tk_value_box TypeCode is encoded in a CDR - // encapsulation. - if (!(cdr >> TAO_InputCDR::to_boolean (byte_order))) - return false; - - cdr.reset_byte_order (byte_order); - - // Extract the repository ID, name and content type. - CORBA::String_var id, name; - 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 ())) - return false; - - typedef TAO::TypeCode::Alias< - CORBA::String_var, - CORBA::TypeCode_var, - CORBA::tk_value_box, - TAO::True_RefCount_Policy> typecode_type; - - ACE_NEW_RETURN (tc, - typecode_type (id.in (), - name.in (), - content_type), - false); - - return true; + return tc_alias_factory (kind, cdr, tc); } bool @@ -640,3 +625,57 @@ TAO::TypeCodeFactory::tc_event_factory (CORBA::TCKind kind, { return tc_value_factory (kind, cdr, tc); } + +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 + }; + + return factory_map[kind] (kind, cdr, tc); +} diff --git a/TAO/tao/TypeCodeFactory/Factory_Map.h b/TAO/tao/TypeCode_CDR_Extraction.h index fac5a97c618..7c648ea4e62 100644 --- a/TAO/tao/TypeCodeFactory/Factory_Map.h +++ b/TAO/tao/TypeCode_CDR_Extraction.h @@ -2,18 +2,18 @@ //============================================================================= /** - * @file Factory_Map.h + * @file TypeCode_CDR_Extraction.h * * $Id$ * - * Header file for TAO TypeCode factory map. + * Header file for TAO TypeCode CDR extraction operations. * * @author Ossama Othman <ossama@dre.vanderbilt.edu> */ //============================================================================= -#ifndef TAO_TYPECODE_FACTORY_MAP_H -#define TAO_TYPECODE_FACTORY_MAP_H +#ifndef TAO_TYPECODE_CDR_EXTRACTION_H +#define TAO_TYPECODE_CDR_EXTRACTION_H #include /**/ "ace/pre.h" @@ -148,4 +148,4 @@ namespace TAO #include /**/ "ace/post.h" -#endif /* TAO_TYPECODE_FACTORY_MAP_H */ +#endif /* TAO_TYPECODE_CDR_EXTRACTION_H */ diff --git a/TAO/tao/tao.mpc b/TAO/tao/tao.mpc index ca466471c04..86f17948277 100644 --- a/TAO/tao/tao.mpc +++ b/TAO/tao/tao.mpc @@ -273,6 +273,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { TypeCode.cpp TypeCodeA.cpp Typecode_typesC.cpp + TypeCode_CDR_Extraction.cpp TypeCode_Constants.cpp TypeCodeFactory_Adapter.cpp ULongLongSeqA.cpp @@ -619,6 +620,7 @@ project(TAO) : acelib, core, tao_output, taodefaults, pidl, extra_core { Transport_Timer.h True_RefCount_Policy.h TSS_Resources.h + TypeCode_CDR_Extraction.h TypeCode_Constants.h TypeCode_Case.h TypeCode_Default_Case.h |