summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2003-10-28 15:10:59 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2003-10-28 15:10:59 +0000
commite07a1718c970265bdd3759a7601a8876976292b7 (patch)
treeb27b5a9ff967bac39ba1d66f61f2bc2d61302009 /TAO/tao
parent05c00a513c19251914af6f56a761aafd4c6a338e (diff)
downloadATCD-e07a1718c970265bdd3759a7601a8876976292b7.tar.gz
ChangeLogTag:Tue Oct 28 07:05:46 2003 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/IIOP_Profile.cpp18
-rw-r--r--TAO/tao/IIOP_Profile.h4
-rw-r--r--TAO/tao/Profile.cpp39
-rw-r--r--TAO/tao/Profile.h47
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.cpp18
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.h4
-rw-r--r--TAO/tao/Strategies/SCIOP_Profile.cpp17
-rw-r--r--TAO/tao/Strategies/SCIOP_Profile.h11
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.cpp18
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.h5
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.cpp17
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.h7
12 files changed, 95 insertions, 110 deletions
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:
/**