diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-10-28 15:10:59 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 2003-10-28 15:10:59 +0000 |
commit | e07a1718c970265bdd3759a7601a8876976292b7 (patch) | |
tree | b27b5a9ff967bac39ba1d66f61f2bc2d61302009 /TAO | |
parent | 05c00a513c19251914af6f56a761aafd4c6a338e (diff) | |
download | ATCD-e07a1718c970265bdd3759a7601a8876976292b7.tar.gz |
ChangeLogTag:Tue Oct 28 07:05:46 2003 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 92 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp | 7 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h | 9 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.cpp | 18 | ||||
-rw-r--r-- | TAO/tao/IIOP_Profile.h | 4 | ||||
-rw-r--r-- | TAO/tao/Profile.cpp | 39 | ||||
-rw-r--r-- | TAO/tao/Profile.h | 47 | ||||
-rw-r--r-- | TAO/tao/Strategies/DIOP_Profile.cpp | 18 | ||||
-rw-r--r-- | TAO/tao/Strategies/DIOP_Profile.h | 4 | ||||
-rw-r--r-- | TAO/tao/Strategies/SCIOP_Profile.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/Strategies/SCIOP_Profile.h | 11 | ||||
-rw-r--r-- | TAO/tao/Strategies/SHMIOP_Profile.cpp | 18 | ||||
-rw-r--r-- | TAO/tao/Strategies/SHMIOP_Profile.h | 5 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Profile.cpp | 17 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Profile.h | 7 |
17 files changed, 206 insertions, 124 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index e6efa6e9f3c..cff8db5ccd3 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,95 @@ +Tue Oct 28 07:05:46 2003 Ossama Othman <ossama@dre.vanderbilt.edu> + + The following changes are designed to make profile equivalance + checking code consistent between all pluggable protocol + implementations. + + * tao/Profile.h (is_equivalent): + + This method is no longer virtual since it relies on template + methods implemented by subclasses to perform pluggable + protocol-specific profile equivalence check processing. + + (do_is_equivalent): + + New protected template method that subclasses must implement in + order to allow pluggable protocols to apply their own definition + of profile equivalance. + + (endpoint_count): + + Made this method const to address "discards const qualifier" + errors. This is now necessary since some equivalence checking + code that calls this method has been refactored to the + is_equivalence() method. + + * tao/Profile.cpp (is_equivalent): + + Check for a zero pointer to avoid potential a seg fault. + + Invoke the new do_is_equivalent() template method and the new + is_equivalent_hook() hook method. + + (is_profile_equivalent_i, is_equivalent_hook): + + Renamed is_profile_equivalent_i() method to is_equivalent_hook() + to better reflect the purpose of this method. Note that + is_equivalent_hook() is virtual to allow subclasses to override + the default behavior. + + (is_equivalent_hook): + + The TAO_Unknown_Profile::is_equivalent() method does not need to + allow some services (e.g. FT) to apply their own definition of + profile equivalence. Override this method so that it always + return true. Note that this behavior is consistent with the + behavior that existed prior to these changes. + + * tao/IIOP_Profile.h (endpoint_count): + + Now a "const" method to address "discards const qualifier" + errors. + + (is_equivalent, do_is_equivalent): + + Renamed this public method to the new protected + do_is_equivalent() template method. + + * tao/IIOP_Profile.cpp (is_equivalent): + + Refactored common profile equivalence checking code to the + TAO_Profile base class. + + (do_is_equivalent): + + Moved protocol-specific profile equivalence checks to this + template method. + + (endpoint_count): + + Now a "const" method to address "discards const qualifier" + errors. + + * tao/Strategies/DIOP_Profile.h: + * tao/Strategies/DIOP_Profile.cpp: + * tao/Strategies/SCIOP_Profile.h: + * tao/Strategies/SCIOP_Profile.cpp: + * tao/Strategies/SHMIOP_Profile.h: + * tao/Strategies/SHMIOP_Profile.cpp: + * tao/Strategies/UIOP_Profile.h: + * tao/Strategies/UIOP_Profile.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp: + + Likewise. + + * orbsvcs/tests/Security/Secure_Invocation/server.cpp: + + Added a sanity check for properly functioning SSLIOP profile + equivalence checks. + Sat Oct 25 13:19:12 UTC 2003 Johnny Willemsen <jwillemsen@remedy.nl> * TAOACE.dsw: Added that EventService is dependent of BiDIR GIOP diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp index 27c6c125e76..58fd1774e9d 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.cpp @@ -353,20 +353,15 @@ TAO_UIPMC_Profile::parse_string_i (const char *string } CORBA::Boolean -TAO_UIPMC_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_UIPMC_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != TAO_TAG_UIPMC_PROFILE) - return 0; - const TAO_UIPMC_Profile *op = ACE_dynamic_cast (const TAO_UIPMC_Profile *, other_profile); - if (!(this->version_ == op->version_ - && this->endpoint_.is_equivalent (&op->endpoint_))) + if (op == 0) return 0; - return 1; + return this->endpoint_.is_equivalent (&op->endpoint_); } CORBA::ULong @@ -395,7 +390,7 @@ TAO_UIPMC_Profile::encode_endpoints (void) } CORBA::ULong -TAO_UIPMC_Profile::endpoint_count (void) +TAO_UIPMC_Profile::endpoint_count (void) const { return 1; } diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h index 35d8ad19994..8ebd25affb0 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Profile.h @@ -83,8 +83,7 @@ public: virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL_WITH_DEFAULTS); virtual IOP::TaggedProfile &create_tagged_profile (void); @@ -111,6 +110,7 @@ protected: virtual void parse_string_i (const char * ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); virtual void update_cached_group_component (void); protected: diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp index 7136286eafc..c924fbbb44d 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.cpp @@ -170,13 +170,16 @@ TAO_SSLIOP_Profile::decode (TAO_InputCDR & cdr) } CORBA::Boolean -TAO_SSLIOP_Profile::is_equivalent (const TAO_Profile * other_profile) +TAO_SSLIOP_Profile::do_is_equivalent (const TAO_Profile * other_profile) { const TAO_SSLIOP_Profile *op = ACE_dynamic_cast (const TAO_SSLIOP_Profile *, other_profile); + // Make sure we have a TAO_SSLIOP_Profile. + if (op == 0) + return 0; - // Check endpoints equivalence. + // Now verify TAO_SSLIOP_Endpoint equivalence. const TAO_SSLIOP_Endpoint *other_endp = &op->ssl_endpoint_; for (TAO_SSLIOP_Endpoint *endp = &this->ssl_endpoint_; endp != 0; diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h index 5bb8fc5e0c0..b83036b7a0c 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Profile.h @@ -74,7 +74,6 @@ public: // = Please see Profile.h for the documentation of these methods. virtual int decode (TAO_InputCDR& cdr); virtual int encode_endpoints (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile * other_profile); virtual TAO_Endpoint *endpoint (void); /** @@ -96,6 +95,14 @@ public: */ void add_endpoint (TAO_SSLIOP_Endpoint * endp); +protected: + + /// Profile equivalence template method. + /** + * @see TAO_Profile::do_is_equivalent() + */ + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile * other_profile); + private: /** diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp index 6ea92e50ea6..58e089af074 100644 --- a/TAO/tao/IIOP_Profile.cpp +++ b/TAO/tao/IIOP_Profile.cpp @@ -225,20 +225,13 @@ TAO_IIOP_Profile::parse_string_i (const char *ior } CORBA::Boolean -TAO_IIOP_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != IOP::TAG_INTERNET_IOP) - return 0; - const TAO_IIOP_Profile *op = ACE_dynamic_cast (const TAO_IIOP_Profile *, other_profile); - - if (!(this->ref_object_key_->object_key () == - op->ref_object_key_->object_key () - && this->version_ == op->version_ - && this->count_ == op->count_)) + // Make sure we have a TAO_IIOP_Profile. + if (op == 0) return 0; // Check endpoints equivalence. @@ -253,9 +246,6 @@ TAO_IIOP_Profile::is_equivalent (const TAO_Profile *other_profile) return 0; } - if (!TAO_Profile::is_profile_equivalent_i (other_profile)) - return 0; - return 1; } @@ -296,7 +286,7 @@ TAO_IIOP_Profile::endpoint (void) } CORBA::ULong -TAO_IIOP_Profile::endpoint_count (void) +TAO_IIOP_Profile::endpoint_count (void) const { return this->count_; } diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h index 638b10512b5..0fc34f9fb2e 100644 --- a/TAO/tao/IIOP_Profile.h +++ b/TAO/tao/IIOP_Profile.h @@ -73,8 +73,7 @@ public: virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); /** @@ -92,6 +91,7 @@ protected: virtual void parse_string_i (const char *string ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); protected: diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp index 35dcbc78f46..4c0bc318d50 100644 --- a/TAO/tao/Profile.cpp +++ b/TAO/tao/Profile.cpp @@ -595,7 +595,6 @@ TAO_Profile::supports_multicast (void) const return 0; } - void TAO_Profile::addressing_mode (CORBA::Short addr ACE_ENV_ARG_DECL) @@ -668,12 +667,24 @@ TAO_Profile::parse_string (const char *ior } CORBA::Boolean -TAO_Profile::is_profile_equivalent_i (const TAO_Profile *other) +TAO_Profile::is_equivalent (const TAO_Profile *other) { - return this->orb_core_->is_profile_equivalent (this, - other); + return + other != 0 + && this->tag () == other->tag () + && this->version_ == other->version () + && this->endpoint_count () == other->endpoint_count () + && this->object_key () == other->object_key () + && this->do_is_equivalent (other) + && this->is_equivalent_hook (other); } +CORBA::Boolean +TAO_Profile::is_equivalent_hook (const TAO_Profile *other) +{ + // Allow services to apply their own definition of "equivalence." + return this->orb_core_->is_profile_equivalent (this, other); +} CORBA::ULong TAO_Profile::hash_service_i (CORBA::ULong m) @@ -699,7 +710,7 @@ TAO_Unknown_Profile::endpoint (void) } CORBA::ULong -TAO_Unknown_Profile::endpoint_count (void) +TAO_Unknown_Profile::endpoint_count (void) const { return 0; } @@ -779,15 +790,21 @@ TAO_Unknown_Profile::_key (void) const } CORBA::Boolean -TAO_Unknown_Profile::is_equivalent (const TAO_Profile* other_profile) +TAO_Unknown_Profile::do_is_equivalent (const TAO_Profile* other_profile) { - if (other_profile->tag () != this->tag ()) - return 0; + const TAO_Unknown_Profile * op = + ACE_dynamic_cast (const TAO_Unknown_Profile *, other_profile); - const TAO_Unknown_Profile *op = - ACE_dynamic_cast (const TAO_Unknown_Profile*, other_profile); + return (CORBA::Boolean) (op == 0 ? 0 : this->body_ == op->body_); +} - return (CORBA::Boolean) (this->body_ == op->body_); +CORBA::Boolean +TAO_Unknown_Profile::is_equivalent_hook (const TAO_Profile * /* other */) +{ + // Override the default implementation since we don't need the + // additional checks it performs. + + return 1; } CORBA::ULong diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h index ccb223e46aa..3ea0204c082 100644 --- a/TAO/tao/Profile.h +++ b/TAO/tao/Profile.h @@ -205,8 +205,6 @@ public: */ virtual int encode_endpoints (void) = 0; - - /** * Return pointer to this profile's endpoint. If the profile * contains more than one endpoint, i.e., a list, the method returns @@ -215,14 +213,19 @@ public: virtual TAO_Endpoint *endpoint (void) = 0; /// Return how many endpoints this profile contains. - virtual CORBA::ULong endpoint_count (void) = 0; + virtual CORBA::ULong endpoint_count (void) const = 0; + /// Verify profile equivalance. /** - * Return true if this profile is equivalent to other_profile. Two - * profiles are equivalent iff their tag, object_key, version and - * all endpoints are the same. + * Two profiles are equivalent @e iff their tag, object_key, version + * and all endpoints are the same. + * + * @see do_is_equivalent_i() + * @see is_equivalent_hook() + * + * @return @c true if this profile is equivalent to @c other_profile. */ - virtual CORBA::Boolean is_equivalent (const TAO_Profile* other_profile) = 0; + CORBA::Boolean is_equivalent (const TAO_Profile* other_profile); /// Return a hash value for this object. virtual CORBA::ULong hash (CORBA::ULong max @@ -230,11 +233,11 @@ public: //@} protected: + /** * @name Protected template methods. */ - - //@@{ + //@{ /// Decode the protocol specific profile details. virtual int decode_profile (TAO_InputCDR &cdr) = 0; @@ -265,9 +268,20 @@ protected: /// tagged_components. void set_tagged_components (TAO_OutputCDR &cdr); - /// Helper method that tries determining the equivalent profiles for - /// different services. - CORBA::Boolean is_profile_equivalent_i (const TAO_Profile *); + /// Profile equivalence template method invoked on subclasses. + /** + * TAO_Profile subclasses must implement this template method so + * that they can apply their own definition of profile equivalence. + */ + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile * other) = 0; + + /// Allow services to apply their own definition of "equivalence." + /** + * This method differs from the @c do_is_equivalent() template + * method in that it has a default implementation that may or not be + * applicable to all TAO_Profile subclasses. + */ + virtual CORBA::Boolean is_equivalent_hook (const TAO_Profile * other); CORBA::ULong hash_service_i (CORBA::ULong m); @@ -372,13 +386,18 @@ public: virtual const TAO::ObjectKey &object_key (void) const; virtual TAO::ObjectKey *_key (void) const; virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile* other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); virtual int decode_profile (TAO_InputCDR &cdr); virtual int decode_endpoints (void); + +protected: + + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile* other_profile); + virtual CORBA::Boolean is_equivalent_hook (const TAO_Profile* other_profile); + private: virtual void create_profile_body (TAO_OutputCDR &encap) const; diff --git a/TAO/tao/Strategies/DIOP_Profile.cpp b/TAO/tao/Strategies/DIOP_Profile.cpp index f53249f4450..df263f4dc3a 100644 --- a/TAO/tao/Strategies/DIOP_Profile.cpp +++ b/TAO/tao/Strategies/DIOP_Profile.cpp @@ -217,22 +217,11 @@ TAO_DIOP_Profile::parse_string_i (const char *ior } CORBA::Boolean -TAO_DIOP_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_DIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != TAO_TAG_UDP_PROFILE) - return 0; - const TAO_DIOP_Profile *op = ACE_dynamic_cast (const TAO_DIOP_Profile *, other_profile); - - if (!(this->ref_object_key_->object_key () == - op->ref_object_key_->object_key () - && this->version_ == op->version_ - && this->count_ == op->count_)) - return 0; - // Check endpoints equivalence. const TAO_DIOP_Endpoint *other_endp = &op->endpoint_; for (TAO_DIOP_Endpoint *endp = &this->endpoint_; @@ -245,9 +234,6 @@ TAO_DIOP_Profile::is_equivalent (const TAO_Profile *other_profile) return 0; } - if (!this->is_profile_equivalent_i (other_profile)) - return 0; - return 1; } @@ -288,7 +274,7 @@ TAO_DIOP_Profile::endpoint (void) } CORBA::ULong -TAO_DIOP_Profile::endpoint_count (void) +TAO_DIOP_Profile::endpoint_count (void) const { return this->count_; } diff --git a/TAO/tao/Strategies/DIOP_Profile.h b/TAO/tao/Strategies/DIOP_Profile.h index 6ca7f4d7f12..9c379075e1d 100644 --- a/TAO/tao/Strategies/DIOP_Profile.h +++ b/TAO/tao/Strategies/DIOP_Profile.h @@ -80,8 +80,7 @@ public: virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); /** @@ -99,6 +98,7 @@ protected: ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; virtual int decode_endpoints (void); + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); protected: diff --git a/TAO/tao/Strategies/SCIOP_Profile.cpp b/TAO/tao/Strategies/SCIOP_Profile.cpp index 05e5c7a4776..59bef91749c 100644 --- a/TAO/tao/Strategies/SCIOP_Profile.cpp +++ b/TAO/tao/Strategies/SCIOP_Profile.cpp @@ -236,20 +236,12 @@ TAO_SCIOP_Profile::parse_string_i (const char *ior } CORBA::Boolean -TAO_SCIOP_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_SCIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != TAO_TAG_SCIOP_PROFILE) - return 0; - const TAO_SCIOP_Profile *op = ACE_dynamic_cast (const TAO_SCIOP_Profile *, other_profile); - - if (!(this->ref_object_key_->object_key () == - op->ref_object_key_->object_key () - && this->version_ == op->version_ - && this->count_ == op->count_)) + if (op == 0) return 0; // Check endpoints equivalence. @@ -264,9 +256,6 @@ TAO_SCIOP_Profile::is_equivalent (const TAO_Profile *other_profile) return 0; } - if (!this->is_profile_equivalent_i (other_profile)) - return 0; - return 1; } @@ -307,7 +296,7 @@ TAO_SCIOP_Profile::endpoint (void) } CORBA::ULong -TAO_SCIOP_Profile::endpoint_count (void) +TAO_SCIOP_Profile::endpoint_count (void) const { return this->count_; } diff --git a/TAO/tao/Strategies/SCIOP_Profile.h b/TAO/tao/Strategies/SCIOP_Profile.h index 076ef4d3f6e..8076034ef79 100644 --- a/TAO/tao/Strategies/SCIOP_Profile.h +++ b/TAO/tao/Strategies/SCIOP_Profile.h @@ -1,8 +1,11 @@ -// $Id$ +// -*- C++ -*- + //============================================================================= /** * @file SCIOP_Profile.h * + * $Id$ + * * @author Jason Cohen, Lockheed Martin ATL <jcohen@atl.lmco.com> * @author Keith O'Hara, Lockheed Martin ATL * @author based on IIOP_Profile by @@ -13,6 +16,7 @@ #ifndef TAO_SCIOP_PROFILE_H #define TAO_SCIOP_PROFILE_H + #include /**/ "ace/pre.h" #include "tao/Profile.h" @@ -71,8 +75,7 @@ public: virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); /** @@ -90,6 +93,7 @@ protected: virtual void parse_string_i (const char *string ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); protected: @@ -121,4 +125,5 @@ protected: #endif /* TAO_HAS_SCIOP == 1 */ #include /**/ "ace/post.h" + #endif /* TAO_SCIOP_PROFILE_H */ diff --git a/TAO/tao/Strategies/SHMIOP_Profile.cpp b/TAO/tao/Strategies/SHMIOP_Profile.cpp index e315abe4dd8..e9e97ef5a65 100644 --- a/TAO/tao/Strategies/SHMIOP_Profile.cpp +++ b/TAO/tao/Strategies/SHMIOP_Profile.cpp @@ -1,5 +1,5 @@ -// This may look like C, but it's really -*- C++ -*- // $Id$ + #include "SHMIOP_Profile.h" #if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0) @@ -89,7 +89,7 @@ TAO_SHMIOP_Profile::endpoint (void) } CORBA::ULong -TAO_SHMIOP_Profile::endpoint_count (void) +TAO_SHMIOP_Profile::endpoint_count (void) const { return this->count_; } @@ -265,19 +265,12 @@ TAO_SHMIOP_Profile::parse_string_i (const char *string } CORBA::Boolean -TAO_SHMIOP_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_SHMIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != TAO_TAG_SHMEM_PROFILE) - return 0; - const TAO_SHMIOP_Profile *op = ACE_dynamic_cast (const TAO_SHMIOP_Profile *, other_profile); - if (!(this->ref_object_key_->object_key () == - op->ref_object_key_->object_key () - && this->version_ == op->version_ - && this->count_ == op->count_)) + if (op == 0) return 0; // Check endpoints equivalence. @@ -292,9 +285,6 @@ TAO_SHMIOP_Profile::is_equivalent (const TAO_Profile *other_profile) return 0; } - if (!this->is_profile_equivalent_i (other_profile)) - return 0; - return 1; } diff --git a/TAO/tao/Strategies/SHMIOP_Profile.h b/TAO/tao/Strategies/SHMIOP_Profile.h index 1d060094e5e..9e2cff2a246 100644 --- a/TAO/tao/Strategies/SHMIOP_Profile.h +++ b/TAO/tao/Strategies/SHMIOP_Profile.h @@ -80,8 +80,7 @@ public: virtual char * to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); /** @@ -92,12 +91,14 @@ public: void add_endpoint (TAO_SHMIOP_Endpoint *endp); protected: + /// Template methods. Please see tao/Profile.h for documentation. virtual int decode_profile (TAO_InputCDR& cdr); virtual void parse_string_i (const char *string ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; virtual int decode_endpoints (void); + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); private: diff --git a/TAO/tao/Strategies/UIOP_Profile.cpp b/TAO/tao/Strategies/UIOP_Profile.cpp index e21481f8f2f..b8aaf43922b 100644 --- a/TAO/tao/Strategies/UIOP_Profile.cpp +++ b/TAO/tao/Strategies/UIOP_Profile.cpp @@ -1,4 +1,3 @@ -// This may look like C, but it's really -*- C++ -*- // $Id$ #include "UIOP_Profile.h" @@ -89,7 +88,7 @@ TAO_UIOP_Profile::endpoint (void) } CORBA::ULong -TAO_UIOP_Profile::endpoint_count (void) +TAO_UIOP_Profile::endpoint_count (void) const { return this->count_; } @@ -142,19 +141,12 @@ TAO_UIOP_Profile::parse_string_i (const char *string } CORBA::Boolean -TAO_UIOP_Profile::is_equivalent (const TAO_Profile *other_profile) +TAO_UIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile) { - - if (other_profile->tag () != TAO_TAG_UIOP_PROFILE) - return 0; - const TAO_UIOP_Profile *op = ACE_dynamic_cast (const TAO_UIOP_Profile *, other_profile); - if (!(this->ref_object_key_->object_key () == - op->ref_object_key_->object_key () - && this->version_ == op->version_ - && this->count_ == op->count_)) + if (op == 0) return 0; // Check endpoints equivalence. @@ -169,9 +161,6 @@ TAO_UIOP_Profile::is_equivalent (const TAO_Profile *other_profile) return 0; } - if (!this->is_profile_equivalent_i (other_profile)) - return 0; - return 1; } diff --git a/TAO/tao/Strategies/UIOP_Profile.h b/TAO/tao/Strategies/UIOP_Profile.h index cde0be225d4..ce13ea8a6ee 100644 --- a/TAO/tao/Strategies/UIOP_Profile.h +++ b/TAO/tao/Strategies/UIOP_Profile.h @@ -8,8 +8,7 @@ * * Unix Domain Socket (UIOP) profile specific processing * - * - * @author Ossama Othman <ossama@uci.edu> + * @author Ossama Othman <ossama@dre.vanderbilt.edu> * @author Fred Kuhns <fredk@cs.wustl.edu> */ //============================================================================= @@ -78,8 +77,7 @@ public: virtual char *to_string (ACE_ENV_SINGLE_ARG_DECL); virtual int encode_endpoints (void); virtual TAO_Endpoint *endpoint (void); - virtual CORBA::ULong endpoint_count (void); - virtual CORBA::Boolean is_equivalent (const TAO_Profile *other_profile); + virtual CORBA::ULong endpoint_count (void) const; virtual CORBA::ULong hash (CORBA::ULong max ACE_ENV_ARG_DECL); /** @@ -98,6 +96,7 @@ protected: ACE_ENV_ARG_DECL); virtual void create_profile_body (TAO_OutputCDR &cdr) const; virtual int decode_endpoints (void); + virtual CORBA::Boolean do_is_equivalent (const TAO_Profile *other_profile); private: /** |