summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Profile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/IIOP_Profile.cpp')
-rw-r--r--TAO/tao/IIOP_Profile.cpp75
1 files changed, 72 insertions, 3 deletions
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
index 93bc39cbd7d..4866b52a071 100644
--- a/TAO/tao/IIOP_Profile.cpp
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -202,13 +202,16 @@ TAO_IIOP_Profile::parse_string_i (const char *ior
{
// A port number or port name was specified.
CORBA::ULong length_port = okd - cp_pos - 1;
-
CORBA::String_var tmp = CORBA::string_alloc (length_port);
ACE_OS::strncpy (tmp.inout (), cp_pos + 1, length_port);
tmp[length_port] = '\0';
-
- if (ACE_OS::strspn (tmp.in (), "1234567890") == length_port)
+ if (length_port == 0)
+ {
+ this->endpoint_.port_ = 2809; // default IIOP port for
+ // parsing corbaloc strings
+ }
+ else if (ACE_OS::strspn (tmp.in (), "1234567890") == length_port)
{
this->endpoint_.port_ =
static_cast<CORBA::UShort> (ACE_OS::atoi (tmp.in ()));
@@ -299,6 +302,9 @@ TAO_IIOP_Profile::parse_string_i (const char *ior
CORBA::Boolean
TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
{
+ if (other_profile == this)
+ return 1;
+
const TAO_IIOP_Profile *op =
dynamic_cast<const TAO_IIOP_Profile *> (other_profile);
@@ -306,6 +312,10 @@ TAO_IIOP_Profile::do_is_equivalent (const TAO_Profile *other_profile)
if (op == 0)
return 0;
+ if (this->count_ == 0 && op->count_ == 0)
+ return 1;
+ if (this->count_ != op->count_)
+ return 0;
// Check endpoints equivalence.
const TAO_IIOP_Endpoint *other_endp = &op->endpoint_;
for (TAO_IIOP_Endpoint *endp = &this->endpoint_;
@@ -372,6 +382,65 @@ TAO_IIOP_Profile::add_endpoint (TAO_IIOP_Endpoint *endp)
++this->count_;
}
+void
+TAO_IIOP_Profile::remove_endpoint (TAO_IIOP_Endpoint *endp)
+{
+ if (endp == 0)
+ return;
+
+ // special handling for the target matching the base endpoint
+ if (endp == &this->endpoint_)
+ {
+ if (--this->count_ > 0)
+ {
+ TAO_IIOP_Endpoint* n = this->endpoint_.next_;
+ this->endpoint_ = *n;
+ // since the assignment operator does not copy the next_
+ // pointer, we must do it by hand
+ this->endpoint_.next_ = n->next_;
+ delete n;
+ }
+ return;
+ }
+
+ TAO_IIOP_Endpoint* last = &this->endpoint_;
+ TAO_IIOP_Endpoint* cur = this->endpoint_.next_;
+
+ while (cur != 0)
+ {
+ if (cur == endp)
+ break;
+ last = cur;
+ cur = cur->next_;
+ }
+
+ if (cur != 0)
+ {
+ last->next_ = cur->next_;
+ cur->next_ = 0;
+ --this->count_;
+ delete cur;
+ }
+}
+
+void
+TAO_IIOP_Profile::remove_generic_endpoint (TAO_Endpoint *ep)
+{
+ this->remove_endpoint(dynamic_cast<TAO_IIOP_Endpoint *>(ep));
+}
+
+void
+TAO_IIOP_Profile::add_generic_endpoint (TAO_Endpoint *endp)
+{
+ TAO_IIOP_Endpoint *iep = dynamic_cast<TAO_IIOP_Endpoint *>(endp);
+ if (iep != 0)
+ {
+ TAO_IIOP_Endpoint *clone;
+ ACE_NEW (clone, TAO_IIOP_Endpoint(*iep));
+ this->add_endpoint(clone);
+ }
+}
+
char *
TAO_IIOP_Profile::to_string (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
{