summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2001-09-09 02:36:43 +0000
committerMarc Laukien <marc@zeroc.com>2001-09-09 02:36:43 +0000
commit07da96698f552090621960295ce15666b4af557e (patch)
tree5080e5e06e8b28fdc708a39c7aad25f9e0bdc739 /cpp/src
parentfix (diff)
downloadice-07da96698f552090621960295ce15666b4af557e.tar.bz2
ice-07da96698f552090621960295ce15666b4af557e.tar.xz
ice-07da96698f552090621960295ce15666b4af557e.zip
more tests, fixes to operator< and operator==
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Endpoint.cpp94
-rw-r--r--cpp/src/Ice/Endpoint.h5
-rw-r--r--cpp/src/Ice/Proxy.cpp6
-rw-r--r--cpp/src/Ice/Reference.cpp20
-rw-r--r--cpp/src/Ice/Reference.h1
5 files changed, 39 insertions, 87 deletions
diff --git a/cpp/src/Ice/Endpoint.cpp b/cpp/src/Ice/Endpoint.cpp
index 833af74472b..d8753565839 100644
--- a/cpp/src/Ice/Endpoint.cpp
+++ b/cpp/src/Ice/Endpoint.cpp
@@ -199,29 +199,23 @@ IceInternal::UnknownEndpoint::equivalent(const AcceptorPtr&) const
bool
IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
{
- return !operator!=(r);
-}
-
-bool
-IceInternal::UnknownEndpoint::operator!=(const Endpoint& r) const
-{
const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r);
if (!p)
{
- return true;
+ return false;
}
if (this == p)
{
- return false;
+ return true;
}
if (_rawBytes != p->_rawBytes)
{
- return true;
+ return false;
}
- return false;
+ return true;
}
bool
@@ -466,44 +460,37 @@ IceInternal::TcpEndpoint::equivalent(const AcceptorPtr& acceptor) const
bool
IceInternal::TcpEndpoint::operator==(const Endpoint& r) const
{
- return !operator!=(r);
-}
-
-bool
-IceInternal::TcpEndpoint::operator!=(const Endpoint& r) const
-{
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
if (!p)
{
- return true;
+ return false;
}
if (this == p)
{
- return false;
+ return true;
}
if (_port != p->_port)
{
- return true;
+ return false;
}
-
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
struct sockaddr_in laddr;
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0)
{
- return true;
- }
-
- if (_timeout != p->_timeout)
- {
- return true;
+ return false;
}
- return false;
+ return true;
}
bool
@@ -539,7 +526,6 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
@@ -786,44 +772,37 @@ IceInternal::SslEndpoint::equivalent(const AcceptorPtr& acceptor) const
bool
IceInternal::SslEndpoint::operator==(const Endpoint& r) const
{
- return !operator!=(r);
-}
-
-bool
-IceInternal::SslEndpoint::operator!=(const Endpoint& r) const
-{
const SslEndpoint* p = dynamic_cast<const SslEndpoint*>(&r);
if (!p)
{
- return true;
+ return false;
}
if (this == p)
{
- return false;
+ return true;
}
if (_port != p->_port)
{
- return true;
+ return false;
}
-
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
struct sockaddr_in laddr;
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0)
{
- return true;
- }
-
- if (_timeout != p->_timeout)
- {
- return true;
+ return false;
}
- return false;
+ return true;
}
bool
@@ -859,7 +838,6 @@ IceInternal::SslEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
@@ -1084,39 +1062,32 @@ IceInternal::UdpEndpoint::equivalent(const AcceptorPtr&) const
bool
IceInternal::UdpEndpoint::operator==(const Endpoint& r) const
{
- return !operator!=(r);
-}
-
-bool
-IceInternal::UdpEndpoint::operator!=(const Endpoint& r) const
-{
const UdpEndpoint* p = dynamic_cast<const UdpEndpoint*>(&r);
if (!p)
{
- return true;
+ return false;
}
if (this == p)
{
- return false;
+ return true;
}
if (_port != p->_port)
{
- return true;
+ return false;
}
-
+
struct sockaddr_in laddr;
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (memcmp(&laddr, &raddr, sizeof(struct sockaddr_in)) != 0)
{
- return true;
+ return false;
}
- return false;
+ return true;
}
bool
@@ -1152,7 +1123,6 @@ IceInternal::UdpEndpoint::operator<(const Endpoint& r) const
struct sockaddr_in raddr;
getAddress(_host.c_str(), _port, laddr);
getAddress(p->_host.c_str(), p->_port, raddr);
-
if (laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
{
return true;
diff --git a/cpp/src/Ice/Endpoint.h b/cpp/src/Ice/Endpoint.h
index c2952c9434e..879157dfc41 100644
--- a/cpp/src/Ice/Endpoint.h
+++ b/cpp/src/Ice/Endpoint.h
@@ -118,7 +118,6 @@ public:
// Compare endpoints for sorting purposes
//
virtual bool operator==(const Endpoint&) const = 0;
- virtual bool operator!=(const Endpoint&) const = 0;
virtual bool operator<(const Endpoint&) const = 0;
};
@@ -144,7 +143,6 @@ public:
virtual bool equivalent(const AcceptorPtr&) const;
virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
virtual bool operator<(const Endpoint&) const;
private:
@@ -179,7 +177,6 @@ public:
virtual bool equivalent(const AcceptorPtr&) const;
virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
virtual bool operator<(const Endpoint&) const;
private:
@@ -216,7 +213,6 @@ public:
virtual bool equivalent(const AcceptorPtr&) const;
virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
virtual bool operator<(const Endpoint&) const;
private:
@@ -253,7 +249,6 @@ public:
virtual bool equivalent(const AcceptorPtr&) const;
virtual bool operator==(const Endpoint&) const;
- virtual bool operator!=(const Endpoint&) const;
virtual bool operator<(const Endpoint&) const;
private:
diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp
index 0ad0ce7a209..3f257907966 100644
--- a/cpp/src/Ice/Proxy.cpp
+++ b/cpp/src/Ice/Proxy.cpp
@@ -147,12 +147,6 @@ IceProxy::Ice::Object::operator==(const Object& r) const
}
bool
-IceProxy::Ice::Object::operator!=(const Object& r) const
-{
- return _reference->identity != r._reference->identity;
-}
-
-bool
IceProxy::Ice::Object::operator<(const Object& r) const
{
return _reference->identity < r._reference->identity;
diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp
index c7885f1e94e..349a5794bb1 100644
--- a/cpp/src/Ice/Reference.cpp
+++ b/cpp/src/Ice/Reference.cpp
@@ -348,43 +348,37 @@ IceInternal::Reference::changeEndpoints(const std::vector<EndpointPtr>& newEndpo
bool
IceInternal::Reference::operator==(const Reference& r) const
{
- return !operator!=(r);
-}
-
-bool
-IceInternal::Reference::operator!=(const Reference& r) const
-{
if (this == &r)
{
- return false;
+ return true;
}
if (identity != r.identity)
{
- return true;
+ return false;
}
if (mode != r.mode)
{
- return true;
+ return false;
}
if (secure != r.secure)
{
- return true;
+ return false;
}
if (origEndpoints != r.origEndpoints)
{
- return true;
+ return false;
}
if (endpoints != r.endpoints)
{
- return true;
+ return false;
}
- return false;
+ return true;
}
bool
diff --git a/cpp/src/Ice/Reference.h b/cpp/src/Ice/Reference.h
index 4433810c596..76c9a375546 100644
--- a/cpp/src/Ice/Reference.h
+++ b/cpp/src/Ice/Reference.h
@@ -70,7 +70,6 @@ public:
ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
bool operator==(const Reference&) const;
- bool operator!=(const Reference&) const;
bool operator<(const Reference&) const;
};