diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-19 20:29:37 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-19 20:29:37 +0000 |
commit | 86c0a922aeb4a1acf72878e991acd532d5cb5f09 (patch) | |
tree | 6d556d5dac04d4e74cb26aa362e6aebbaa883603 | |
parent | d12b5514c320eb360b5baa3ec613f2f451485700 (diff) | |
download | ATCD-86c0a922aeb4a1acf72878e991acd532d5cb5f09.tar.gz |
ChangeLogTag:Wed May 19 15:25:00 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 36 | ||||
-rw-r--r-- | TAO/docs/releasenotes/TODO.html | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp | 125 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Logger/Logging_Test_i.cpp | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Logger/client_i.cpp | 102 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Property/client.cpp | 102 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Property/main.cpp | 160 | ||||
-rw-r--r-- | TAO/performance-tests/Cubit/TAO/IDL_Cubit/svc.conf | 2 | ||||
-rw-r--r-- | TAO/tao/CDR_Interpreter.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/Managed_Types.cpp | 19 | ||||
-rw-r--r-- | TAO/tao/Managed_Types.h | 55 | ||||
-rw-r--r-- | TAO/tao/Managed_Types.i | 31 | ||||
-rw-r--r-- | TAO/tao/Marshal.i | 8 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 118 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 109 | ||||
-rw-r--r-- | TAO/tao/ORB.i | 128 | ||||
-rw-r--r-- | TAO/tao/POA.cpp | 6 | ||||
-rw-r--r-- | TAO/tao/POA.h | 4 | ||||
-rw-r--r-- | TAO/tao/Request.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Typecode_Constants.cpp | 398 | ||||
-rw-r--r-- | TAO/tao/corbafwd.h | 31 | ||||
-rw-r--r-- | TAO/tao/corbafwd.i | 31 | ||||
-rw-r--r-- | TAO/tests/Param_Test/options.cpp | 2 |
24 files changed, 949 insertions, 556 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index a7c5d7a0c8a..4e2ab9e1c2b 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,39 @@ +Wed May 19 15:25:00 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tao/corbafwd.h: + * tao/corbafwd.i: + * tao/ORB.h: + * tao/ORB.i: + * tao/ORB.cpp: + * tao/CDR_Interpreter.cpp: + * tao/Managed_Types.cpp: + * tao/Managed_Types.h: + * tao/Managed_Types.i: + * tao/Marshal.i: + * tao/POA.cpp: + * tao/POA.h: + * tao/Request.cpp: + * tao/Typecode_Constants.cpp: + * orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp: + * orbsvcs/tests/Logger/Logging_Test_i.cpp: + * orbsvcs/tests/Logger/client_i.cpp: + * orbsvcs/tests/Property/client.cpp: + * orbsvcs/tests/Property/main.cpp: + * performance-tests/Cubit/TAO/IDL_Cubit/svc.conf: + * tests/Param_Test/options.cpp: + Added support for CORBA::WString_var and CORBA::WString_out, + also did a quick cleanup for the WString_Manager classes. + Thanks to Lothar Werzinger <lwerzinger@krones.de> for providing + this fixes. + Also removed all uses of string_copy which is a non-standard TAO + extension. + + * docs/releasenotes/TODO.html: + More EC updates + + * orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp: + Added copy-on-read to avoid dead-locks during dispatch. + Wed May 19 15:12:26 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * orbsvcs/CosEvent_Service/CosEvent_Service.cpp: diff --git a/TAO/docs/releasenotes/TODO.html b/TAO/docs/releasenotes/TODO.html index b19cdd6e8e1..f74be91a90c 100644 --- a/TAO/docs/releasenotes/TODO.html +++ b/TAO/docs/releasenotes/TODO.html @@ -302,7 +302,7 @@ publications and subscriptions? This could require collaborations with the scheduling service and possibly it is only useful for debugging real-time applications, but it - certainly seems useful. + certainly seems interesting. </P> </LI> diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp index 25708d5f232..994683d9279 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp @@ -8,6 +8,7 @@ #include "EC_SupplierAdmin.h" #include "orbsvcs/Event_Service_Constants.h" #include "ace/Synch.h" +#include "ace/Auto_Ptr.h" #if ! defined (__ACE_INLINE__) #include "EC_ObserverStrategy.i" @@ -139,12 +140,32 @@ TAO_EC_Basic_ObserverStrategy::connected (TAO_EC_ProxyPushConsumer*, this->fill_qos (c_qos, ACE_TRY_ENV); ACE_CHECK; - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); - ++i) + int size = 0; + ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy; + { + ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + ACE_CHECK; + size = this->observers_.current_size (); + RtecEventChannelAdmin::Observer_var *tmp; + ACE_NEW (tmp, RtecEventChannelAdmin::Observer_var[size]); + copy.reset (tmp); + + Observer_Map_Iterator end = this->observers_.end (); + int j = 0; + for (Observer_Map_Iterator i = this->observers_.begin (); + i != end; + ++i) + { + Observer_Entry& entry = (*i).int_id_; + copy[j++] = + RtecEventChannelAdmin::Observer::_duplicate (entry.observer); + } + } + + for (int i = 0; i != size; ++i) { - Observer_Entry& entry = (*i).int_id_; - entry.observer->update_consumer (c_qos, ACE_TRY_ENV); + copy[i]->update_consumer (c_qos, ACE_TRY_ENV); ACE_CHECK; } } @@ -157,12 +178,32 @@ TAO_EC_Basic_ObserverStrategy::disconnected (TAO_EC_ProxyPushConsumer*, this->fill_qos (c_qos, ACE_TRY_ENV); ACE_CHECK; - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); - ++i) + int size = 0; + ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy; + { + ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + ACE_CHECK; + size = this->observers_.current_size (); + RtecEventChannelAdmin::Observer_var *tmp; + ACE_NEW (tmp, RtecEventChannelAdmin::Observer_var[size]); + copy.reset (tmp); + + Observer_Map_Iterator end = this->observers_.end (); + int j = 0; + for (Observer_Map_Iterator i = this->observers_.begin (); + i != end; + ++i) + { + Observer_Entry& entry = (*i).int_id_; + copy[j++] = + RtecEventChannelAdmin::Observer::_duplicate (entry.observer); + } + } + + for (int i = 0; i != size; ++i) { - Observer_Entry& entry = (*i).int_id_; - entry.observer->update_consumer (c_qos, ACE_TRY_ENV); + copy[i]->update_consumer (c_qos, ACE_TRY_ENV); ACE_CHECK; } } @@ -175,12 +216,32 @@ TAO_EC_Basic_ObserverStrategy::connected (TAO_EC_ProxyPushSupplier*, this->fill_qos (s_qos, ACE_TRY_ENV); ACE_CHECK; - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); - ++i) + int size = 0; + ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy; + { + ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + ACE_CHECK; + size = this->observers_.current_size (); + RtecEventChannelAdmin::Observer_var *tmp; + ACE_NEW (tmp, RtecEventChannelAdmin::Observer_var[size]); + copy.reset (tmp); + + Observer_Map_Iterator end = this->observers_.end (); + int j = 0; + for (Observer_Map_Iterator i = this->observers_.begin (); + i != end; + ++i) + { + Observer_Entry& entry = (*i).int_id_; + copy[j++] = + RtecEventChannelAdmin::Observer::_duplicate (entry.observer); + } + } + + for (int i = 0; i != size; ++i) { - Observer_Entry& entry = (*i).int_id_; - entry.observer->update_supplier (s_qos, ACE_TRY_ENV); + copy[i]->update_supplier (s_qos, ACE_TRY_ENV); ACE_CHECK; } } @@ -193,12 +254,32 @@ TAO_EC_Basic_ObserverStrategy::disconnected (TAO_EC_ProxyPushSupplier*, this->fill_qos (s_qos, ACE_TRY_ENV); ACE_CHECK; - for (Observer_Map_Iterator i = this->observers_.begin (); - i != this->observers_.end (); - ++i) + int size = 0; + ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> copy; + { + ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR()); + ACE_CHECK; + size = this->observers_.current_size (); + RtecEventChannelAdmin::Observer_var *tmp; + ACE_NEW (tmp, RtecEventChannelAdmin::Observer_var[size]); + copy.reset (tmp); + + Observer_Map_Iterator end = this->observers_.end (); + int j = 0; + for (Observer_Map_Iterator i = this->observers_.begin (); + i != end; + ++i) + { + Observer_Entry& entry = (*i).int_id_; + copy[j++] = + RtecEventChannelAdmin::Observer::_duplicate (entry.observer); + } + } + + for (int i = 0; i != size; ++i) { - Observer_Entry& entry = (*i).int_id_; - entry.observer->update_supplier (s_qos, ACE_TRY_ENV); + copy[i]->update_supplier (s_qos, ACE_TRY_ENV); ACE_CHECK; } } @@ -324,6 +405,8 @@ template class ACE_RB_Tree_Iterator<RtecEventComm::EventHeader,int,TAO_EC_Basic_ template class ACE_RB_Tree_Reverse_Iterator<RtecEventComm::EventHeader,int,TAO_EC_Basic_ObserverStrategy::Header_Compare,ACE_Null_Mutex>; template class ACE_RB_Tree_Node<RtecEventComm::EventHeader,int>; +template class ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var>; + #elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Map_Manager<RtecEventChannelAdmin::Observer_Handle,TAO_EC_Basic_ObserverStrategy::Observer_Entry,ACE_Null_Mutex> @@ -338,4 +421,6 @@ template class ACE_RB_Tree_Node<RtecEventComm::EventHeader,int>; #pragma instantiate ACE_RB_Tree_Reverse_Iterator<RtecEventComm::EventHeader,int,TAO_EC_Basic_ObserverStrategy::Header_Compare,ACE_Null_Mutex> #pragma instantiate ACE_RB_Tree_Node<RtecEventComm::EventHeader,int> +#pragma instantiate ACE_Auto_Basic_Array_Ptr<RtecEventChannelAdmin::Observer_var> + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp b/TAO/orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp index 0fae850dfd5..0255d64c8f4 100644 --- a/TAO/orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp +++ b/TAO/orbsvcs/tests/EC_Custom_Marshal/ECM_Supplier.cpp @@ -197,12 +197,12 @@ ECMS_Driver::supplier_task (Test_Supplier *supplier, CORBA::ULong n = this->event_size_; ECM_IDLData::Info info; - info.mobile_name = CORBA::string_copy ("test"); + info.mobile_name = CORBA::string_dup ("test"); info.mobile_speed = 1; info.trajectory.length (n); ECM_Data other; - other.description = CORBA::string_copy ("some data"); + other.description = CORBA::string_dup ("some data"); for (CORBA::ULong j = 0; j < n; ++j) { diff --git a/TAO/orbsvcs/tests/Logger/Logging_Test_i.cpp b/TAO/orbsvcs/tests/Logger/Logging_Test_i.cpp index 38c37f2f803..bf084d19dd3 100644 --- a/TAO/orbsvcs/tests/Logger/Logging_Test_i.cpp +++ b/TAO/orbsvcs/tests/Logger/Logging_Test_i.cpp @@ -134,15 +134,15 @@ Logger_Client::init_loggers (CORBA::Environment &env) // Retrieve the Logger obj ref corresponding to key1 and // key2. this->logger_1_ = factory_->make_logger ("key1", - env); + env); if (env.exception () != 0) return -1; - + this->logger_2_ = factory_->make_logger ("key2", env); if (env.exception () != 0) return -1; - + if (CORBA::is_nil (this->logger_1_.in ())) ACE_ERROR_RETURN ((LM_ERROR, "nil logger1"), @@ -244,14 +244,14 @@ Logger_Client::run (void) this->logger_2_->log (rec2, TAO_TRY_ENV); TAO_CHECK_ENV; - // Change the verbosity again + // Change the verbosity again this->logger_2_->verbosity (Logger::SILENT, TAO_TRY_ENV); TAO_CHECK_ENV; // Log the third log record using logv() (this shows if the // verbosity level overrides the logger's verbosity level) this->logger_2_->logv (rec3, Logger::VERBOSE, TAO_TRY_ENV); - + // Change the verbosity again (so that regular log msgs can be // seen again) this->logger_2_->verbosity (Logger::VERBOSE, TAO_TRY_ENV); @@ -306,7 +306,7 @@ Logger_Client::init_record (Logger::Log_Record &newrec, const char *msg) { // Copy the message data into newrec. - newrec.msg_data = CORBA::string_copy (msg); + newrec.msg_data = CORBA::string_dup (msg); // Assign the log priority. newrec.type = lp; diff --git a/TAO/orbsvcs/tests/Logger/client_i.cpp b/TAO/orbsvcs/tests/Logger/client_i.cpp index 02003a5f608..d5d275ef890 100644 --- a/TAO/orbsvcs/tests/Logger/client_i.cpp +++ b/TAO/orbsvcs/tests/Logger/client_i.cpp @@ -31,34 +31,34 @@ Logger_Client::init (int argc, char *argv[]) { // Initialize the ORB orb_ = CORBA::ORB_init (argc, - argv, - "internet", - TAO_TRY_ENV); + argv, + "internet", + TAO_TRY_ENV); if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "\nTrying to initialize orb\n")); - + ACE_DEBUG ((LM_DEBUG, + "\nTrying to initialize orb\n")); + TAO_CHECK_ENV; if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "\nOrb initialized successfully\n")); - + ACE_DEBUG ((LM_DEBUG, + "\nOrb initialized successfully\n")); + // Parse command line and verify parameters. if (this->parse_args () == -1) return -1; // Initialize the naming service if (this->init_naming_service (TAO_TRY_ENV) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize naming" - "services.\n"), - -1); + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize naming" + "services.\n"), + -1); // Create the logger instances if (this->init_loggers (TAO_TRY_ENV) != 0) - ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize logger" - "instances.\n"), - -1); + ACE_ERROR_RETURN ((LM_ERROR, + " (%P|%t) Unable to initialize logger" + "instances.\n"), + -1); } TAO_CATCHANY { @@ -66,9 +66,9 @@ Logger_Client::init (int argc, char *argv[]) return -1; } TAO_ENDTRY; - + return 0; - + } int @@ -77,54 +77,54 @@ Logger_Client::init_naming_service (CORBA::Environment &env) // Initialize the naming services if (my_name_client_.init (orb_) != 0) ACE_ERROR_RETURN ((LM_ERROR, - " (%P|%t) Unable to initialize " - "the TAO_Naming_Client. \n"), - -1); - + " (%P|%t) Unable to initialize " + "the TAO_Naming_Client. \n"), + -1); + // Resolve an instance of the Logger_Factory CosNaming::Name factory_name (1); factory_name.length (1); factory_name[0].id = CORBA::string_dup ("logger_factory"); - + CORBA::Object_var factory_ref = my_name_client_->resolve (factory_name, - env); + env); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "\nFactory_ref resolved\n")); - + "\nFactory_ref resolved\n")); + if (CORBA::is_nil (factory_ref.in ())) ACE_ERROR_RETURN ((LM_ERROR, - "resolved to nil object"), - -1); + "resolved to nil object"), + -1); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "\nLogger_Factory resolved\n")); + "\nLogger_Factory resolved\n")); // Narrow the factory and check the success factory_ = Logger_Factory::_narrow (factory_ref.in (), - env); + env); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "\nFactory narrowed\n")); + "\nFactory narrowed\n")); if (CORBA::is_nil (factory_.in ())) ACE_ERROR_RETURN ((LM_ERROR, - "narrow returned nil"), - -1); + "narrow returned nil"), + -1); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "\nLogger_Factory narrowed\n")); + "\nLogger_Factory narrowed\n")); - // If debugging, get the factory's IOR + // If debugging, get the factory's IOR CORBA::String_var str = orb_->object_to_string (factory_.in (), - env); + env); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "The factory IOR is <%s>\n", - str.in ())); + "The factory IOR is <%s>\n", + str.in ())); return 0; } @@ -134,23 +134,23 @@ Logger_Client::init_loggers (CORBA::Environment &env) // Retrieve the Logger obj ref corresponding to key1 and // key2. this->logger_1_ = factory_->make_logger ("key1", - env); + env); this->logger_2_ = factory_->make_logger ("key2", - env); - + env); + if (CORBA::is_nil (this->logger_1_.in ())) ACE_ERROR_RETURN ((LM_ERROR, - "nil logger1"), - -1); - + "nil logger1"), + -1); + if (CORBA::is_nil (this->logger_2_.in ())) ACE_ERROR_RETURN ((LM_ERROR, - "nil logger2"), - -1); + "nil logger2"), + -1); if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "Created two loggers\n")); + "Created two loggers\n")); return 0; } @@ -191,7 +191,7 @@ Logger_Client::run (void) // Change the verbosity. this->logger_1_->verbosity (Logger::VERBOSE_LITE, TAO_TRY_ENV); TAO_CHECK_ENV; - + // Log the first Log_Record this->logger_1_->log (rec1, TAO_TRY_ENV); TAO_CHECK_ENV; @@ -232,7 +232,7 @@ Logger_Client::parse_args (void) ACE_ERROR_RETURN ((LM_ERROR, "usage: %s" " [-d]" - "\n" + "\n" " -d: increase debug level\n", this->argv_ [0]), -1); @@ -249,7 +249,7 @@ Logger_Client::init_record (Logger::Log_Record &newrec, const char *msg) { // Copy the message data into newrec. - newrec.msg_data = CORBA::string_copy (msg); + newrec.msg_data = CORBA::string_dup (msg); // Assign the log priority. newrec.type = lp; diff --git a/TAO/orbsvcs/tests/Property/client.cpp b/TAO/orbsvcs/tests/Property/client.cpp index 29318359098..2a564b1e9dc 100644 --- a/TAO/orbsvcs/tests/Property/client.cpp +++ b/TAO/orbsvcs/tests/Property/client.cpp @@ -51,7 +51,7 @@ Client::init (int argc, propsetdef_name.length (1); propsetdef_name [0].id = CORBA::string_dup ("PropertySetDef"); CORBA::Object_var propsetdef_obj = my_name_client_->resolve (propsetdef_name, - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_CHECK_RETURN (1); ACE_DEBUG ((LM_DEBUG, "Naming resolve done\n")); @@ -64,7 +64,7 @@ Client::init (int argc, ACE_ERROR_RETURN ((LM_ERROR, "Couldnot resolve propsetdef in Naming server"), -1); - + return 0; } @@ -128,7 +128,7 @@ Client::property_tester (CORBA::Environment &ACE_TRY_ENV) // Testing define_property_with_mode. this->test_define_property_with_mode (ACE_TRY_ENV); ACE_CHECK_RETURN (-1); - + return 0; } @@ -152,8 +152,8 @@ Client::test_define_property (CORBA::Environment &ACE_TRY_ENV) "Main : Char ch = %c\n", ch)); this->propsetdef_->define_property ("char_property", - anyval, - ACE_TRY_ENV); + anyval, + ACE_TRY_ENV); // Check if that is an user exception, if so, print it out. if ((ACE_TRY_ENV.exception () != 0) && @@ -173,8 +173,8 @@ Client::test_define_property (CORBA::Environment &ACE_TRY_ENV) "Main : Short s = %d\n", s)); propsetdef_->define_property ("short_property", - anyval, - ACE_TRY_ENV); + anyval, + ACE_TRY_ENV); // Check if that is an user exception, if so, print it out. if ((ACE_TRY_ENV.exception () != 0) && @@ -194,8 +194,8 @@ Client::test_define_property (CORBA::Environment &ACE_TRY_ENV) l)); CORBA::Any newany(anyval); propsetdef_->define_property ("long_property", - anyval, - ACE_TRY_ENV); + anyval, + ACE_TRY_ENV); // Check if that is an user exception, if so, print it out. if ((ACE_TRY_ENV.exception () != 0) && @@ -214,8 +214,8 @@ Client::test_define_property (CORBA::Environment &ACE_TRY_ENV) "Main : Float f = %f\n", f)); propsetdef_->define_property ("float_property", - anyval, - ACE_TRY_ENV); + anyval, + ACE_TRY_ENV); // Check if that is an user exception, if so, print it out. if ((ACE_TRY_ENV.exception () != 0) && @@ -237,8 +237,8 @@ Client::test_define_property (CORBA::Environment &ACE_TRY_ENV) strvar.in (), newstr)); propsetdef_->define_property ("string_property", - anyval, - ACE_TRY_ENV); + anyval, + ACE_TRY_ENV); // Check if that is an user exception, if so, print it out. if ((ACE_TRY_ENV.exception () != 0) && @@ -266,27 +266,27 @@ Client::test_get_all_property_names (CORBA::Environment &ACE_TRY_ENV) // Get half on the names and half of on the iterator. CORBA::ULong how_many = num_of_properties / 2; - + // The extra ptr's and out's required to avoind SunnCC's warning // when foo.out () is passed to a funtion. CosPropertyService::PropertyNames_var names_var; CosPropertyService::PropertyNames_ptr names_ptr = 0; CosPropertyService::PropertyNames_out names_out (names_ptr); - + CosPropertyService::PropertyNamesIterator_var iterator_var; CosPropertyService::PropertyNamesIterator_ptr iterator_ptr; CosPropertyService::PropertyNamesIterator_out iterator_out (iterator_ptr); - + propsetdef_->get_all_property_names (how_many, names_out, iterator_out, ACE_TRY_ENV); ACE_CHECK_RETURN (-1); - + // Get the values back to var. names_var = names_out.ptr (); iterator_var = iterator_out.ptr (); - + // Print out the names in the names-sequence. if (names_var.ptr () != 0) { @@ -302,31 +302,31 @@ Client::test_get_all_property_names (CORBA::Environment &ACE_TRY_ENV) if (iterator_var.ptr () != 0) { // Helper variables to stop the SunCC warnings on on foo.out - // (). + // (). CosPropertyService::PropertyName name_ptr = 0; CosPropertyService::PropertyName_out name_out (name_ptr); - + // Call the function. CORBA::Boolean next_one_result = iterator_var->next_one (name_out, ACE_TRY_ENV); - + // Get the values back on a _var variable. CosPropertyService::PropertyName_var name_var = name_out.ptr (); - + while (next_one_result == 1) { ACE_CHECK_RETURN (-1); ACE_DEBUG ((LM_DEBUG, "%s\n", name_var.in ())); - + // Call the function to iterate again. next_one_result = iterator_var->next_one (name_out, ACE_TRY_ENV); - + // Get the values back on a _var variable. name_var = name_out.ptr (); } ACE_CHECK_RETURN (-1); } - + return 0; } @@ -365,10 +365,10 @@ Client::test_get_properties (CORBA::Environment &ACE_TRY_ENV) ACE_TRY_ENV); ACE_UNUSED_ARG (return_val); ACE_CHECK_RETURN (-1); - + // Get the value to the _var. CosPropertyService::Properties_var properties = properties_out.ptr (); - + if (properties.ptr () != 0) { // Go thru the properties and print them out, if they are not @@ -454,7 +454,7 @@ Client::test_delete_properties (CORBA::Environment &ACE_TRY_ENV) prop_names.length (), prop_names.maximum ())); this->propsetdef_->delete_properties (prop_names, - ACE_TRY_ENV); + ACE_TRY_ENV); ACE_CHECK_RETURN ( 0); return 0; @@ -476,7 +476,7 @@ Client::test_define_properties (CORBA::Environment &ACE_TRY_ENV) anyval <<= CORBA::Any::from_char (ch); ch = '*'; anyval >>= CORBA::Any::to_char (ch); - nproperties[0].property_name = CORBA::string_copy ("char_property"); + nproperties[0].property_name = CORBA::string_dup ("char_property"); nproperties[0].property_value <<= CORBA::Any::from_char (ch); // Prepare a Short and "define" that in the PropertySet. @@ -484,7 +484,7 @@ Client::test_define_properties (CORBA::Environment &ACE_TRY_ENV) anyval <<= s; s = 7; anyval >>= s; - nproperties[1].property_name = CORBA::string_copy ("short_property"); + nproperties[1].property_name = CORBA::string_dup ("short_property"); nproperties[1].property_value <<= s; // Prepare a Long and "define" that in the PropertySet. @@ -492,7 +492,7 @@ Client::test_define_properties (CORBA::Environment &ACE_TRY_ENV) anyval <<= l; l = 931233; anyval >>= l; - nproperties[2].property_name = CORBA::string_copy ("long_property"); + nproperties[2].property_name = CORBA::string_dup ("long_property"); nproperties[2].property_value <<= l; // Prepare a Float and "define" that in the PropertySet. @@ -500,7 +500,7 @@ Client::test_define_properties (CORBA::Environment &ACE_TRY_ENV) anyval <<= f; f = 4.14F; anyval >>= f; - nproperties[3].property_name = CORBA::string_copy ("float_property"); + nproperties[3].property_name = CORBA::string_dup ("float_property"); nproperties[3].property_value <<= f; // Define this sequence of properties now. @@ -531,17 +531,17 @@ Client::test_get_all_properties (CORBA::Environment &ACE_TRY_ENV) CosPropertyService::Properties_out properties_out (properties_ptr); CosPropertyService::PropertiesIterator_ptr iterator_ptr = 0; CosPropertyService::PropertiesIterator_out iterator_out (iterator_ptr); - + propsetdef_->get_all_properties (how_many, properties_out, iterator_out, ACE_TRY_ENV); ACE_CHECK_RETURN ( -1); - + // Get these values to the _var's. CosPropertyService::Properties_var properties = properties_out.ptr (); CosPropertyService::PropertiesIterator_var iterator = iterator_out.ptr (); - + // Print out the properties now. if (properties.ptr () != 0) { @@ -587,11 +587,11 @@ Client::test_get_all_properties (CORBA::Environment &ACE_TRY_ENV) // Helper variables to avoid warnings with .out () in SunCC. CosPropertyService::Property* property_ptr = 0; CosPropertyService::Property_out property_out (property_ptr); - + // Call the funtion. CORBA::Boolean next_one_result = iterator->next_one (property_out, - ACE_TRY_ENV); - + ACE_TRY_ENV); + // Get the value to the _var variable. CosPropertyService::Property_var property = property_out.ptr (); @@ -638,11 +638,11 @@ Client::test_get_all_properties (CORBA::Environment &ACE_TRY_ENV) property->property_value >>= l; ACE_DEBUG ((LM_DEBUG,"%d\n", l)); } - + // Call the function for the next iteraton. next_one_result = iterator->next_one (property_out, - ACE_TRY_ENV); - + ACE_TRY_ENV); + // Get the value to the _var variable. property = property_out.ptr (); } @@ -716,9 +716,9 @@ Client::test_define_property_with_mode (CORBA::Environment &ACE_TRY_ENV) l)); CORBA::Any newany(anyval); propsetdef_->define_property_with_mode ("long_property", - anyval, - CosPropertyService::fixed_normal, - ACE_TRY_ENV); + anyval, + CosPropertyService::fixed_normal, + ACE_TRY_ENV); ACE_CHECK_RETURN ( -1); @@ -731,9 +731,9 @@ Client::test_define_property_with_mode (CORBA::Environment &ACE_TRY_ENV) "Main : Float f = %f\n", f)); propsetdef_->define_property_with_mode ("float_property", - anyval, - CosPropertyService::fixed_readonly, - ACE_TRY_ENV); + anyval, + CosPropertyService::fixed_readonly, + ACE_TRY_ENV); ACE_CHECK_RETURN ( -1); // Prepare a String and "define" that in the PropertySet. @@ -752,7 +752,7 @@ Client::test_define_property_with_mode (CORBA::Environment &ACE_TRY_ENV) anyval, ACE_TRY_ENV); ACE_CHECK_RETURN ( -1); - + return 0; } @@ -769,13 +769,13 @@ Client::test_get_property_value (CORBA::Environment &ACE_TRY_ENV) CORBA::Any_ptr any_ptr = this->propsetdef_->get_property_value ("PropertySetDef_IOR", ACE_TRY_ENV); ACE_TRY_CHECK; - + ACE_DEBUG ((LM_DEBUG, "Property value received successfully\n")); // Check whether the IOR is fine. CORBA::Object_var propsetdef_object; (*any_ptr) >>= CORBA::Any::to_object (propsetdef_object.out ()); - + CosPropertyService::PropertySetDef_var propsetdef = CosPropertyService::PropertySetDef::_narrow (propsetdef_object.in (), ACE_TRY_ENV); @@ -828,6 +828,6 @@ main (int argc, char **argv) return -1; } ACE_ENDTRY; - + return 0; } diff --git a/TAO/orbsvcs/tests/Property/main.cpp b/TAO/orbsvcs/tests/Property/main.cpp index 9c8f3b1736a..639cfc6c116 100644 --- a/TAO/orbsvcs/tests/Property/main.cpp +++ b/TAO/orbsvcs/tests/Property/main.cpp @@ -2,18 +2,18 @@ // ======================================================================== // -// = FILE +// = FILE // Program to test the property services. // // = DESCRIPTION // Here all the objects are at one address space. See the // client.cpp and server.cpp to see property calls on remote -// objects. +// objects. // // = AUTHOR // Alexander Babu Arulanthu <alex@cs.wustl.edu> // -// ======================================================================== +// ======================================================================== #include "orbsvcs/CosPropertyServiceS.h" #include "orbsvcs/Property/CosPropertyService_i.h" @@ -36,34 +36,34 @@ public: TAO_PropertySet_Tester (void); // Constructor. - + ~TAO_PropertySet_Tester (void); // Destructor. - + int test_define_property (CORBA::Environment &ACE_TRY_ENV); // Defines a char,a short, a long, a float and a string property. - + int test_get_number_of_properties (CORBA::Environment &ACE_TRY_ENV); // Gets the number of properties currently defined in the PropertySet. - + int test_delete_property (const char *property_name, CORBA::Environment &ACE_TRY_ENV); // Delete a given property. - + int test_is_property_defined (CORBA::Environment &ACE_TRY_ENV); // Check the following properties are defined or // no. "char_property", "short_property" and a "string_property". - + int test_get_property_value (CORBA::Environment &ACE_TRY_ENV); // Get the "float_property" and "string_property" and print them // out. - + int test_delete_properties (CORBA::Environment &ACE_TRY_ENV); // Delete char, short,long, and string properties. - + int test_delete_all_properties (CORBA::Environment &ACE_TRY_ENV); // Delete all the properties. - + int test_define_properties (CORBA::Environment &ACE_TRY_ENV); // Define a sequence of properties. a char, a short, a long, a float // and a string. @@ -73,7 +73,7 @@ private: // The PropertySet. }; -class TAO_PropertyNamesIterator_Tester +class TAO_PropertyNamesIterator_Tester { // = TITLE // The testing code for the PropertyNamesIterator interface are grouped @@ -85,17 +85,17 @@ class TAO_PropertyNamesIterator_Tester public: TAO_PropertyNamesIterator_Tester (TAO_PropertySet_Tester &propertyset_tester); // Constructor. To make names iterator from the property set object. - + ~TAO_PropertyNamesIterator_Tester (void); // Destructor. int test_next_one (CORBA::Environment &ACE_TRY_ENV); // Test next one method. Iterate thru all the names in the // PropertySet and print them out. - + int test_reset (CORBA::Environment &ACE_TRY_ENV); // Test the reset method. - + int test_next_n (size_t n, CORBA::Environment &ACE_TRY_ENV); // Test the next_n method. private: @@ -120,9 +120,9 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) { ACE_DEBUG ((LM_DEBUG, "\nChecking define_property\n")); - + CORBA::Any anyval; - + // Prepare a char and "define" that in the PropertySet. CORBA::Char ch = '#'; anyval <<= from_char (ch); @@ -135,11 +135,11 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) anyval, ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); - + // Prepare a Short and "define" that in the PropertySet. CORBA::Short s = 3; - anyval <<= s; - s = 7; + anyval <<= s; + s = 7; anyval >>= s; ACE_DEBUG ((LM_DEBUG, "Main : Short s = %d\n", @@ -149,7 +149,7 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); - + // Prepare a Long and "define" that in the PropertySet. CORBA::Long l = 931232; anyval <<= l; @@ -159,12 +159,12 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) "Main : Long l = %d\n", l)); CORBA::Any newany(anyval); - + property_set_.define_property ("long_property", anyval, ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); - + // Prepare a Float and "define" that in the PropertySet. CORBA::Float f = 3.14; anyval <<= f; @@ -173,11 +173,11 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) ACE_DEBUG ((LM_DEBUG, "Main : Float f = %f\n", f)); - property_set_.define_property ("float_property", - anyval, + property_set_.define_property ("float_property", + anyval, ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); - + // Prepare a String and "define" that in the PropertySet. ACE_DEBUG ((LM_DEBUG, "Main: Any holding String\n")); @@ -201,7 +201,7 @@ TAO_PropertySet_Tester::test_define_property (CORBA::Environment &ACE_TRY_ENV) int TAO_PropertySet_Tester::test_get_number_of_properties (CORBA::Environment &ACE_TRY_ENV) { - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "Main : Number of props : %d\n", property_set_.get_number_of_properties (ACE_TRY_ENV))); ACE_CHECK_RETURN ( 1); @@ -230,11 +230,11 @@ TAO_PropertySet_Tester::test_get_property_value (CORBA::Environment &ACE_TRY_ENV { ACE_DEBUG ((LM_DEBUG, "\nChecking get_property_value\n")); - + CORBA::Any_ptr anyptr = property_set_.get_property_value ("short_property", ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); - + // Get the short value. if (anyptr != 0) { @@ -258,7 +258,7 @@ TAO_PropertySet_Tester::test_get_property_value (CORBA::Environment &ACE_TRY_ENV ACE_DEBUG ((LM_DEBUG, "Str %s\n", str)); } - else + else ACE_DEBUG ((LM_DEBUG, "string_property not found\n")); return 0; @@ -276,7 +276,7 @@ TAO_PropertySet_Tester::test_is_property_defined (CORBA::Environment &ACE_TRY_EN ACE_TRY_ENV) == 0) ACE_DEBUG ((LM_DEBUG, "short_property not defined\n")); - else + else ACE_DEBUG ((LM_DEBUG, "short_property defined\n")); ACE_CHECK_RETURN ( 1); @@ -321,7 +321,7 @@ TAO_PropertySet_Tester::test_delete_properties (CORBA::Environment &ACE_TRY_ENV) property_set_.delete_properties (prop_names, ACE_TRY_ENV); ACE_CHECK_RETURN ( 0); - + return 0; } @@ -329,7 +329,7 @@ TAO_PropertySet_Tester::test_delete_properties (CORBA::Environment &ACE_TRY_ENV) // float and string property in the property set. int TAO_PropertySet_Tester::test_define_properties (CORBA::Environment &ACE_TRY_ENV) -{ +{ ACE_DEBUG ((LM_DEBUG, "\nChecking define_properties == Defining sequence of properties\n")); // TAO_TRY @@ -341,40 +341,40 @@ TAO_PropertySet_Tester::test_define_properties (CORBA::Environment &ACE_TRY_ENV) CORBA::Char ch = '#'; anyval <<= from_char (ch); ch = '*'; - anyval >>= to_char (ch); - nproperties[0].property_name = CORBA::string_copy ("char_property"); + anyval >>= to_char (ch); + nproperties[0].property_name = CORBA::string_dup ("char_property"); nproperties[0].property_value <<= from_char (ch); - + // Prepare a Short and "define" that in the PropertySet. CORBA::Short s = 3; - anyval <<= s; - s = 7; + anyval <<= s; + s = 7; anyval >>= s; - nproperties[1].property_name = CORBA::string_copy ("short_property"); + nproperties[1].property_name = CORBA::string_dup ("short_property"); nproperties[1].property_value <<= s; - + // Prepare a Long and "define" that in the PropertySet. CORBA::Long l = 931232; anyval <<= l; l = 931233; anyval >>= l; - nproperties[2].property_name = CORBA::string_copy ("long_property"); + nproperties[2].property_name = CORBA::string_dup ("long_property"); nproperties[2].property_value <<= l; - + // Prepare a Float and "define" that in the PropertySet. CORBA::Float f = 3.14; anyval <<= f; f = 4.14; anyval >>= f; - nproperties[3].property_name = CORBA::string_copy ("float_property"); + nproperties[3].property_name = CORBA::string_dup ("float_property"); nproperties[3].property_value <<= f; - + // Prepare a String and "define" that in the PropertySet. CORBA::String_var strvar (CORBA::string_dup ("Test_String")); anyval <<= strvar.in (); - nproperties[4].property_name = CORBA::string_copy ("string_property"); + nproperties[4].property_name = CORBA::string_dup ("string_property"); nproperties[4].property_value <<= strvar.in (); - + // Define this sequence of properties now. property_set_.define_properties (nproperties, ACE_TRY_ENV); ACE_CHECK_RETURN ( 1); @@ -386,7 +386,7 @@ TAO_PropertySet_Tester::test_define_properties (CORBA::Environment &ACE_TRY_ENV) int TAO_PropertySet_Tester::test_delete_all_properties (CORBA::Environment &ACE_TRY_ENV) { - // Deleting all the properties + // Deleting all the properties ACE_DEBUG ((LM_DEBUG, "\nChecking delete_all_properties\n")); if (property_set_.delete_all_properties (ACE_TRY_ENV) == 1) @@ -402,7 +402,7 @@ TAO_PropertySet_Tester::test_delete_all_properties (CORBA::Environment &ACE_TRY_ TAO_PropertyNamesIterator_Tester::TAO_PropertyNamesIterator_Tester (TAO_PropertySet_Tester &propertyset_tester) : iterator_ (propertyset_tester.property_set_) { -} +} // Destructor. TAO_PropertyNamesIterator_Tester::~TAO_PropertyNamesIterator_Tester (void) @@ -411,7 +411,7 @@ TAO_PropertyNamesIterator_Tester::~TAO_PropertyNamesIterator_Tester (void) // Test next one method. Iterate thru all the names in the // PropertySet and print them out. -int +int TAO_PropertyNamesIterator_Tester::test_next_one (CORBA::Environment &ACE_TRY_ENV) { CORBA::String_var strvar; @@ -419,7 +419,7 @@ TAO_PropertyNamesIterator_Tester::test_next_one (CORBA::Environment &ACE_TRY_ENV "\nTesting next_one of NamesIterator, Iterating thru names.\n")); // Let us iterate, now. while (iterator_.next_one (strvar.out (), ACE_TRY_ENV) != 0) - { + { ACE_CHECK_RETURN ( 1); ACE_DEBUG ((LM_DEBUG, "Str : %s\n", strvar.in ())); } @@ -444,7 +444,7 @@ TAO_PropertyNamesIterator_Tester::test_next_n (size_t n, { CosPropertyService::PropertyNames_var pnames_var; ACE_DEBUG ((LM_DEBUG, - "Checking next_n (), next %d\n", + "Checking next_n (), next %d\n", n)); if (iterator_.next_n (n, pnames_var.out (), ACE_TRY_ENV) == 0) { @@ -462,8 +462,8 @@ TAO_PropertyNamesIterator_Tester::test_next_n (size_t n, return 0; } -int -main (int argc, char *argv []) +int +main (int argc, char *argv []) { ACE_TRY { @@ -474,11 +474,11 @@ main (int argc, char *argv []) ACE_TRY_CHECK; // = Checking PropertySet interface. - + ACE_DEBUG ((LM_DEBUG, "\nTAO_PropertySet Testing\n")); TAO_PropertySet_Tester propertyset_tester; - + // Checking define_property. define a char, a short,a long, a float // and a string. propertyset_tester.test_define_property (ACE_TRY_ENV); @@ -491,7 +491,7 @@ main (int argc, char *argv []) // Test delete property. Delete "string_property" propertyset_tester.test_delete_property ("string_property", ACE_TRY_ENV); ACE_TRY_CHECK; - + // Test the number of properties and print it out. propertyset_tester.test_get_number_of_properties (ACE_TRY_ENV); ACE_TRY_CHECK; @@ -499,69 +499,69 @@ main (int argc, char *argv []) // Test delete_properties. Delete char, short, long and float. propertyset_tester.test_delete_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Test the number of properties and print it out. propertyset_tester.test_get_number_of_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Define a sequence of properties. char, short, long, float and // string. propertyset_tester.test_define_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Test the number of properties and print it out. propertyset_tester.test_get_number_of_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Checking get_property_value. get the value of short and string. propertyset_tester.test_get_property_value (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Checking delete_all_properties. propertyset_tester.test_delete_all_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Test the number of properties and print it out. propertyset_tester.test_get_number_of_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Define a sequence of properties. char, short, long, float and // string. propertyset_tester.test_define_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Test the number of properties and print it out. propertyset_tester.test_get_number_of_properties (ACE_TRY_ENV); ACE_TRY_CHECK; - + // = Checking the PropertyNamesIterator interface. - + ACE_DEBUG ((LM_DEBUG, "\nTAO_PropertyNamesIterator Testing\n")); - + // Construct the names iterator from the PropertySet object. TAO_PropertyNamesIterator_Tester names_iterator_tester (propertyset_tester); - + // Checking next_one. Iterate thru the property names. names_iterator_tester.test_next_one (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Checking the reset () method. names_iterator_tester.test_reset (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Iterating again thru the property names. names_iterator_tester.test_next_one (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Reset again. names_iterator_tester.test_reset (ACE_TRY_ENV); ACE_TRY_CHECK; - + // Checking next_n. Prints out all the names it has got. names_iterator_tester.test_next_n (6, ACE_TRY_ENV); ACE_TRY_CHECK; - + // Try next_n without resetting. names_iterator_tester.test_next_n (6, ACE_TRY_ENV); ACE_TRY_CHECK; @@ -578,14 +578,4 @@ main (int argc, char *argv []) } ACE_ENDTRY; return 0; -} - - - - - - - - - - +} diff --git a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/svc.conf b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/svc.conf index 67aa53194b9..3e062048b55 100644 --- a/TAO/performance-tests/Cubit/TAO/IDL_Cubit/svc.conf +++ b/TAO/performance-tests/Cubit/TAO/IDL_Cubit/svc.conf @@ -3,6 +3,6 @@ # Please see $TAO_ROOT/docs/Options.html for details on these options. # -static Resource_Factory "-ORBresources global -ORBreactorlock null -ORBinputcdrallocator tss" +static Resource_Factory "-ORBresources global -ORBreactortype select_st -ORBinputcdrallocator tss" static Client_Strategy_Factory "-ORBiiopprofilelock null -ORBclientconnectionhandler RW" static Server_Strategy_Factory "-ORBconcurrency thread-per-connection -ORBpoalock null -ORBconnectorlock null -ORBallowreactivationofsystemids 0" diff --git a/TAO/tao/CDR_Interpreter.cpp b/TAO/tao/CDR_Interpreter.cpp index 4fee1c6fde2..d484286be3e 100644 --- a/TAO/tao/CDR_Interpreter.cpp +++ b/TAO/tao/CDR_Interpreter.cpp @@ -190,7 +190,7 @@ declare_entry (CORBA::LongLong, tk_longlong); declare_entry (CORBA::ULongLong, tk_ulonglong); declare_entry (CORBA::LongDouble, tk_longdouble); declare_entry (CORBA::WChar, tk_wchar); -declare_entry (CORBA::WString, tk_wstring); +declare_entry (CORBA::WChar*, tk_wstring); void TAO_CDR_Interpreter::init (void) @@ -231,7 +231,7 @@ TAO_CDR_Interpreter::init (void) setup_entry (CORBA::ULongLong, tk_ulonglong); setup_entry (CORBA::LongDouble, tk_longdouble); setup_entry (CORBA::WChar, tk_wchar); - setup_entry (CORBA::WString, tk_wstring); + setup_entry (CORBA::WChar*, tk_wstring); } #undef setup @@ -461,7 +461,7 @@ TAO_CDR_Interpreter::calc_nested_size_and_alignment (CORBA::TypeCode_ptr tc, } // Notice how we change the sign of the offset to estimate the - // maximum size. + // maximum size. // Also note that the offset is computed starting from the offset // field. However, by this time, we have already read the offset field i.e., // we have already moved ahead by 4 bytes (size of CORBA::Long). So we should @@ -638,7 +638,7 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, void *two; }; align_ptr ap; - + // the first member of the union internal representation is the VPTR // since every union inherits from TAO_Base_Union overall_alignment = (char *) &ap.two - (char *) &ap.one @@ -663,7 +663,7 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, CORBA::TypeCode discrim_tc (CORBA::tk_void); discrim_and_base_size = sizeof (TAO_Base_Union) + - calc_nested_size_and_alignment (&discrim_tc, + calc_nested_size_and_alignment (&discrim_tc, stream, value_alignment, env); @@ -673,7 +673,7 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, if (value_alignment > overall_alignment) overall_alignment = value_alignment; - + // skip "default used" indicator, and save "member count" if (!stream->read_ulong (temp) // default used @@ -797,9 +797,9 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, // Round up the discriminator's size to include padding it needs in // order to be followed by the value. - discrim_and_base_size_with_pad = + discrim_and_base_size_with_pad = (size_t) align_binary (discrim_and_base_size, value_alignment); - discrim_size_with_pad = discrim_and_base_size_with_pad - + discrim_size_with_pad = discrim_and_base_size_with_pad - sizeof (TAO_Base_Union); // Now calculate the overall size of the structure, which is the // discriminator, inter-element padding, value, and tail padding. diff --git a/TAO/tao/Managed_Types.cpp b/TAO/tao/Managed_Types.cpp index 8f1d3f92aa7..1510168df07 100644 --- a/TAO/tao/Managed_Types.cpp +++ b/TAO/tao/Managed_Types.cpp @@ -28,3 +28,22 @@ TAO_SeqElem_String_Manager::operator= (const CORBA::String_var &var) return *this; } +// **************************************************************** + +TAO_WString_Manager& +TAO_WString_Manager::operator= (const CORBA::WString_var &var) +{ + CORBA::wstring_free (this->ptr_); + this->ptr_ = CORBA::wstring_dup (var.in ()); + return *this; +} + +TAO_SeqElem_WString_Manager& +TAO_SeqElem_WString_Manager::operator= (const CORBA::WString_var &var) +{ + if (this->release_) + CORBA::wstring_free (*this->ptr_); + *this->ptr_ = CORBA::wstring_dup (var.in ()); + return *this; +} + diff --git a/TAO/tao/Managed_Types.h b/TAO/tao/Managed_Types.h index 81b11412f62..72fd617f6c5 100644 --- a/TAO/tao/Managed_Types.h +++ b/TAO/tao/Managed_Types.h @@ -38,7 +38,7 @@ class TAO_Export TAO_String_Manager public: TAO_String_Manager (void); - // default CTOR will initialize the underlying ptr_ to empty string. + // default CTOR will initialize the underlying ptr_ to empty string. TAO_String_Manager (const TAO_String_Manager &); // copy constructor @@ -170,8 +170,7 @@ private: }; -#if 0 /* WString_var not implemented in TAO yet - 01/03/1999 */ -/****************************************************************/ +// **************************************************************** class TAO_Export TAO_WString_Manager { @@ -180,16 +179,18 @@ class TAO_Export TAO_WString_Manager // // = DESCRIPTION // - // This class implements the generic wstring manager and is used in the C++ - // mapping of "struct" members that are of type "wstring". The difference - // between this class and the CORBA::WString_var class is that the default - // conctructor initializes the underlying wstring to an empty string in this - // class whereas it is a NUL wstring for the _var class. + // This class implements the generic wstring manager and is used + // in the C++ mapping of "struct" members that are of type + // "wstring". + // The difference between this class and the CORBA::WString_var + // class is that the default constructor initializes the + // underlying wstring to an empty string in this class whereas it + // is a NUL wstring for the _var class. // public: TAO_WString_Manager (void); - // default CTOR will initialize the underlying ptr_ to empty string. + // default CTOR will initialize the underlying ptr_ to empty string. TAO_WString_Manager (const TAO_WString_Manager &); // copy constructor @@ -207,8 +208,8 @@ public: // assignment from a constant wchar* will make a copy TAO_WString_Manager &operator= (CORBA::WChar *); - // assignment from wchar* will not make a copy. The WString_Manager will now - // own the string. + // assignment from wchar* will not make a copy. The WString_Manager + // will now own the string. operator const CORBA::WChar*() const; // cast (read-only) @@ -255,10 +256,10 @@ class TAO_Export TAO_SeqElem_WString_Manager // This class implements the generic string manager and is used to // instantiate the proper sequence types. // - // This class will have the same semantics as the string manager classes - // defined earlier with respect to the various assignment - // operators. However, the freeing of old storage will be dependent on the - // "release" value of the parent sequence class. + // This class will have the same semantics as the string manager + // classes defined earlier with respect to the various assignment + // operators. However, the freeing of old storage will be + // dependent on the "release" value of the parent sequence class. // public: friend class TAO_Unbounded_WString_Sequence; @@ -268,7 +269,8 @@ public: // friend template<CORBA::ULong MAX> // class TAO_Bounded_WString_Sequence<TAO_SeqElem_WString_Manager,MAX>; - TAO_SeqElem_WString_Manager (char **buffer, CORBA::Boolean release); + TAO_SeqElem_WString_Manager (CORBA::WChar **buffer, + CORBA::Boolean release); // constructor from address of an element ~TAO_SeqElem_WString_Manager (void); @@ -280,30 +282,30 @@ public: TAO_SeqElem_WString_Manager &operator= (const CORBA::WString_var&); // assignment from var type will make a copy - TAO_SeqElem_WString_Manager &operator= (const char *); + TAO_SeqElem_WString_Manager &operator= (const CORBA::WChar *); // assignment from a constant char* will make a copy - TAO_SeqElem_WString_Manager &operator= (char *); - // assignment from char* will not make a copy. The SeqElem_WString_Manager will now - // own the string. + TAO_SeqElem_WString_Manager &operator= (CORBA::WChar *); + // assignment from char* will not make a copy. The + // SeqElem_WString_Manager will now own the string. - operator const char*() const; + operator const CORBA::WChar*() const; // cast (read-only) - const char *in (void) const; + const CORBA::WChar *in (void) const; // for in parameter. - char *&inout (void); + CORBA::WChar *&inout (void); // for inout parameter. - char *&out (void); + CORBA::WChar *&out (void); // for out parameter. - char *_retn (void); + CORBA::WChar *_retn (void); // for string of return type. private: - char **ptr_; + CORBA::WChar **ptr_; // Address of string element from the parent's buffer. CORBA::Boolean release_; @@ -320,7 +322,6 @@ private: // copy constructor }; -#endif /* 0 */ #if defined (__ACE_INLINE__) #include "tao/Managed_Types.i" diff --git a/TAO/tao/Managed_Types.i b/TAO/tao/Managed_Types.i index 88aac12835e..dc5eda08f2e 100644 --- a/TAO/tao/Managed_Types.i +++ b/TAO/tao/Managed_Types.i @@ -19,7 +19,7 @@ // default CTOR initializes to empty string ACE_INLINE TAO_String_Manager::TAO_String_Manager (void) - : ptr_ (CORBA::string_dup ("")) + : ptr_ (0) // @@ CORBA::string_dup (L"")) { } @@ -192,13 +192,12 @@ TAO_SeqElem_String_Manager::_retn (void) return temp; } -#if 0 /* To be included once we have support for WString_var */ // **************************************************************** // default CTOR initializes to empty string ACE_INLINE TAO_WString_Manager::TAO_WString_Manager (void) - : ptr_ (CORBA::wstring_dup ("")) + : ptr_ (0) // @@ TODO CORBA::wstring_dup ("")) { } @@ -228,15 +227,6 @@ TAO_WString_Manager::operator= (const TAO_WString_Manager &rhs) return *this; } -// assignment from CORBA::String_var makes a copy -ACE_INLINE TAO_WString_Manager& -TAO_WString_Manager::operator= (const CORBA::String_var &var) -{ - CORBA::string_free (this->ptr_); - this->ptr_ = CORBA::wstring_dup (var.in ()); - return *this; -} - // assignment from const CORBA::WChar* makes a copy ACE_INLINE TAO_WString_Manager & TAO_WString_Manager::operator= (const CORBA::WChar * p) @@ -292,8 +282,9 @@ TAO_WString_Manager::_retn (void) // **************************************************************** ACE_INLINE -TAO_SeqElem_WString_Manager::TAO_SeqElem_WString_Manager (CORBA::WChar **buffer, - CORBA::Boolean release) +TAO_SeqElem_WString_Manager:: + TAO_SeqElem_WString_Manager (CORBA::WChar **buffer, + CORBA::Boolean release) : ptr_ (buffer), release_ (release) { @@ -317,16 +308,6 @@ TAO_SeqElem_WString_Manager::operator= (const TAO_SeqElem_WString_Manager &rhs) return *this; } -// assignment from String_var -ACE_INLINE TAO_SeqElem_WString_Manager& -TAO_SeqElem_WString_Manager::operator= (const CORBA::wstring_var &var) -{ - if (this->release_) - CORBA::wstring_free (*this->ptr_); - *this->ptr_ = CORBA::wstring_dup (var.in ()); - return *this; -} - // assignment from const CORBA::WChar* will make copy ACE_INLINE TAO_SeqElem_WString_Manager & TAO_SeqElem_WString_Manager::operator= (const CORBA::WChar *p) @@ -380,5 +361,3 @@ TAO_SeqElem_WString_Manager::_retn (void) *this->ptr_ = 0; return temp; } - -#endif /* 0 */ diff --git a/TAO/tao/Marshal.i b/TAO/tao/Marshal.i index 7a584dd82c5..1d95143e76d 100644 --- a/TAO/tao/Marshal.i +++ b/TAO/tao/Marshal.i @@ -193,8 +193,8 @@ TAO_Marshal_String::deep_free (CORBA::TypeCode_ptr, const void *, CORBA::Environment &) { - CORBA::string_free (*(CORBA::String *) source); - *(CORBA::String *)source = 0; + CORBA::string_free (*(CORBA::Char* *) source); + *(CORBA::Char* *)source = 0; return CORBA::TypeCode::TRAVERSE_CONTINUE; } @@ -205,7 +205,7 @@ TAO_Marshal_WString::deep_free (CORBA::TypeCode_ptr, const void *, CORBA::Environment &) { - CORBA::wstring_free (*(CORBA::WString *) source); - *(CORBA::WString *)source = 0; + CORBA::wstring_free (*(CORBA::WChar* *) source); + *(CORBA::WChar* *)source = 0; return CORBA::TypeCode::TRAVERSE_CONTINUE; } diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 40d6695310c..a829acc5d9f 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -79,27 +79,7 @@ int CORBA_ORB::orb_init_count_ = 0; // Pointer to the "default ORB." CORBA::ORB_ptr CORBA::instance_ = 0; -CORBA_String_var::CORBA_String_var (char *p) - : ptr_ (p) -{ - // NOTE: According to the CORBA spec this string must *not* be - // copied, but it is non-compliant to use it/release it in the - // calling code. argument is consumed. p should never be NULL -} - -CORBA_String_var::CORBA_String_var (const CORBA_String_var& r) -{ - this->ptr_ = CORBA::string_dup (r.ptr_); -} - -CORBA_String_var::~CORBA_String_var (void) -{ - if (this->ptr_ != 0) - { - CORBA::string_free (this->ptr_); - this->ptr_ = 0; - } -} +// **************************************************************** CORBA_ORB::InvalidName::InvalidName (void) { @@ -984,7 +964,7 @@ CORBA_ORB::create_stub_object (const TAO_ObjectKey &key, CORBA::String id = 0; if (type_id) - id = CORBA::string_copy (type_id); + id = CORBA::string_dup (type_id); TAO_Stub *stub = 0; @@ -1115,22 +1095,37 @@ CORBA_ORB::create_dyn_enum (CORBA_TypeCode_ptr tc, #endif /* TAO_HAS_MINIMUM_CORBA */ +// **************************************************************** + // String utility support; this needs to be integrated with the ORB's // own memory allocation subsystem. -CORBA::String +CORBA::Char* CORBA::string_copy (const CORBA::Char *str) { - if (!str) - return 0; + return CORBA::string_dup (str); +} - size_t len = ACE_OS::strlen (str); +CORBA_String_var::CORBA_String_var (char *p) + : ptr_ (p) +{ + // NOTE: According to the CORBA spec this string must *not* be + // copied, but it is non-compliant to use it/release it in the + // calling code. argument is consumed. p should never be NULL +} - // This allocates an extra byte for the '\0'; - CORBA::String copy = CORBA::string_alloc (len); +CORBA_String_var::CORBA_String_var (const CORBA_String_var& r) +{ + this->ptr_ = CORBA::string_dup (r.ptr_); +} - ACE_OS::memcpy (copy, str, len + 1); - return copy; +CORBA_String_var::~CORBA_String_var (void) +{ + if (this->ptr_ != 0) + { + CORBA::string_free (this->ptr_); + this->ptr_ = 0; + } } CORBA_String_var & @@ -1167,31 +1162,66 @@ CORBA_String_var::operator= (const CORBA_String_var& r) return *this; } -// Wide Character string utility support; this can need to be -// integrated with the ORB's own memory allocation subsystem. +// **************************************************************** -CORBA::WString -CORBA::wstring_alloc (CORBA::ULong len) +CORBA_WString_var::CORBA_WString_var (CORBA::WChar *p) + : ptr_ (p) { - return new CORBA::WChar [(size_t) (len + 1)]; + // NOTE: According to the CORBA spec this string must *not* be + // copied, but it is non-compliant to use it/release it in the + // calling code. argument is consumed. p should never be NULL } -CORBA::WString -CORBA::wstring_copy (const CORBA::WChar *const str) +CORBA_WString_var::CORBA_WString_var (const CORBA_WString_var& r) { - if (!str) - return 0; + this->ptr_ = CORBA::wstring_dup (r.ptr_); +} - CORBA::WString retval = CORBA::wstring_alloc (ACE_OS::wslen (str)); - return ACE_OS::wscpy (retval, str); +CORBA_WString_var::~CORBA_WString_var (void) +{ + if (this->ptr_ != 0) + { + CORBA::wstring_free (this->ptr_); + this->ptr_ = 0; + } } -void -CORBA::wstring_free (CORBA::WChar *const str) +CORBA_WString_var & +CORBA_WString_var::operator= (CORBA::WChar *p) { - delete [] str; + if (this->ptr_ != p) + { + if (this->ptr_ != 0) + CORBA::wstring_free (this->ptr_); + this->ptr_ = p; + } + return *this; +} + +CORBA_WString_var & +CORBA_WString_var::operator= (const CORBA::WChar *p) +{ + if (this->ptr_ != 0) + CORBA::wstring_free (this->ptr_); + + this->ptr_ = CORBA::wstring_dup (p); + return *this; } +CORBA_WString_var & +CORBA_WString_var::operator= (const CORBA_WString_var& r) +{ + if (this != &r) + { + if (this->ptr_ != 0) + CORBA::wstring_free (this->ptr_); + this->ptr_ = CORBA::wstring_dup (r.ptr_); + } + return *this; +} + +// **************************************************************** + void CORBA_ORB::init_orb_globals (CORBA::Environment &ACE_TRY_ENV) { diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index ab0a411549b..ff45b06fdd1 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -206,6 +206,115 @@ private: void operator= (const CORBA_String_var &); }; +// **************************************************************** + +class TAO_Export CORBA_WString_var +{ + // = TITLE + // CORBA_WString var class. Provides automatic deallocation of + // storage for wide strings + // +public: + CORBA_WString_var (void); + // default constructor. + + CORBA_WString_var (CORBA::WChar *p); + // constructor, owns p. + + CORBA_WString_var (const CORBA::WChar *p); + // constructor. Makes a copy of p. + + CORBA_WString_var (const CORBA_WString_var &s); + // copy constructor. + + ~CORBA_WString_var (void); + // destructor. + + CORBA_WString_var &operator= (CORBA::WChar *p); + // assignment operator. + + CORBA_WString_var &operator= (const CORBA::WChar *p); + // assignment to a const char*. Makes a copy. + + CORBA_WString_var &operator= (const CORBA_WString_var &s); + // assignment operator. + + operator CORBA::WChar *(); + // access and modify. + + operator const CORBA::WChar *() const; + // only read privileges. + + CORBA::WChar &operator[] (CORBA::ULong index); + // allows access and modification using an index. + + CORBA::WChar operator[] (CORBA::ULong index) const; + // allows only accessing thru an index. + + // = in, out, out, and _retn operations. + // ORBOS/97-05-15, Appendix C.2 + + const CORBA::WChar *in (void) const; + // for in parameter. + + CORBA::WChar *&inout (void); + // for inout parameter. + + CORBA::WChar *&out (void); + // for out parameter. + + CORBA::WChar *_retn (void); + // for string of return type. + +private: + CORBA::WChar *ptr_; + // instance. +}; + +class TAO_Export CORBA_WString_out +{ + // = TITLE + // CORBA_WString_out + // + // = DESCRIPTION + // To support the memory management for "out" parameter passing + // mode. ORBOS/97-05-15, Appendix C.2 defines a CORBA_WString_out + // class + // +public: + // = operations. + + CORBA_WString_out (CORBA::WChar *&p); + // Construction from a reference to a string. + + CORBA_WString_out (CORBA_WString_var &p); + // Construction from a var. + + CORBA_WString_out (const CORBA_WString_out &s); + // Copy constructor. + + CORBA_WString_out &operator= (const CORBA_WString_out &s); + // Assignment from a string_out. + + CORBA_WString_out &operator= (CORBA::WChar *p); + // Assignment from a string. + + operator CORBA::WChar *&(); + // Cast. + + CORBA::WChar *&ptr (void); + // Return underlying instance. + +private: + CORBA::WChar *&ptr_; + // Instance. + + // assignment from _var disallowed + void operator= (const CORBA_WString_var &); +}; + +// **************************************************************** + class TAO_Export CORBA_ORB { // = TITLE diff --git a/TAO/tao/ORB.i b/TAO/tao/ORB.i index 45ffe650154..7307b6c30e9 100644 --- a/TAO/tao/ORB.i +++ b/TAO/tao/ORB.i @@ -1,9 +1,6 @@ // -*- c++ -*- // $Id$ -// String utility support. Since these are static methods we need to -// explicitly export them from the DLL. - // ---------------------------------------------------------------------- // String_var type // ---------------------------------------------------------------------- @@ -16,7 +13,7 @@ CORBA_String_var::CORBA_String_var (void) ACE_INLINE CORBA_String_var::CORBA_String_var (const char *p) - : ptr_ (CORBA::string_dup ((char *) p)) + : ptr_ (CORBA::string_dup (p)) { } @@ -123,6 +120,129 @@ CORBA_String_out::ptr (void) return this->ptr_; } +// **************************************************************** + +// ---------------------------------------------------------------------- +// String_var type +// ---------------------------------------------------------------------- + +ACE_INLINE +CORBA_WString_var::CORBA_WString_var (void) +{ + this->ptr_ = 0; +} + +ACE_INLINE +CORBA_WString_var::CORBA_WString_var (const CORBA::WChar *p) + : ptr_ (CORBA::wstring_dup (p)) +{ +} + +ACE_INLINE CORBA::WChar & +CORBA_WString_var::operator[] (CORBA::ULong index) +{ + // We need to verify bounds else raise some exception. + return this->ptr_[index]; +} + +ACE_INLINE CORBA::WChar +CORBA_WString_var::operator[] (CORBA::ULong index) const +{ + // We need to verify bounds else raise some exception. + return this->ptr_[index]; +} + +ACE_INLINE +CORBA_WString_var::operator CORBA::WChar *() +{ + return this->ptr_; +} + +ACE_INLINE +CORBA_WString_var::operator const CORBA::WChar *() const +{ + return this->ptr_; +} + +ACE_INLINE const CORBA::WChar * +CORBA_WString_var::in (void) const +{ + return this->ptr_; +} + +ACE_INLINE CORBA::WChar *& +CORBA_WString_var::inout (void) +{ + return this->ptr_; +} + +ACE_INLINE CORBA::WChar *& +CORBA_WString_var::out (void) +{ + CORBA::wstring_free (this->ptr_); + this->ptr_ = 0; + return this->ptr_; +} + +ACE_INLINE CORBA::WChar * +CORBA_WString_var::_retn (void) +{ + CORBA::WChar *temp = this->ptr_; + this->ptr_ = 0; + return temp; +} + +// ---------------------------------------------------- +// String_out type +// ---------------------------------------------------- + +ACE_INLINE +CORBA_WString_out::CORBA_WString_out (CORBA::WChar *&s) + : ptr_ (s) +{ + this->ptr_ = 0; +} + +ACE_INLINE +CORBA_WString_out::CORBA_WString_out (CORBA_WString_var &s) + : ptr_ (s.out ()) +{ +} + +ACE_INLINE +CORBA_WString_out::CORBA_WString_out (const CORBA_WString_out &s) + : ptr_ (s.ptr_) +{ +} + +ACE_INLINE CORBA_WString_out & +CORBA_WString_out::operator= (const CORBA_WString_out &s) +{ + this->ptr_ = s.ptr_; + return *this; +} + +ACE_INLINE CORBA_WString_out & +CORBA_WString_out::operator= (CORBA::WChar *s) +{ + this->ptr_ = s; + return *this; +} + +ACE_INLINE +CORBA_WString_out::operator CORBA::WChar *&() +{ + return this->ptr_; +} + +ACE_INLINE CORBA::WChar *& +CORBA_WString_out::ptr (void) +{ + return this->ptr_; +} + +// **************************************************************** + // --------------------------------------------------------------------------- // ORB specific // --------------------------------------------------------------------------- diff --git a/TAO/tao/POA.cpp b/TAO/tao/POA.cpp index 359d1322b11..36fe0daeb87 100644 --- a/TAO/tao/POA.cpp +++ b/TAO/tao/POA.cpp @@ -1913,8 +1913,8 @@ TAO_POA::create_object_key (const PortableServer::ObjectId &id) #if !defined (TAO_NO_IOR_TABLE) // Add the object key prefix. ACE_OS::memcpy (&buffer[starting_at], - &objectkey_prefix[0], - TAO_OBJECTKEY_PREFIX_SIZE); + &objectkey_prefix[0], + TAO_OBJECTKEY_PREFIX_SIZE); starting_at += TAO_OBJECTKEY_PREFIX_SIZE; #endif /* TAO_NO_IOR_TABLE */ @@ -2135,7 +2135,7 @@ CORBA::WChar * TAO_POA::ObjectId_to_wstring (const PortableServer::ObjectId &id) { // Create space - CORBA::WString string = CORBA::wstring_alloc (id.length ()); + CORBA::WChar* string = CORBA::wstring_alloc (id.length ()); // Copy the data ACE_OS::memcpy (string, id.get_buffer (), id.length () * sizeof (CORBA::WChar)); diff --git a/TAO/tao/POA.h b/TAO/tao/POA.h index 5555ec743ad..5ab4c0b72ce 100644 --- a/TAO/tao/POA.h +++ b/TAO/tao/POA.h @@ -488,9 +488,9 @@ public: static void decode_string_to_sequence (TAO_Unbounded_Sequence<CORBA::Octet> &seq, const char *str); - static CORBA::String ObjectId_to_string (const PortableServer::ObjectId &id); + static char* ObjectId_to_string (const PortableServer::ObjectId &id); - static CORBA::WString ObjectId_to_wstring (const PortableServer::ObjectId &id); + static CORBA::WChar* ObjectId_to_wstring (const PortableServer::ObjectId &id); static PortableServer::ObjectId *string_to_ObjectId (const char *id); diff --git a/TAO/tao/Request.cpp b/TAO/tao/Request.cpp index db2567eb69e..519ee4c479a 100644 --- a/TAO/tao/Request.cpp +++ b/TAO/tao/Request.cpp @@ -66,7 +66,7 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, refcount_ (1) { target_ = CORBA::Object::_duplicate (obj); - opname_ = CORBA::string_copy (op); + opname_ = CORBA::string_dup (op); } CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, @@ -79,7 +79,7 @@ CORBA_Request::CORBA_Request (CORBA::Object_ptr obj, refcount_ (1) { target_ = CORBA::Object::_duplicate (obj); - opname_ = CORBA::string_copy (op); + opname_ = CORBA::string_dup (op); ACE_NEW (args_, CORBA::NVList); ACE_NEW (result_, CORBA::NamedValue); diff --git a/TAO/tao/Typecode_Constants.cpp b/TAO/tao/Typecode_Constants.cpp index 1c03d909de4..664cf642e83 100644 --- a/TAO/tao/Typecode_Constants.cpp +++ b/TAO/tao/Typecode_Constants.cpp @@ -201,7 +201,7 @@ TAO_TypeCodes::init (void) sizeof _oc_wstring, (char *) &_oc_wstring, 1, - sizeof (CORBA::WString)); + sizeof (CORBA::WChar*)); // // Various things that can be passed as "general" parameters: @@ -376,7 +376,7 @@ TAO_TypeCodes::init (void) ACE_NTOHL (0x412f4f62), ACE_NTOHL (0x6a656374), ACE_NTOHL (0x49643a31), - ACE_NTOHL (0x2e300000), // repository ID = + ACE_NTOHL (0x2e300000), // repository ID = // IDL:omg.org/CORBA/ObjectId:1.0 9, ACE_NTOHL (0x4f626a65), @@ -430,55 +430,55 @@ TAO_TypeCodes::init (void) static const CORBA::Long _oc_CORBA_ConstructionPolicy[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 41, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f436f), - ACE_NTOHL (0x6e737472), - ACE_NTOHL (0x75637469), - ACE_NTOHL (0x6f6e506f), - ACE_NTOHL (0x6c696379), - ACE_NTOHL (0x3a312e30), - ACE_NTOHL (0x0), // repository ID = + 41, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f436f), + ACE_NTOHL (0x6e737472), + ACE_NTOHL (0x75637469), + ACE_NTOHL (0x6f6e506f), + ACE_NTOHL (0x6c696379), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = // IDL:omg.org/CORBA/ConstructionPolicy:1.0 - 19, - ACE_NTOHL (0x436f6e73), - ACE_NTOHL (0x74727563), - ACE_NTOHL (0x74696f6e), - ACE_NTOHL (0x506f6c69), + 19, + ACE_NTOHL (0x436f6e73), + ACE_NTOHL (0x74727563), + ACE_NTOHL (0x74696f6e), + ACE_NTOHL (0x506f6c69), ACE_NTOHL (0x63790000), // name = ConstructionPolicy, }; - CORBA::_tc_ConstructionPolicy = - new CORBA::TypeCode (CORBA::tk_objref, - sizeof (_oc_CORBA_ConstructionPolicy), - (char *) &_oc_CORBA_ConstructionPolicy, - 0, + CORBA::_tc_ConstructionPolicy = + new CORBA::TypeCode (CORBA::tk_objref, + sizeof (_oc_CORBA_ConstructionPolicy), + (char *) &_oc_CORBA_ConstructionPolicy, + 0, sizeof (CORBA::ConstructionPolicy)); static const CORBA::Long _oc_corba_NamedValue[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 33, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x636f7262), - ACE_NTOHL (0x612f4e61), - ACE_NTOHL (0x6d656456), - ACE_NTOHL (0x616c7565), - ACE_NTOHL (0x3a312e30), - ACE_NTOHL (0x0), // repository ID = + 33, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x636f7262), + ACE_NTOHL (0x612f4e61), + ACE_NTOHL (0x6d656456), + ACE_NTOHL (0x616c7565), + ACE_NTOHL (0x3a312e30), + ACE_NTOHL (0x0), // repository ID = // IDL:omg.org/corba/NamedValue:1.0 - 11, - ACE_NTOHL (0x4e616d65), - ACE_NTOHL (0x6456616c), + 11, + ACE_NTOHL (0x4e616d65), + ACE_NTOHL (0x6456616c), ACE_NTOHL (0x75650000), // name = NamedValue, }; - CORBA::_tc_NamedValue = + CORBA::_tc_NamedValue = new CORBA::TypeCode (CORBA::tk_objref, sizeof (_oc_corba_NamedValue), (char *) &_oc_corba_NamedValue, @@ -488,42 +488,42 @@ TAO_TypeCodes::init (void) static const CORBA::Long _oc_CORBA_NameValuePair[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 28, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4e61), - ACE_NTOHL (0x6d655661), - ACE_NTOHL (0x6c756550), - ACE_NTOHL (0x6169723a), - ACE_NTOHL (0x312e3000), // repository ID = + 28, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4e61), + ACE_NTOHL (0x6d655661), + ACE_NTOHL (0x6c756550), + ACE_NTOHL (0x6169723a), + ACE_NTOHL (0x312e3000), // repository ID = // IDL:CORBA/NameValuePair:1.0 - 14, - ACE_NTOHL (0x4e616d65), - ACE_NTOHL (0x56616c75), - ACE_NTOHL (0x65506169), + 14, + ACE_NTOHL (0x4e616d65), + ACE_NTOHL (0x56616c75), + ACE_NTOHL (0x65506169), ACE_NTOHL (0x72000000), // name = NameValuePair 2, // member count - 3, + 3, ACE_NTOHL (0x69640000), // name = id CORBA::tk_alias, // typecode kind for typedefs 56, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - 24, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4669), - ACE_NTOHL (0x656c644e), - ACE_NTOHL (0x616d653a), - ACE_NTOHL (0x312e3000), // repository ID = + 24, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4669), + ACE_NTOHL (0x656c644e), + ACE_NTOHL (0x616d653a), + ACE_NTOHL (0x312e3000), // repository ID = // IDL:CORBA/FieldName:1.0 - 10, - ACE_NTOHL (0x4669656c), - ACE_NTOHL (0x644e616d), + 10, + ACE_NTOHL (0x4669656c), + ACE_NTOHL (0x644e616d), ACE_NTOHL (0x65000000), // name = FieldName - CORBA::tk_string, + CORBA::tk_string, 0, // string length - 6, - ACE_NTOHL (0x76616c75), + 6, + ACE_NTOHL (0x76616c75), ACE_NTOHL (0x65000000), // name = value CORBA::tk_any, }; @@ -538,20 +538,20 @@ TAO_TypeCodes::init (void) static const CORBA::Long _oc_CORBA_NameValuePairSeq[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 31, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4e61), - ACE_NTOHL (0x6d655661), - ACE_NTOHL (0x6c756550), - ACE_NTOHL (0x61697253), - ACE_NTOHL (0x65713a31), + 31, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4e61), + ACE_NTOHL (0x6d655661), + ACE_NTOHL (0x6c756550), + ACE_NTOHL (0x61697253), + ACE_NTOHL (0x65713a31), ACE_NTOHL (0x2e300000), // repository ID = IDL:CORBA/NameValuePairSeq:1.0 - 17, - ACE_NTOHL (0x4e616d65), - ACE_NTOHL (0x56616c75), - ACE_NTOHL (0x65506169), - ACE_NTOHL (0x72536571), + 17, + ACE_NTOHL (0x4e616d65), + ACE_NTOHL (0x56616c75), + ACE_NTOHL (0x65506169), + ACE_NTOHL (0x72536571), ACE_NTOHL (0x0), // name = NameValuePairSeq CORBA::tk_sequence, // typecode kind 164, // encapsulation length @@ -559,93 +559,93 @@ TAO_TypeCodes::init (void) CORBA::tk_struct, // typecode kind 148, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - 28, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4e61), - ACE_NTOHL (0x6d655661), - ACE_NTOHL (0x6c756550), - ACE_NTOHL (0x6169723a), + 28, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4e61), + ACE_NTOHL (0x6d655661), + ACE_NTOHL (0x6c756550), + ACE_NTOHL (0x6169723a), ACE_NTOHL (0x312e3000), // repository ID = IDL:CORBA/NameValuePair:1.0 - 14, - ACE_NTOHL (0x4e616d65), - ACE_NTOHL (0x56616c75), - ACE_NTOHL (0x65506169), + 14, + ACE_NTOHL (0x4e616d65), + ACE_NTOHL (0x56616c75), + ACE_NTOHL (0x65506169), ACE_NTOHL (0x72000000), // name = NameValuePair 2, // member count - 3, + 3, ACE_NTOHL (0x69640000), // name = id CORBA::tk_alias, // typecode kind for typedefs 56, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - 24, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4669), - ACE_NTOHL (0x656c644e), - ACE_NTOHL (0x616d653a), + 24, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4669), + ACE_NTOHL (0x656c644e), + ACE_NTOHL (0x616d653a), ACE_NTOHL (0x312e3000), // repository ID = IDL:CORBA/FieldName:1.0 - 10, - ACE_NTOHL (0x4669656c), - ACE_NTOHL (0x644e616d), + 10, + ACE_NTOHL (0x4669656c), + ACE_NTOHL (0x644e616d), ACE_NTOHL (0x65000000), // name = FieldName - CORBA::tk_string, + CORBA::tk_string, 0, // string length - 6, - ACE_NTOHL (0x76616c75), + 6, + ACE_NTOHL (0x76616c75), ACE_NTOHL (0x65000000), // name = value CORBA::tk_any, 0, }; CORBA::_tc_NameValuePairSeq = - new CORBA::TypeCode (CORBA::tk_alias, - sizeof (_oc_CORBA_NameValuePairSeq), - (char *) &_oc_CORBA_NameValuePairSeq, - 0, + new CORBA::TypeCode (CORBA::tk_alias, + sizeof (_oc_CORBA_NameValuePairSeq), + (char *) &_oc_CORBA_NameValuePairSeq, + 0, sizeof (CORBA::NameValuePairSeq)); static const CORBA::Long _oc_CORBA_WrongTransaction[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 39, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f5772), - ACE_NTOHL (0x6f6e6754), - ACE_NTOHL (0x72616e73), - ACE_NTOHL (0x61637469), - ACE_NTOHL (0x6f6e3a31), - ACE_NTOHL (0x2e300000), // repository ID = + 39, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f5772), + ACE_NTOHL (0x6f6e6754), + ACE_NTOHL (0x72616e73), + ACE_NTOHL (0x61637469), + ACE_NTOHL (0x6f6e3a31), + ACE_NTOHL (0x2e300000), // repository ID = // IDL:omg.org/CORBA/WrongTransaction:1.0 - 17, - ACE_NTOHL (0x57726f6e), - ACE_NTOHL (0x67547261), - ACE_NTOHL (0x6e736163), - ACE_NTOHL (0x74696f6e), + 17, + ACE_NTOHL (0x57726f6e), + ACE_NTOHL (0x67547261), + ACE_NTOHL (0x6e736163), + ACE_NTOHL (0x74696f6e), ACE_NTOHL (0x0), // name = WrongTransaction 0, // member count }; CORBA::_tc_WrongTransaction = - new CORBA::TypeCode (CORBA::tk_except, - sizeof (_oc_CORBA_WrongTransaction), - (char *) &_oc_CORBA_WrongTransaction, - 0, + new CORBA::TypeCode (CORBA::tk_except, + sizeof (_oc_CORBA_WrongTransaction), + (char *) &_oc_CORBA_WrongTransaction, + 0, sizeof (CORBA::WrongTransaction)); static const CORBA::Long _oc_CORBA_AnySeq[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 21, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f416e), - ACE_NTOHL (0x79536571), - ACE_NTOHL (0x3a312e30), + 21, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f416e), + ACE_NTOHL (0x79536571), + ACE_NTOHL (0x3a312e30), ACE_NTOHL (0x0), // repository ID = IDL:CORBA/AnySeq:1.0 - 7, - ACE_NTOHL (0x416e7953), + 7, + ACE_NTOHL (0x416e7953), ACE_NTOHL (0x65710000), // name = AnySeq CORBA::tk_sequence, // typecode kind 12, // encapsulation length @@ -664,18 +664,18 @@ TAO_TypeCodes::init (void) static const CORBA::Long _oc_CORBA_FieldName[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 24, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f4669), - ACE_NTOHL (0x656c644e), - ACE_NTOHL (0x616d653a), + 24, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f4669), + ACE_NTOHL (0x656c644e), + ACE_NTOHL (0x616d653a), ACE_NTOHL (0x312e3000), // repository ID = IDL:CORBA/FieldName:1.0 - 10, - ACE_NTOHL (0x4669656c), - ACE_NTOHL (0x644e616d), + 10, + ACE_NTOHL (0x4669656c), + ACE_NTOHL (0x644e616d), ACE_NTOHL (0x65000000), // name = FieldName - CORBA::tk_string, + CORBA::tk_string, 0, // string length }; CORBA::_tc_FieldName = @@ -700,7 +700,7 @@ TAO_TypeCodes::init (void) ACE_NTOHL (0x72766963), ACE_NTOHL (0x654f7074), ACE_NTOHL (0x696f6e3a), - ACE_NTOHL (0x312e3000), // repository ID = + ACE_NTOHL (0x312e3000), // repository ID = // IDL:omg.org/CORBA/ServiceOption:1.0 14, ACE_NTOHL (0x53657276), @@ -961,7 +961,7 @@ TAO_TypeCodes::init (void) sizeof (_oc_CORBA_ServiceInformation), (char *) &_oc_CORBA_ServiceInformation, 0, - sizeof (CORBA::ServiceInformation)); + sizeof (CORBA::ServiceInformation)); // **************************************************************** @@ -1324,51 +1324,51 @@ TAO_TypeCodes::init (void) static const CORBA::Long _oc_CORBA_DomainManager[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 36, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f446f), - ACE_NTOHL (0x6d61696e), - ACE_NTOHL (0x4d616e61), - ACE_NTOHL (0x6765723a), - ACE_NTOHL (0x312e3000), // repository ID = + 36, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f446f), + ACE_NTOHL (0x6d61696e), + ACE_NTOHL (0x4d616e61), + ACE_NTOHL (0x6765723a), + ACE_NTOHL (0x312e3000), // repository ID = //IDL:omg.org/CORBA/DomainManager:1.0 - 14, - ACE_NTOHL (0x446f6d61), - - ACE_NTOHL (0x696e4d61), - ACE_NTOHL (0x6e616765), + 14, + ACE_NTOHL (0x446f6d61), + + ACE_NTOHL (0x696e4d61), + ACE_NTOHL (0x6e616765), ACE_NTOHL (0x72000000), // name = DomainManager, }; - CORBA::_tc_DomainManager = + CORBA::_tc_DomainManager = new CORBA::TypeCode (CORBA::tk_objref, - sizeof (_oc_CORBA_DomainManager), - (char *) &_oc_CORBA_DomainManager, - 0, + sizeof (_oc_CORBA_DomainManager), + (char *) &_oc_CORBA_DomainManager, + 0, sizeof (CORBA_DomainManager)); static const CORBA::Long _oc_CORBA_DomainManagerList[] = { TAO_ENCAP_BYTE_ORDER, // byte order - 40, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f446f), - ACE_NTOHL (0x6d61696e), - ACE_NTOHL (0x4d616e61), - ACE_NTOHL (0x6765724c), - ACE_NTOHL (0x6973743a), - ACE_NTOHL (0x312e3000), // repository ID = + 40, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f446f), + ACE_NTOHL (0x6d61696e), + ACE_NTOHL (0x4d616e61), + ACE_NTOHL (0x6765724c), + ACE_NTOHL (0x6973743a), + ACE_NTOHL (0x312e3000), // repository ID = //IDL:omg.org/CORBA/DomainManagerList:1.0 - 18, - ACE_NTOHL (0x446f6d61), - ACE_NTOHL (0x696e4d61), - ACE_NTOHL (0x6e616765), - ACE_NTOHL (0x724c6973), + 18, + ACE_NTOHL (0x446f6d61), + ACE_NTOHL (0x696e4d61), + ACE_NTOHL (0x6e616765), + ACE_NTOHL (0x724c6973), ACE_NTOHL (0x74000000), // name = DomainManagerList CORBA::tk_sequence, // typecode kind 80, // encapsulation length @@ -1376,29 +1376,29 @@ TAO_TypeCodes::init (void) CORBA::tk_objref, // typecode kind 64, // encapsulation length TAO_ENCAP_BYTE_ORDER, // byte order - 36, - ACE_NTOHL (0x49444c3a), - ACE_NTOHL (0x6f6d672e), - ACE_NTOHL (0x6f72672f), - ACE_NTOHL (0x434f5242), - ACE_NTOHL (0x412f446f), - ACE_NTOHL (0x6d61696e), - ACE_NTOHL (0x4d616e61), - ACE_NTOHL (0x6765723a), - ACE_NTOHL (0x312e3000), // repository ID = + 36, + ACE_NTOHL (0x49444c3a), + ACE_NTOHL (0x6f6d672e), + ACE_NTOHL (0x6f72672f), + ACE_NTOHL (0x434f5242), + ACE_NTOHL (0x412f446f), + ACE_NTOHL (0x6d61696e), + ACE_NTOHL (0x4d616e61), + ACE_NTOHL (0x6765723a), + ACE_NTOHL (0x312e3000), // repository ID = //IDL:omg.org/CORBA/DomainManager:1.0 - 14, - ACE_NTOHL (0x446f6d61), - ACE_NTOHL (0x696e4d61), - ACE_NTOHL (0x6e616765), + 14, + ACE_NTOHL (0x446f6d61), + ACE_NTOHL (0x696e4d61), + ACE_NTOHL (0x6e616765), ACE_NTOHL (0x72000000), // name = DomainManager, 0, }; - CORBA::_tc_DomainManagerList = - new CORBA::TypeCode (CORBA::tk_alias, - sizeof (_oc_CORBA_DomainManagerList), - (char *) &_oc_CORBA_DomainManagerList, - 0, + CORBA::_tc_DomainManagerList = + new CORBA::TypeCode (CORBA::tk_alias, + sizeof (_oc_CORBA_DomainManagerList), + (char *) &_oc_CORBA_DomainManagerList, + 0, sizeof (CORBA_DomainManagerList)); // **************************************************************** diff --git a/TAO/tao/corbafwd.h b/TAO/tao/corbafwd.h index 7e3adcbc16d..cad767c234f 100644 --- a/TAO/tao/corbafwd.h +++ b/TAO/tao/corbafwd.h @@ -258,6 +258,8 @@ class CORBA_DefaultValueRefCountBase; class CORBA_String_var; class CORBA_String_out; +class CORBA_WString_var; +class CORBA_WString_out; class CORBA_ExceptionList; @@ -336,9 +338,6 @@ typedef void (*TAO_Skeleton)( template <class T> class TAO_Unbounded_Sequence; template <class T> class TAO_Unbounded_Object_Sequence; -class CORBA_String_var; -class CORBA_String_out; - class TAO_Export CORBA { // = TITLE @@ -390,31 +389,31 @@ public: typedef Char *String; // = String memory management. - static String string_alloc (ULong len); - static String string_copy (const Char *); - static String string_dup (const Char *); + static Char* string_alloc (ULong len); + static Char* string_dup (const Char *); static void string_free (Char *); - - typedef TAO_Unbounded_Sequence<Octet> OctetSeq; + // This is a TAO extension and must go away.... + static Char* string_copy (const Char *); typedef CORBA_String_var String_var; typedef CORBA_String_out String_out; - // WChar is an IDL extension, not yet standard. We use 32 bits - // because that's what many platforms use for their native wchar_t. + // WChar was standarized in CORBA 2.2, but is still a bit unstable. typedef ACE_CDR::WChar WChar; - typedef WChar *WString; - typedef WChar &WChar_out; // Out type for WChar. // = String memory management routines. - static WString wstring_alloc (ULong len); - static WString wstring_copy (const WChar *const); - static WString wstring_dup (const WChar *const); + static WChar* wstring_alloc (ULong len); + static WChar* wstring_dup (const WChar *const); static void wstring_free (WChar *const); + typedef CORBA_WString_var WString_var; + typedef CORBA_WString_out WString_out; + + typedef TAO_Unbounded_Sequence<Octet> OctetSeq; + // = various CORBA defined classes. typedef CORBA_Any Any; typedef CORBA_Any_var Any_var; @@ -442,7 +441,7 @@ public: typedef NamedValue *NamedValue_ptr; typedef CORBA_NamedValue_var NamedValue_var; typedef CORBA_NamedValue_out NamedValue_out; - + typedef CORBA_NVList NVList; typedef NVList *NVList_ptr; typedef CORBA_NVList_var NVList_var; diff --git a/TAO/tao/corbafwd.i b/TAO/tao/corbafwd.i index b9e4789de9c..766b0ee6a30 100644 --- a/TAO/tao/corbafwd.i +++ b/TAO/tao/corbafwd.i @@ -16,16 +16,41 @@ CORBA::string_free (CORBA::Char *str) ACE_INLINE TAO_Export CORBA::String CORBA::string_dup (const CORBA::Char *str) { - return CORBA::string_copy (str); + if (!str) + return 0; + + size_t len = ACE_OS::strlen (str); + + // This allocates an extra byte for the '\0'; + CORBA::String copy = CORBA::string_alloc (len); + + ACE_OS::memcpy (copy, str, len + 1); + return copy; } // ---------------------------------------------------------------------- // Wide strings // ---------------------------------------------------------------------- -ACE_INLINE TAO_Export CORBA::WString +ACE_INLINE TAO_Export CORBA::WChar* +CORBA::wstring_alloc (CORBA::ULong len) +{ + return new CORBA::WChar [(size_t) (len + 1)]; +} + +ACE_INLINE TAO_Export void +CORBA::wstring_free (CORBA::WChar *const str) +{ + delete [] str; +} + +ACE_INLINE TAO_Export CORBA::WChar* CORBA::wstring_dup (const WChar *const str) { - return CORBA::wstring_copy (str); + if (!str) + return 0; + + CORBA::WChar* retval = CORBA::wstring_alloc (ACE_OS::wslen (str)); + return ACE_OS::wscpy (retval, str); } diff --git a/TAO/tests/Param_Test/options.cpp b/TAO/tests/Param_Test/options.cpp index 021832240ff..dc0f482d69f 100644 --- a/TAO/tests/Param_Test/options.cpp +++ b/TAO/tests/Param_Test/options.cpp @@ -78,7 +78,7 @@ Options::parse_args (int argc, char **argv) case 'k': CORBA::string_free (this->ior_); - this->ior_ = CORBA::string_copy (get_opts.optarg); + this->ior_ = CORBA::string_dup (get_opts.optarg); break; case 'i': // invocation |