diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-10-18 07:10:00 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2005-10-18 07:10:00 +0000 |
commit | e5038b565d810c160831d2755893427cb6d1c6b4 (patch) | |
tree | 2ce52b0a6901d8a7c561c664995c02ff50723be3 /TAO | |
parent | 3028c2dfc0af7ef64b344ed65d5b2889a450d965 (diff) | |
download | ATCD-e5038b565d810c160831d2755893427cb6d1c6b4.tar.gz |
ChangeLogTag:Tue Oct 18 00:08:30 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 51 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/Union_TypeCode.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp | 8 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 119 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 8 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 39 | ||||
-rw-r--r-- | TAO/tao/SystemException.cpp | 21 | ||||
-rw-r--r-- | TAO/tao/SystemException.inl | 23 | ||||
-rw-r--r-- | TAO/tao/objectid.h | 15 | ||||
-rw-r--r-- | TAO/tao/params.h | 4 | ||||
-rw-r--r-- | TAO/tao/params.i | 4 |
11 files changed, 163 insertions, 137 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index e3ad182b307..9fe6f09e219 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,54 @@ +Tue Oct 18 00:08:30 2005 Ossama Othman <ossama@dre.vanderbilt.edu> + + * tao/SystemException.cpp: + * tao/SystemException.inl: + + Moved concrete SystemException constructors out of line again. + The intended footprint decreases were unfortunately not seen + across all platforms. + + * tao/ORB.h (resolve_service): + + Removed unnecessary return type and emulated exception + parameter. + + * tao/ORB.cpp (resolve_service): + + Use snprintf() to simplify integer to-tring conversion and + string concatenation. Thanks to Jiang Wei <jw dot tao at sduept + dot com> for providing a patch. + + Optimized to only determine multicast port if multicast default + initial reference is enabled. + + Removed unused "return_value" variable. + + (resolve_initial_references): + + Updated to calls to resolve_service() to reflect new signature + and void return type. + + * tao/ORB_Core.cpp (init): + + Simplified code that sets Name Service default initial + reference. + + Updated names of multicast-capable service IDs to match the new + names in tao/objectid.h. + + * tao/objectid.h (TAO_MCAST_SERVICEID): + + Addressed global namespace pollution by placing this enumeration + within the TAO namespace. Also prepended each service ID + enumerator with "MCAST_" to further reduce potential internal + TAO namespace pollution. + + * tao/params.h: + * tao/params.i: + + TAO_MCAST_SERVICEID is now TAO::MCAST_SERVICEID, as changed in + tao/objectid.h. + Tue Oct 18 06:45:12 UTC 2005 Johnny Willemsen <jwillemsen@remedy.nl> * tao/DynamicInterface/DII_Invocation.h: diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode.cpp b/TAO/tao/AnyTypeCode/Union_TypeCode.cpp index ad3a104db41..c88e8ec1236 100644 --- a/TAO/tao/AnyTypeCode/Union_TypeCode.cpp +++ b/TAO/tao/AnyTypeCode/Union_TypeCode.cpp @@ -36,6 +36,14 @@ TAO::TypeCode::Union<StringType, // Create a CDR encapsulation. TAO_OutputCDR enc; + // Account for the encoded CDR encapsulation length and byte order. + // + // Aligning on an octet since the next value after the CDR + // encapsulation length will always be the byte order octet/boolean + // in this case. + offset = ACE_align_binary (offset + 4, + ACE_CDR::OCTET_ALIGN); + bool const success = (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0)) diff --git a/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp index 61b03381d19..714b16cfa96 100644 --- a/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp +++ b/TAO/tao/AnyTypeCode/Union_TypeCode_Static.cpp @@ -35,6 +35,14 @@ TAO::TypeCode::Union<char const *, // Create a CDR encapsulation. TAO_OutputCDR enc; + // Account for the encoded CDR encapsulation length and byte order. + // + // Aligning on an octet since the next value after the CDR + // encapsulation length will always be the byte order octet/boolean + // in this case. + offset = ACE_align_binary (offset + 4, + ACE_CDR::OCTET_ALIGN); + bool const success = (enc << TAO_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER)) && (enc << TAO_OutputCDR::from_string (this->base_attributes_.id (), 0)) diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 3f0e4187af0..2e953836040 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -978,11 +978,10 @@ CORBA::ORB::resolve_policy_current (void) #endif /* TAO_HAS_CORBA_MESSAGING == 1 */ } -CORBA::Object_ptr -CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id - ACE_ENV_ARG_DECL_NOT_USED) +void +CORBA::ORB::resolve_service (TAO::MCAST_SERVICEID mcast_service_id) { - static const char * env_service_port[] = + static char const * const env_service_port[] = { "NameServicePort", "TradingServicePort", @@ -990,7 +989,7 @@ CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id "InterfaceRepoServicePort" }; - static const unsigned short default_service_port[] = + static unsigned short const default_service_port[] = { TAO_DEFAULT_NAME_SERVER_REQUEST_PORT, TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT, @@ -998,66 +997,52 @@ CORBA::ORB::resolve_service (TAO_MCAST_SERVICEID mcast_service_id TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT }; - CORBA::Object_var return_value; - // By now, the table filled in with -ORBInitRef arguments has been // checked. We only get here if the table didn't contain an initial // reference for the requested Service. - // First, determine if the port was supplied on the command line - unsigned short port = - this->orb_core_->orb_params ()->service_port (mcast_service_id); - - if (port == 0) - { - // Look for the port among our environment variables. - const char *port_number = - ACE_OS::getenv (env_service_port[mcast_service_id]); - - if (port_number != 0) - port = static_cast<unsigned short> (ACE_OS::atoi (port_number)); - else - port = default_service_port[mcast_service_id]; - } - - // Set the port value in ORB_Params: modify the default mcast - // value. - static const char prefix[] = "mcast://:"; - - char port_char[256]; + CORBA::String_var default_init_ref = + this->orb_core_->orb_params ()->default_init_ref (); - ACE_OS::itoa (port, - port_char, - 10); + static char const mcast_prefix[] = "mcast://:::"; - CORBA::String_var port_ptr = - CORBA::string_alloc (static_cast<CORBA::ULong> ( - ACE_OS::strlen ((const char *) port_char))); + if ((ACE_OS::strncmp (default_init_ref.in (), + mcast_prefix, + sizeof (mcast_prefix) - 1) == 0)) + { + // First, determine if the port was supplied on the command line + unsigned short port = + this->orb_core_->orb_params ()->service_port (mcast_service_id); - port_ptr = (const char *) port_char; + if (port == 0) + { + // Look for the port among our environment variables. + char const * const port_number = + ACE_OS::getenv (env_service_port[mcast_service_id]); - CORBA::String_var def_init_ref = - CORBA::string_alloc (sizeof (prefix) + - static_cast<CORBA::ULong> ( - ACE_OS::strlen (port_ptr.in ())) + 2); + if (port_number != 0) + port = static_cast<unsigned short> (ACE_OS::atoi (port_number)); + else + port = default_service_port[mcast_service_id]; + } - ACE_OS::strcpy (def_init_ref.inout (), prefix); - ACE_OS::strcat (def_init_ref.inout (), port_ptr.in ()); - ACE_OS::strcat (def_init_ref.inout (), "::"); + // Set the port value in ORB_Params: modify the default mcast + // value. + static char const mcast_fmt[] = "mcast://:%d::"; + static size_t const PORT_BUF_SIZE = 256; - CORBA::String_var default_init_ref = - this->orb_core_->orb_params ()->default_init_ref (); + char def_init_ref[PORT_BUF_SIZE] = { 0 }; // snprintf() doesn't + // null terminate. + // Make sure we do. - static const char mcast_prefix[] = "mcast://:::"; + ACE_OS::snprintf (def_init_ref, + PORT_BUF_SIZE - 1, // Account for null + // terminator. + mcast_fmt, + port); - if ((ACE_OS::strncmp (default_init_ref.in (), - mcast_prefix, - sizeof mcast_prefix - 1) == 0)) - { - this->orb_core_->orb_params ()->default_init_ref (def_init_ref.in ()); - } - - return CORBA::Object::_nil (); + this->orb_core_->orb_params ()->default_init_ref (def_init_ref); + } } CORBA::Object_ptr @@ -1193,39 +1178,19 @@ CORBA::ORB::resolve_initial_references (const char *name, if (ACE_OS::strcmp (name, TAO_OBJID_NAMESERVICE) == 0) { - result = this->resolve_service (NAMESERVICE - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - if (!CORBA::is_nil (result.in ())) - return result._retn (); + this->resolve_service (TAO::MCAST_NAMESERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_TRADINGSERVICE) == 0) { - result = this->resolve_service (TRADINGSERVICE - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - if (!CORBA::is_nil (result.in ())) - return result._retn (); + this->resolve_service (TAO::MCAST_TRADINGSERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_IMPLREPOSERVICE) == 0) { - result = this->resolve_service (IMPLREPOSERVICE - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - if (!CORBA::is_nil (result.in ())) - return result._retn (); + this->resolve_service (TAO::MCAST_IMPLREPOSERVICE); } else if (ACE_OS::strcmp (name, TAO_OBJID_INTERFACEREP) == 0) { - result = this->resolve_service (INTERFACEREPOSERVICE - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - if (!CORBA::is_nil (result.in ())) - return result._retn (); + this->resolve_service (TAO::MCAST_INTERFACEREPOSERVICE); } // Is not one of the well known services, try to find it in the diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index 5fd16d537a9..cecd70319ed 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -613,8 +613,12 @@ namespace CORBA private: /// Resolve the given service based on the service ID. - CORBA::Object_ptr resolve_service (TAO_MCAST_SERVICEID service_id - ACE_ENV_ARG_DECL); + /** + * "@c resolve_service" is a legacy name. This method now simply + * sets up a default initial reference that will be subsequently + * used in resolve_initial_references(). + */ + void resolve_service (TAO::MCAST_SERVICEID service_id); /// Convert an OMG IOR into an object reference. CORBA::Object_ptr ior_string_to_object (const char* ior diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index e04f844c247..33d0a88ee8c 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1097,39 +1097,28 @@ TAO_ORB_Core::init (int &argc, char *argv[] ACE_ENV_ARG_DECL) // deferred until after the service config entries had been // determined. - this->orb_params ()->service_port (NAMESERVICE, ns_port); + this->orb_params ()->service_port (TAO::MCAST_NAMESERVICE, ns_port); if (ns_port != 0) { - char ns_port_char[256]; + static char const mcast_fmt[] = "mcast://:%d::"; + static size_t const PORT_BUF_SIZE = 256; - ACE_OS::itoa (ns_port, - ns_port_char, - 10); + char def_init_ref[PORT_BUF_SIZE] = { 0 }; // snprintf() doesn't + // null terminate. + // Make sure we do. - CORBA::String_var ns_port_ptr = - CORBA::string_alloc (static_cast<CORBA::ULong> ( - ACE_OS::strlen ((const char *) ns_port_char))); + ACE_OS::snprintf (def_init_ref, + PORT_BUF_SIZE - 1, // Account for null + // terminator. + mcast_fmt, + ns_port); - ns_port_ptr = (const char *) ns_port_char; - - const char prefix[] = "mcast://:"; - - CORBA::String_var def_init_ref = - CORBA::string_alloc (sizeof (prefix) + - static_cast<CORBA::ULong> ( - ACE_OS::strlen (ns_port_ptr.in ())) + - 2); - - ACE_OS::strcpy (def_init_ref.inout (), prefix); - ACE_OS::strcat (def_init_ref.inout (), ns_port_ptr.in ()); - ACE_OS::strcat (def_init_ref.inout (), "::"); - - this->orb_params ()->default_init_ref (def_init_ref.in ()); + this->orb_core_->orb_params ()->default_init_ref (def_init_ref); } - this->orb_params ()->service_port (TRADINGSERVICE, ts_port); - this->orb_params ()->service_port (IMPLREPOSERVICE, ir_port); + this->orb_params ()->service_port (TAO::MCAST_TRADINGSERVICE, ts_port); + this->orb_params ()->service_port (TAO::MCAST_IMPLREPOSERVICE, ir_port); this->orb_params ()->use_dotted_decimal_addresses (dotted_decimal_addresses); // When caching incoming transports don't use the host name if diff --git a/TAO/tao/SystemException.cpp b/TAO/tao/SystemException.cpp index 49290d033cb..b0089ead714 100644 --- a/TAO/tao/SystemException.cpp +++ b/TAO/tao/SystemException.cpp @@ -886,6 +886,27 @@ TAO::excp_factory excp_array [] = { 0 }; +// Concrete SystemException constructors +#define TAO_SYSTEM_EXCEPTION(name) \ +CORBA::name ::name (void) \ + : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ + #name, \ + 0, \ + CORBA::COMPLETED_NO) \ +{ \ +} \ +\ +CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \ + : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ + #name, \ + code, \ + completed) \ +{ \ +} + +STANDARD_EXCEPTION_LIST +#undef TAO_SYSTEM_EXCEPTION + #define TAO_SYSTEM_EXCEPTION(name) \ CORBA::TypeCode_ptr \ CORBA::name ::_tao_type (void) const \ diff --git a/TAO/tao/SystemException.inl b/TAO/tao/SystemException.inl index 36d2fc78d44..9366410df75 100644 --- a/TAO/tao/SystemException.inl +++ b/TAO/tao/SystemException.inl @@ -81,29 +81,6 @@ CORBA::SystemException::_downcast (const CORBA::Exception *exception) TAO_SYSTEM_EXCEPTION (ACTIVITY_REQUIRED) \ TAO_SYSTEM_EXCEPTION (THREAD_CANCELLED) -// Concrete SystemException constructors -#define TAO_SYSTEM_EXCEPTION(name) \ -ACE_INLINE \ -CORBA::name ::name (void) \ - : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ - #name, \ - 0, \ - CORBA::COMPLETED_NO) \ -{ \ -} \ -\ -ACE_INLINE \ -CORBA::name ::name (CORBA::ULong code, CORBA::CompletionStatus completed) \ - : CORBA::SystemException ("IDL:omg.org/CORBA/" #name ":1.0", \ - #name, \ - code, \ - completed) \ -{ \ -} - -TAO_STANDARD_SYSTEM_EXCEPTION_LIST -#undef TAO_SYSTEM_EXCEPTION - #define TAO_SYSTEM_EXCEPTION(name) \ ACE_INLINE CORBA::name * \ CORBA::name ::_downcast (CORBA::Exception* exception) \ diff --git a/TAO/tao/objectid.h b/TAO/tao/objectid.h index cc90329aa2a..f1be2f0615e 100644 --- a/TAO/tao/objectid.h +++ b/TAO/tao/objectid.h @@ -89,13 +89,16 @@ // dynamically. /// Service IDs for the services that are located through Multicast. -enum TAO_MCAST_SERVICEID +namespace TAO { - NAMESERVICE, - TRADINGSERVICE, - IMPLREPOSERVICE, - INTERFACEREPOSERVICE -}; + enum MCAST_SERVICEID + { + MCAST_NAMESERVICE, + MCAST_TRADINGSERVICE, + MCAST_IMPLREPOSERVICE, + MCAST_INTERFACEREPOSERVICE + }; +} /// No. of services locatable through multicast. #define TAO_NO_OF_MCAST_SERVICES 4 diff --git a/TAO/tao/params.h b/TAO/tao/params.h index a0663ecde77..ef7593e3ab3 100644 --- a/TAO/tao/params.h +++ b/TAO/tao/params.h @@ -64,8 +64,8 @@ public: TAO_EndpointSet &endpoint_set); /// Set/Get the port of services locatable through multicast. - CORBA::UShort service_port (TAO_MCAST_SERVICEID service_id) const; - void service_port (TAO_MCAST_SERVICEID service_id, CORBA::UShort port); + CORBA::UShort service_port (TAO::MCAST_SERVICEID service_id) const; + void service_port (TAO::MCAST_SERVICEID service_id, CORBA::UShort port); /// Get/Set address:port for Multicast Discovery Protocol for /// the Naming Service. diff --git a/TAO/tao/params.i b/TAO/tao/params.i index a7a6a424d65..92a8a9e936a 100644 --- a/TAO/tao/params.i +++ b/TAO/tao/params.i @@ -76,14 +76,14 @@ TAO_ORB_Parameters::linger (int x) ACE_INLINE void -TAO_ORB_Parameters::service_port (TAO_MCAST_SERVICEID service_id, +TAO_ORB_Parameters::service_port (TAO::MCAST_SERVICEID service_id, CORBA::UShort port) { this->service_port_[service_id] = port; } ACE_INLINE CORBA::UShort -TAO_ORB_Parameters::service_port (TAO_MCAST_SERVICEID service_id) const +TAO_ORB_Parameters::service_port (TAO::MCAST_SERVICEID service_id) const { return this->service_port_[service_id]; } |