From bc68fdd33b4c7e48c1cf81ab1ea63489de6ce793 Mon Sep 17 00:00:00 2001 From: parsons Date: Thu, 26 Aug 2010 14:53:48 +0000 Subject: ChangeLogTag: Thu Aug 26 14:46:25 UTC 2010 Jeff Parsons --- ChangeLog | 49 ++++++ TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp | 4 +- TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp | 3 +- tao/Acceptor_Filter.h | 4 +- tao/Adapter.h | 4 +- tao/Adapter_Registry.h | 6 +- tao/DLL_Parser.cpp | 1 + tao/IIOP_Profile.cpp | 7 +- tao/Leader_Follower_Flushing_Strategy.cpp | 1 + tao/LocalObject.h | 5 - tao/ORB_Core.h | 7 +- tao/Object.h | 7 +- tao/ObjectKey_Table.h | 2 - tao/Object_KeyC.cpp | 254 ++++------------------------ tao/Object_KeyC.h | 157 +++++++---------- tao/PortableServer/POA_Current_Impl.h | 2 +- tao/PortableServer/Root_POA.cpp | 2 +- tao/Profile.cpp | 155 ++++++++++++++++- tao/Profile.h | 18 ++ tao/Strategies/COIOP_Profile.cpp | 3 +- tao/Strategies/DIOP_Profile.cpp | 3 +- tao/Strategies/SCIOP_Profile.cpp | 3 +- tao/Strategies/SHMIOP_Profile.cpp | 4 +- tao/Strategies/UIOP_Profile.cpp | 3 +- tao/Stub.h | 2 +- tao/Transport_Acceptor.h | 5 +- tao/tao.mpc | 6 +- tao/target_specification.h | 4 +- 28 files changed, 364 insertions(+), 357 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab23e8c4f65..1e61bc29e56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,52 @@ +Thu Aug 26 14:46:25 UTC 2010 Jeff Parsons + + * TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp: + * TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp: + + Disabled code generation of CDR and optional + ostream operators for typedefs if the base + type is a sequence. Since the sequence is now + itself a typedef, we get 'already defined' + link errors for these operators because the + compiler doesn't see it as an overload. + + * tao/tao.mpc: + + Moved Object_Key.pidl out of the hand-crafted + list and into the automatic list. It is now + generated as a typedef of OctetSeq, and doing + it this way eliminates 'already defined' link + errors between TAO and PortableServer. The + hand-crafted static methods that had been + added to Object_Key are now in TAO_Profile. + + * tao/target_specification.h: + * tao/PortableServer/POA_Current_Impl.h: + * tao/PortableServer/Root_POA.cpp: + * tao/Object_KeyC.cpp: + * tao/Adapter.h: + * tao/Object_KeyC.h: + * tao/Leader_Follower_Flushing_Strategy.cpp: + * tao/Adapter_Registry.h: + * tao/ObjectKey_Table.h: + * tao/Profile.cpp: + * tao/Transport_Acceptor.h: + * tao/DLL_Parser.cpp: + * tao/Profile.h: + * tao/Object.h: + * tao/Stub.h: + * tao/ORB_Core.h: + * tao/Strategies/SHMIOP_Profile.cpp: + * tao/Strategies/COIOP_Profile.cpp: + * tao/Strategies/UIOP_Profile.cpp: + * tao/Strategies/SCIOP_Profile.cpp: + * tao/Strategies/DIOP_Profile.cpp: + * tao/Acceptor_Filter.h: + * tao/IIOP_Profile.cpp: + * tao/LocalObject.h: + + Mods necessitated by the changes above. + Wed Aug 25 20:44:19 UTC 2010 Jeff Parsons * tao/Tagged_Profile.inl: diff --git a/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp b/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp index 3f41ffcdc80..062fbfdb05b 100644 --- a/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp +++ b/TAO_IDL/be/be_visitor_typedef/cdr_op_ch.cpp @@ -195,7 +195,7 @@ be_visitor_typedef_cdr_op_ch::visit_enum (be_enum *node) int be_visitor_typedef_cdr_op_ch::visit_sequence (be_sequence *node) -{ +{/* be_type *bt = 0; if (this->ctx_->alias ()) @@ -219,7 +219,7 @@ be_visitor_typedef_cdr_op_ch::visit_sequence (be_sequence *node) -1); } } - +*/ return 0; } diff --git a/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp b/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp index 6017ca94d28..dbf92ddb9ec 100644 --- a/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp +++ b/TAO_IDL/be/be_visitor_typedef/cdr_op_cs.cpp @@ -163,6 +163,7 @@ be_visitor_typedef_cdr_op_cs::visit_array (be_array *node) int be_visitor_typedef_cdr_op_cs::visit_sequence (be_sequence *node) { +/* be_type *bt = 0; if (this->ctx_->alias ()) // typedef of a typedef @@ -187,7 +188,7 @@ be_visitor_typedef_cdr_op_cs::visit_sequence (be_sequence *node) -1); } } - +*/ return 0; } diff --git a/tao/Acceptor_Filter.h b/tao/Acceptor_Filter.h index d2e87aece11..0fd1b3b5312 100644 --- a/tao/Acceptor_Filter.h +++ b/tao/Acceptor_Filter.h @@ -16,6 +16,8 @@ #include /**/ "ace/pre.h" +#include + #include "tao/orbconf.h" #include /**/ "tao/TAO_Export.h" #include "tao/Basic_Types.h" @@ -28,7 +30,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; } class TAO_MProfile; diff --git a/tao/Adapter.h b/tao/Adapter.h index 6a0fd845adc..4becc0193f8 100644 --- a/tao/Adapter.h +++ b/tao/Adapter.h @@ -15,6 +15,8 @@ #include /**/ "ace/pre.h" +#include + #include "tao/CORBA_methods.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -36,7 +38,7 @@ namespace CORBA namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; } class TAO_ORB_Core; diff --git a/tao/Adapter_Registry.h b/tao/Adapter_Registry.h index a6d6affba88..acdbd7fe90e 100644 --- a/tao/Adapter_Registry.h +++ b/tao/Adapter_Registry.h @@ -27,6 +27,7 @@ #endif /* _MSC_VER */ #include "tao/Pseudo_VarOut_T.h" +#include "tao/Object_KeyC.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL @@ -36,11 +37,6 @@ namespace CORBA typedef TAO_Pseudo_Out_T Object_out; } -namespace TAO -{ - class ObjectKey; -} - class TAO_ORB_Core; class TAO_Stub; class TAO_MProfile; diff --git a/tao/DLL_Parser.cpp b/tao/DLL_Parser.cpp index d2b4bba59bd..b08b33bac85 100644 --- a/tao/DLL_Parser.cpp +++ b/tao/DLL_Parser.cpp @@ -9,6 +9,7 @@ #include "tao/ORB_Constants.h" #include "tao/SystemException.h" #include "tao/ORB_Core.h" +#include "tao/ORB.h" #include "ace/Dynamic_Service.h" #include "ace/Log_Msg.h" diff --git a/tao/IIOP_Profile.cpp b/tao/IIOP_Profile.cpp index 8e836a9837b..3b82d98c189 100644 --- a/tao/IIOP_Profile.cpp +++ b/tao/IIOP_Profile.cpp @@ -308,8 +308,7 @@ TAO_IIOP_Profile::parse_string_i (const char *ior) TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - okd + 1); + TAO_Profile::decode_string_to_sequence (ok, okd + 1); (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); @@ -478,8 +477,8 @@ TAO_IIOP_Profile::to_string (void) // corbaloc:iiop:1.2@host:port,iiop:1.2@host:port,.../key CORBA::String_var key; - TAO::ObjectKey::encode_sequence_to_string (key.inout(), - this->ref_object_key_->object_key ()); + TAO_Profile::encode_sequence_to_string (key.inout(), + this->ref_object_key_->object_key ()); size_t buflen = ( 8 /* "corbaloc" */ + diff --git a/tao/Leader_Follower_Flushing_Strategy.cpp b/tao/Leader_Follower_Flushing_Strategy.cpp index fe65035ab55..5d8fb37a247 100644 --- a/tao/Leader_Follower_Flushing_Strategy.cpp +++ b/tao/Leader_Follower_Flushing_Strategy.cpp @@ -6,6 +6,7 @@ #include "tao/Transport.h" #include "tao/Queued_Message.h" #include "tao/ORB_Core.h" +#include "tao/ORB.h" ACE_RCSID (tao, Leader_Follower_Flushing_Strategy, diff --git a/tao/LocalObject.h b/tao/LocalObject.h index cf7246ef144..f1eff1d422e 100644 --- a/tao/LocalObject.h +++ b/tao/LocalObject.h @@ -33,11 +33,6 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL -namespace TAO -{ - class ObjectKey; -} - namespace CORBA { class LocalObject; diff --git a/tao/ORB_Core.h b/tao/ORB_Core.h index e98ec52dc79..40003665f32 100644 --- a/tao/ORB_Core.h +++ b/tao/ORB_Core.h @@ -33,17 +33,17 @@ #include "tao/ObjectKey_Table.h" #include "tao/Messaging_SyncScopeC.h" #include "tao/IOPC.h" +#include "tao/StringSeqC.h" #include "tao/Object.h" #include "tao/Invocation_Utils.h" #include "tao/Adapter_Registry.h" #include "tao/ORB_Core_TSS_Resources.h" #include "tao/Service_Context_Handler_Registry.h" -#include "ace/Array_Map.h" +#include "ace/Array_Map.h" #include "ace/Thread_Manager.h" #include "ace/Lock_Adapter_T.h" #include "ace/TSS_T.h" - #include "ace/Service_Config.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL @@ -118,6 +118,9 @@ namespace CORBA class ORB; typedef ORB *ORB_ptr; + class ValueFactoryBase; + typedef ValueFactoryBase *ValueFactory; + class Policy; typedef Policy *Policy_ptr; typedef std::vector PolicyList; diff --git a/tao/Object.h b/tao/Object.h index 98399037bb6..4bef8185f20 100644 --- a/tao/Object.h +++ b/tao/Object.h @@ -50,9 +50,14 @@ class TAO_Stub; class TAO_Abstract_ServantBase; class TAO_ORB_Core; +namespace CORBA +{ + typedef std::vector OctetSeq; +} + namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; class Object_Proxy_Broker; } diff --git a/tao/ObjectKey_Table.h b/tao/ObjectKey_Table.h index 4e2f8c13df4..2ea8a5d6bc6 100644 --- a/tao/ObjectKey_Table.h +++ b/tao/ObjectKey_Table.h @@ -32,10 +32,8 @@ class TAO_ORB_Core; namespace TAO { - // Forward declarations within the namespace.. class Refcounted_ObjectKey; - class ObjectKey; /** * @class Less_Than_ObjectKey diff --git a/tao/Object_KeyC.cpp b/tao/Object_KeyC.cpp index 3e5fe7641a1..a5ea39eaa11 100644 --- a/tao/Object_KeyC.cpp +++ b/tao/Object_KeyC.cpp @@ -1,252 +1,68 @@ // -*- C++ -*- -// // $Id$ -// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** -// TAO and the TAO IDL Compiler have been developed by: -// Center for Distributed Object Computing -// Washington University -// St. Louis, MO -// USA -// http://www.cs.wustl.edu/~schmidt/doc-center.html -// and -// Distributed Object Computing Laboratory -// University of California at Irvine -// Irvine, CA -// USA -// http://doc.ece.uci.edu/ -// and -// Institute for Software Integrated Systems -// Vanderbilt University -// Nashville, TN -// USA -// http://www.isis.vanderbilt.edu/ -// -// Information about TAO is available at: -// http://www.cs.wustl.edu/~schmidt/TAO.html +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.1 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ // TAO_IDL - Generated from -// be\be_codegen.cpp:291 +// .\be\be_codegen.cpp:426 -#include "tao/Object_KeyC.h" +#include "Object_KeyC.h" #include "tao/CDR.h" #include "tao/ORB_Core.h" - -#include "ace/ACE.h" -#include "ace/Truncate.h" -#include "ace/OS_NS_string.h" -#include "ace/os_include/os_ctype.h" - -// TAO_IDL - Generated from -// be\be_visitor_arg_traits.cpp:70 +#include "tao/Vector_CDR_T.h" +#include "tao/Vector_Argument_T.h" TAO_BEGIN_VERSIONED_NAMESPACE_DECL -// Arg traits specializations. -namespace TAO -{ -} // TAO_IDL - Generated from -// be\be_visitor_sequence/sequence_cs.cpp:65 +// .\be\be_visitor_arg_traits.cpp:68 -#if !defined (_TAO_OBJECTKEY_CS_) -#define _TAO_OBJECTKEY_CS_ -TAO::ObjectKey::ObjectKey (void) -{} +TAO_END_VERSIONED_NAMESPACE_DECL -TAO::ObjectKey::ObjectKey (const TAO::ObjectKey &rhs) - : std::vector< ::CORBA::Octet> (rhs) -{ -} -TAO::ObjectKey::~ObjectKey (void) -{} +TAO_BEGIN_VERSIONED_NAMESPACE_DECL -// Hand crafted. -void -TAO::ObjectKey::encode_sequence_to_string (char* & str, - std::vector const & seq) +// Arg traits specializations. +namespace TAO { - // We must allocate a buffer which is (gag) 3 times the length - // of the sequence, which is the length required in the worst-case - // scenario of all non-printable characters. - // - // There are two strategies here...we could allocate all that space here, - // fill it up, then copy-allocate new space of just the right length. - // OR, we could just return this space. The classic time-space tradeoff, - // and for now we'll let time win out, which means that we only do the - // allocation once. - CORBA::ULong const seq_len = seq.size (); - CORBA::ULong const len = 3 * seq_len; /* space for zero termination - not needed */ - str = CORBA::string_alloc (len); - - char * const eos = str + len; - char * cp = str; - - for (CORBA::ULong i = 0; - cp < eos && i < seq_len; - ++i) - { - unsigned char bt = seq[i]; - if (is_legal (bt)) - { - *cp++ = static_cast (bt); - continue; - } - - *cp++ = '%'; - *cp++ = static_cast (ACE::nibble2hex ((bt >> 4) & 0x0f)); - *cp++ = static_cast (ACE::nibble2hex (bt & 0x0f)); - } - // Zero terminate - *cp = '\0'; } -CORBA::Boolean -TAO::ObjectKey::is_legal (unsigned char c) -{ - if (isalnum (c)) - { - return true; - } - else - { - return ( c == ';' || c == '/' ||c == ':' || c == '?' || - c == '@' || c == '&' ||c == '=' || c == '+' || - c == '$' || c == ',' ||c == '_' || c == '.' || - c == '!' || c == '~' ||c == '*' || c == '\'' || - c == '-' || c == '(' || c == ')' ); - } -} +TAO_END_VERSIONED_NAMESPACE_DECL -void -TAO::ObjectKey::decode_string_to_sequence ( - std::vector & seq, - char const * str) -{ - if (str == 0) - { - seq.resize (0); - return; - } - - size_t const str_len = ACE_OS::strlen (str); - - // Ensure sequence length value does not exceed maximum value for - // sequence index type (CORBA::ULong). This is mostly an issue for - // 64-bit MS Windows builds. - CORBA::ULong const len = - ACE_Utils::truncate_cast (str_len); - - char const * const eos = str + str_len; - char const * cp = str; - - // Set the length of the sequence to be as long as we'll possibly - // need...we'll reset it to the actual length later. - seq.resize (len); - - CORBA::ULong i = 0; - for (; - cp < eos && i < len; - ++i) - { - if (*cp == '%' || *cp == '\\') - { - // This is an escaped non-printable, - // so we decode the hex values into - // the sequence's octet - seq[i] = static_cast (ACE::hex2byte (cp[1]) << 4); - seq[i] |= static_cast (ACE::hex2byte (cp[2])); - cp += 3; - } - else - // Copy it in - seq[i] = *cp++; - } - - // Set the length appropriately - seq.resize (i); -} -/*static*/ CORBA::Boolean -TAO::ObjectKey::demarshal_key (TAO::ObjectKey &key, - TAO_InputCDR &strm) -{ - CORBA::ULong _tao_seq_len; - - if (strm >> _tao_seq_len) - { - // Add a check to the length of the sequence - // to make sure it does not exceed the length - // of the stream. (See bug 58.) - if (_tao_seq_len > strm.length ()) - { - return 0; - } - - // Set the length of the sequence. - key.resize (_tao_seq_len); - - // If length is 0 we return true. - if (0 >= _tao_seq_len) - { - return 1; - } -/* - // Retrieve all the elements. -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - if (ACE_BIT_DISABLED (strm.start ()->flags (), - ACE_Message_Block::DONT_DELETE)) - { - key.replace (_tao_seq_len, strm.start ()); - key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len); - strm.skip_bytes (_tao_seq_len); - return 1; - } - return strm.read_octet_array (key.get_buffer (), - _tao_seq_len); -#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - -// return strm.read_octet_array (key.get_buffer (), key.length ()); - return strm >> key; -//#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ - - } - return 0; -} +TAO_BEGIN_VERSIONED_NAMESPACE_DECL -#endif /* end #if !defined */ -// TAO_IDL - Generated from -// be\be_visitor_sequence/cdr_op_cs.cpp:96 -#if !defined _TAO_CDR_OP_TAO_ObjectKey_CPP_ -#define _TAO_CDR_OP_TAO_ObjectKey_CPP_ -CORBA::Boolean operator<< ( - TAO_OutputCDR &strm, - const TAO::ObjectKey &_tao_sequence - ) -{ - return - strm << (const std::vector &) _tao_sequence; -} -CORBA::Boolean operator>> ( - TAO_InputCDR &strm, - TAO::ObjectKey &_tao_sequence - ) -{ - return - strm >> (std::vector &) _tao_sequence; -} +TAO_END_VERSIONED_NAMESPACE_DECL -#endif /* _TAO_CDR_OP_TAO_ObjectKey_CPP_ */ -TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/tao/Object_KeyC.h b/tao/Object_KeyC.h index ae0728a4baa..1611b2a0c65 100644 --- a/tao/Object_KeyC.h +++ b/tao/Object_KeyC.h @@ -1,153 +1,116 @@ // -*- C++ -*- -// // $Id$ -// **** Code generated by the The ACE ORB (TAO) IDL Compiler **** -// TAO and the TAO IDL Compiler have been developed by: -// Center for Distributed Object Computing -// Washington University -// St. Louis, MO -// USA -// http://www.cs.wustl.edu/~schmidt/doc-center.html -// and -// Distributed Object Computing Laboratory -// University of California at Irvine -// Irvine, CA -// USA -// http://doc.ece.uci.edu/ -// and -// Institute for Software Integrated Systems -// Vanderbilt University -// Nashville, TN -// USA -// http://www.isis.vanderbilt.edu/ -// -// Information about TAO is available at: -// http://www.cs.wustl.edu/~schmidt/TAO.html +/** + * Code generated by the The ACE ORB (TAO) IDL Compiler v1.8.1 + * TAO and the TAO IDL Compiler have been developed by: + * Center for Distributed Object Computing + * Washington University + * St. Louis, MO + * USA + * http://www.cs.wustl.edu/~schmidt/doc-center.html + * and + * Distributed Object Computing Laboratory + * University of California at Irvine + * Irvine, CA + * USA + * and + * Institute for Software Integrated Systems + * Vanderbilt University + * Nashville, TN + * USA + * http://www.isis.vanderbilt.edu/ + * + * Information about TAO is available at: + * http://www.cs.wustl.edu/~schmidt/TAO.html + **/ // TAO_IDL - Generated from -// be\be_codegen.cpp:153 +// .\be\be_codegen.cpp:149 -#ifndef _TAO_IDL_ORIG_OBJECT_KEYC_H_ -#define _TAO_IDL_ORIG_OBJECT_KEYC_H_ +#ifndef _TAO_PIDL_OBJECT_KEYC_NXW5RV_H_ +#define _TAO_PIDL_OBJECT_KEYC_NXW5RV_H_ #include /**/ "ace/pre.h" -#include "ace/config-all.h" + +#include /**/ "ace/config-all.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#if !defined (GEN_OSTREAM_OPS) +#define GEN_OSTREAM_OPS +#endif /* GEN_OSTREAM_OPS */ + #include /**/ "tao/TAO_Export.h" -#include "tao/ORB.h" -//#include "tao/Environment.h" -#include "tao/OctetSeqC.h" +#include +#include + +#include "tao/Basic_Types.h" +#include "tao/Sequence_T.h" +#include /**/ "tao/Versioned_Namespace.h" +#include "ace/streams.h" #if defined (TAO_EXPORT_MACRO) #undef TAO_EXPORT_MACRO #endif #define TAO_EXPORT_MACRO TAO_Export -#if defined(_MSC_VER) -#pragma warning(push) -#pragma warning(disable:4250) -#endif /* _MSC_VER */ +TAO_BEGIN_VERSIONED_NAMESPACE_DECL -// TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:48 -TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +// TAO_IDL - Generated from +// e:\branches\alt_mapping_saic\tao\tao_idl\be\be_visitor_module/module_ch.cpp:41 namespace TAO { - + // TAO_IDL - Generated from - // be\be_visitor_sequence/sequence_ch.cpp:101 + // e:\branches\alt_mapping_saic\tao\tao_idl\be\be_visitor_sequence/sequence_ch.cpp:100 #if !defined (_TAO_OBJECTKEY_CH_) #define _TAO_OBJECTKEY_CH_ - - class TAO_Export ObjectKey - : public - std::vector< ::CORBA::Octet> - { - public: - ObjectKey (void); - ObjectKey (const ObjectKey &rhs); - ~ObjectKey (void); -/* -#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) - ObjectKey ( - CORBA::ULong length, - const ACE_Message_Block* mb - ) - : TAO::unbounded_value_sequence (length, mb) {} -#endif /* TAO_NO_COPY_OCTET_SEQUENCE == 1 */ - - // Hand crafted. - - static void encode_sequence_to_string ( - char* & str, - std::vector const & seq - ); - static void decode_string_to_sequence ( - std::vector &seq, - char const * str - ); - static CORBA::Boolean is_legal (unsigned char c); - - /// A special method that gives no regard to how the ORB has - /// configured the resource factory. This will be used only - /// during Profile decoding and should be safe. This is a solution - /// for the bug report [Bug 1616] - static CORBA::Boolean demarshal_key (ObjectKey & key, - TAO_InputCDR & cdr); - }; + + typedef std::vector< ::CORBA::Octet> ObjectKey; #endif /* end #if !defined */ // TAO_IDL - Generated from -// be\be_visitor_module/module_ch.cpp:66 +// e:\branches\alt_mapping_saic\tao\tao_idl\be\be_visitor_module/module_ch.cpp:70 } // module TAO // TAO_IDL - Generated from -// be\be_visitor_traits.cpp:61 +// .\be\be_visitor_traits.cpp:60 + + +TAO_END_VERSIONED_NAMESPACE_DECL + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Traits specializations. namespace TAO { } +TAO_END_VERSIONED_NAMESPACE_DECL -// TAO_IDL - Generated from -// be\be_visitor_sequence/cdr_op_ch.cpp:71 -#if !defined _TAO_CDR_OP_TAO_ObjectKey_H_ -#define _TAO_CDR_OP_TAO_ObjectKey_H_ +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + -TAO_Export CORBA::Boolean operator<< ( - TAO_OutputCDR &, - const TAO::ObjectKey & - ); -TAO_Export CORBA::Boolean operator>> ( - TAO_InputCDR &, - TAO::ObjectKey & - ); -#endif /* _TAO_CDR_OP_TAO_ObjectKey_H_ */ // TAO_IDL - Generated from -// be\be_codegen.cpp:955 +// .\be\be_codegen.cpp:1789 -TAO_END_VERSIONED_NAMESPACE_DECL -#if defined(_MSC_VER) -#pragma warning(pop) -#endif /* _MSC_VER */ +TAO_END_VERSIONED_NAMESPACE_DECL #include /**/ "ace/post.h" #endif /* ifndef */ - diff --git a/tao/PortableServer/POA_Current_Impl.h b/tao/PortableServer/POA_Current_Impl.h index 68a584e7769..e258838c049 100644 --- a/tao/PortableServer/POA_Current_Impl.h +++ b/tao/PortableServer/POA_Current_Impl.h @@ -38,7 +38,7 @@ namespace TAO class Servant_Upcall; } - class ObjectKey; + typedef std::vector ObjectKey; } class TAO_TSS_Resources; diff --git a/tao/PortableServer/Root_POA.cpp b/tao/PortableServer/Root_POA.cpp index c21d9a8036e..414cc8f3f85 100644 --- a/tao/PortableServer/Root_POA.cpp +++ b/tao/PortableServer/Root_POA.cpp @@ -2094,7 +2094,7 @@ TAO_Root_POA::key_to_object (const TAO::ObjectKey &key, // Add the key. CORBA::String_var key_str; - TAO::ObjectKey::encode_sequence_to_string (key_str.inout (), key); + TAO_Profile::encode_sequence_to_string (key_str.inout (), key); ior += key_str.in (); diff --git a/tao/Profile.cpp b/tao/Profile.cpp index 1cf86cb2950..afb5171b096 100644 --- a/tao/Profile.cpp +++ b/tao/Profile.cpp @@ -15,6 +15,7 @@ #include "ace/ACE.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_ctype.h" +#include "ace/Truncate.h" #if !defined (__ACE_INLINE__) #include "tao/Profile.inl" @@ -120,6 +121,158 @@ TAO_Profile::_key (void) const return key; } +void +TAO_Profile::encode_sequence_to_string (char* & str, + std::vector const & seq) +{ + // We must allocate a buffer which is (gag) 3 times the length + // of the sequence, which is the length required in the worst-case + // scenario of all non-printable characters. + // + // There are two strategies here...we could allocate all that space here, + // fill it up, then copy-allocate new space of just the right length. + // OR, we could just return this space. The classic time-space tradeoff, + // and for now we'll let time win out, which means that we only do the + // allocation once. + CORBA::ULong const seq_len = seq.size (); + CORBA::ULong const len = 3 * seq_len; /* space for zero termination + not needed */ + str = CORBA::string_alloc (len); + + char * const eos = str + len; + char * cp = str; + + for (CORBA::ULong i = 0; + cp < eos && i < seq_len; + ++i) + { + unsigned char bt = seq[i]; + if (is_legal (bt)) + { + *cp++ = static_cast (bt); + continue; + } + + *cp++ = '%'; + *cp++ = static_cast (ACE::nibble2hex ((bt >> 4) & 0x0f)); + *cp++ = static_cast (ACE::nibble2hex (bt & 0x0f)); + } + // Zero terminate + *cp = '\0'; +} + +void +TAO_Profile::decode_string_to_sequence ( + std::vector & seq, + char const * str) +{ + if (str == 0) + { + seq.resize (0); + return; + } + + size_t const str_len = ACE_OS::strlen (str); + + // Ensure sequence length value does not exceed maximum value for + // sequence index type (CORBA::ULong). This is mostly an issue for + // 64-bit MS Windows builds. + CORBA::ULong const len = + ACE_Utils::truncate_cast (str_len); + + char const * const eos = str + str_len; + char const * cp = str; + + // Set the length of the sequence to be as long as we'll possibly + // need...we'll reset it to the actual length later. + seq.resize (len); + + CORBA::ULong i = 0; + for (; + cp < eos && i < len; + ++i) + { + if (*cp == '%' || *cp == '\\') + { + // This is an escaped non-printable, + // so we decode the hex values into + // the sequence's octet + seq[i] = static_cast (ACE::hex2byte (cp[1]) << 4); + seq[i] |= static_cast (ACE::hex2byte (cp[2])); + cp += 3; + } + else + // Copy it in + seq[i] = *cp++; + } + + // Set the length appropriately + seq.resize (i); +} + +CORBA::Boolean +TAO_Profile::is_legal (unsigned char c) +{ + if (isalnum (c)) + { + return true; + } + else + { + return ( c == ';' || c == '/' ||c == ':' || c == '?' || + c == '@' || c == '&' ||c == '=' || c == '+' || + c == '$' || c == ',' ||c == '_' || c == '.' || + c == '!' || c == '~' ||c == '*' || c == '\'' || + c == '-' || c == '(' || c == ')' ); + } +} + +/*static*/ CORBA::Boolean +TAO_Profile::demarshal_key (TAO::ObjectKey &key, + TAO_InputCDR &strm) +{ + CORBA::ULong _tao_seq_len; + + if (strm >> _tao_seq_len) + { + // Add a check to the length of the sequence + // to make sure it does not exceed the length + // of the stream. (See bug 58.) + if (_tao_seq_len > strm.length ()) + { + return 0; + } + + // Set the length of the sequence. + key.resize (_tao_seq_len); + + // If length is 0 we return true. + if (0 >= _tao_seq_len) + { + return 1; + } +/* + // Retrieve all the elements. +#if (TAO_NO_COPY_OCTET_SEQUENCES == 1) + if (ACE_BIT_DISABLED (strm.start ()->flags (), + ACE_Message_Block::DONT_DELETE)) + { + key.replace (_tao_seq_len, strm.start ()); + key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len); + strm.skip_bytes (_tao_seq_len); + return 1; + } + return strm.read_octet_array (key.get_buffer (), + _tao_seq_len); +#else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + +// return strm.read_octet_array (key.get_buffer (), key.length ()); + return strm >> key; +//#endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ + + } + return 0; +} int TAO_Profile::encode (TAO_OutputCDR &stream) const @@ -204,7 +357,7 @@ TAO_Profile::decode (TAO_InputCDR& cdr) TAO::ObjectKey ok; // ... and object key. - if (TAO::ObjectKey::demarshal_key (ok, cdr) == 0) + if (TAO_Profile::demarshal_key (ok, cdr) == 0) { return -1; } diff --git a/tao/Profile.h b/tao/Profile.h index 9967dc9a59d..e8f101fb636 100644 --- a/tao/Profile.h +++ b/tao/Profile.h @@ -25,6 +25,7 @@ #include "tao/Refcounted_ObjectKey.h" #include "tao/Service_Callbacks.h" #include "tao/Configurable_Refcount.h" +#include "tao/Object_KeyC.h" ACE_BEGIN_VERSIONED_NAMESPACE_DECL class ACE_Lock; @@ -110,6 +111,23 @@ public: TAO::ObjectKey _key (void) const; //@} + static void encode_sequence_to_string ( + char* & str, + std::vector const & seq); + + static void decode_string_to_sequence ( + std::vector &seq, + char const * str); + + static CORBA::Boolean is_legal (unsigned char c); + + /// A special method that gives no regard to how the ORB has + /// configured the resource factory. This will be used only + /// during Profile decoding and should be safe. This is a solution + /// for the bug report [Bug 1616] + static CORBA::Boolean demarshal_key (TAO::ObjectKey & key, + TAO_InputCDR & cdr); + /** * @name Template methods that needs to be implemented by the * concrete classes. Some of the methods may be overridden only diff --git a/tao/Strategies/COIOP_Profile.cpp b/tao/Strategies/COIOP_Profile.cpp index 085a908f5a6..93ced77619a 100644 --- a/tao/Strategies/COIOP_Profile.cpp +++ b/tao/Strategies/COIOP_Profile.cpp @@ -128,8 +128,7 @@ TAO_COIOP_Profile::parse_string_i (const char *ior) this->endpoint_.uuid_.from_string (tmp._retn ()); TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - okd + 1); + TAO_Profile::decode_string_to_sequence (ok, okd + 1); (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); diff --git a/tao/Strategies/DIOP_Profile.cpp b/tao/Strategies/DIOP_Profile.cpp index 4f610cd4b54..8954268eb25 100644 --- a/tao/Strategies/DIOP_Profile.cpp +++ b/tao/Strategies/DIOP_Profile.cpp @@ -284,8 +284,7 @@ TAO_DIOP_Profile::parse_string_i (const char *ior) } TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - okd + 1); + TAO_Profile::decode_string_to_sequence (ok, okd + 1); (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); diff --git a/tao/Strategies/SCIOP_Profile.cpp b/tao/Strategies/SCIOP_Profile.cpp index 8795dcf8570..016f5b32aec 100644 --- a/tao/Strategies/SCIOP_Profile.cpp +++ b/tao/Strategies/SCIOP_Profile.cpp @@ -230,8 +230,7 @@ TAO_SCIOP_Profile::parse_string_i (const char *ior TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - okd + 1); + TAO_Profile::decode_string_to_sequence (ok, okd + 1); (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); diff --git a/tao/Strategies/SHMIOP_Profile.cpp b/tao/Strategies/SHMIOP_Profile.cpp index 11460b69f09..f67610c2ed4 100644 --- a/tao/Strategies/SHMIOP_Profile.cpp +++ b/tao/Strategies/SHMIOP_Profile.cpp @@ -257,8 +257,8 @@ TAO_SHMIOP_Profile::parse_string_i (const char *string } TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - okd + 1); // increment past the object key separator + TAO_Profile::decode_string_to_sequence (ok, okd + 1); + // increment past the object key separator (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); diff --git a/tao/Strategies/UIOP_Profile.cpp b/tao/Strategies/UIOP_Profile.cpp index 98a42cf3995..6cf91b2f28d 100644 --- a/tao/Strategies/UIOP_Profile.cpp +++ b/tao/Strategies/UIOP_Profile.cpp @@ -170,8 +170,7 @@ TAO_UIOP_Profile::parse_string_i (const char *string) start = ++cp; // increment past the object key separator TAO::ObjectKey ok; - TAO::ObjectKey::decode_string_to_sequence (ok, - start); + TAO_Profile::decode_string_to_sequence (ok, start); (void) this->orb_core ()->object_key_table ().bind (ok, this->ref_object_key_); diff --git a/tao/Stub.h b/tao/Stub.h index 9ef36c18386..d43426f40a9 100644 --- a/tao/Stub.h +++ b/tao/Stub.h @@ -42,7 +42,7 @@ class TAO_Profile; namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; class Object_Proxy_Broker; class Transport_Queueing_Strategy; } diff --git a/tao/Transport_Acceptor.h b/tao/Transport_Acceptor.h index 8456bdfc709..08884543df6 100644 --- a/tao/Transport_Acceptor.h +++ b/tao/Transport_Acceptor.h @@ -24,7 +24,10 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include + #include "ace/Acceptor.h" + #include "tao/Basic_Types.h" // Forward declarations. @@ -47,7 +50,7 @@ namespace IOP namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; } //@@ TAO_ACCEPTOR_SPL_INCLUDE_FORWARD_DECL_ADD_HOOK diff --git a/tao/tao.mpc b/tao/tao.mpc index c756f445fb0..b107b37198c 100644 --- a/tao/tao.mpc +++ b/tao/tao.mpc @@ -53,9 +53,13 @@ project(TAO_Core_idl) : tao_versioning_idl_defaults, gen_ostream, install, pidl_ WCharSeq.pidl >> AnyTypeCode/WCharSeqA.h AnyTypeCode/WCharSeqA.cpp WStringSeq.pidl >> AnyTypeCode/WStringSeqA.h AnyTypeCode/WStringSeqA.cpp } + + IDL_Files { + idlflags += -St -Sci + Object_Key.pidl + } PidlInstallWithoutBuilding_Files { - Object_Key.pidl Policy.pidl Typecode_types.pidl WrongTransaction.pidl diff --git a/tao/target_specification.h b/tao/target_specification.h index 140a2d99a77..dfcf6b194c0 100644 --- a/tao/target_specification.h +++ b/tao/target_specification.h @@ -23,6 +23,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include + #include "tao/Basic_Types.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -45,7 +47,7 @@ namespace IOP namespace TAO { - class ObjectKey; + typedef std::vector ObjectKey; } /** -- cgit v1.2.1