diff options
author | Steve Huston <shuston@riverace.com> | 1997-11-07 03:21:52 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 1997-11-07 03:21:52 +0000 |
commit | a17646afec6e82dab9b7f5dee600ad764477bc72 (patch) | |
tree | f1ce04c7655a9c28f7233f12ad5dc253e5d32d8e | |
parent | 06cfc98eedbedb12028c0520095d9d5e9617ba0e (diff) | |
download | ATCD-a17646afec6e82dab9b7f5dee600ad764477bc72.tar.gz |
Changed operators == and != to be non-virtual, and to take the 'sap' argument
as their own type (not ACE_Addr). Changed the implementations to use more
of the type-specific data.
-rw-r--r-- | ace/Addr.h | 6 | ||||
-rw-r--r-- | ace/Addr.i | 6 | ||||
-rw-r--r-- | ace/DEV_Addr.h | 4 | ||||
-rw-r--r-- | ace/DEV_Addr.i | 8 | ||||
-rw-r--r-- | ace/FILE_Addr.h | 4 | ||||
-rw-r--r-- | ace/FILE_Addr.i | 8 | ||||
-rw-r--r-- | ace/INET_Addr.cpp | 12 | ||||
-rw-r--r-- | ace/INET_Addr.h | 4 | ||||
-rw-r--r-- | ace/SPIPE_Addr.h | 4 | ||||
-rw-r--r-- | ace/SPIPE_Addr.i | 9 | ||||
-rw-r--r-- | ace/UNIX_Addr.h | 4 | ||||
-rw-r--r-- | ace/UNIX_Addr.i | 11 |
12 files changed, 37 insertions, 43 deletions
diff --git a/ace/Addr.h b/ace/Addr.h index b7c4d5b3c5a..e8a03e6ad13 100644 --- a/ace/Addr.h +++ b/ace/Addr.h @@ -27,7 +27,7 @@ class ACE_Export ACE_Addr public: // = Initialization method. - ACE_Addr (int type = 0, int size = 0); + ACE_Addr (int type = -1, int size = -1); // Initializes instance variables. // = Get/set the size of the address. @@ -53,10 +53,10 @@ public: // Set a pointer to the address. // = Equality/inequality tests - virtual int operator == (const ACE_Addr &sap) const; + int operator == (const ACE_Addr &sap) const; // Check for address equality. - virtual int operator != (const ACE_Addr &sap) const; + int operator != (const ACE_Addr &sap) const; // Check for address inequality. void base_set (int type, int size); diff --git a/ace/Addr.i b/ace/Addr.i index ce4a5b59036..8a701eccfd5 100644 --- a/ace/Addr.i +++ b/ace/Addr.i @@ -19,13 +19,15 @@ ACE_Addr::set_addr (void *, int) ACE_INLINE int ACE_Addr::operator == (const ACE_Addr &sap) const { - return sap.addr_type_ == this->addr_type_; + return (sap.addr_type_ == this->addr_type_ && + sap.addr_size_ == this->addr_size_ ); } ACE_INLINE int ACE_Addr::operator != (const ACE_Addr &sap) const { - return sap.addr_type_ != this->addr_type_; + return (sap.addr_type_ != this->addr_type_ || + sap.addr_size_ != this->addr_size_ ); } // Return the size of the address. diff --git a/ace/DEV_Addr.h b/ace/DEV_Addr.h index 1d4df8b958b..b1b06a810a5 100644 --- a/ace/DEV_Addr.h +++ b/ace/DEV_Addr.h @@ -53,10 +53,10 @@ public: virtual int addr_to_string (char *addr, size_t) const; // Transform the current address into string format. - virtual int operator == (const ACE_Addr &SAP) const; + int operator == (const ACE_DEV_Addr &SAP) const; // Compare two addresses for equality. - virtual int operator != (const ACE_Addr &SAP) const; + int operator != (const ACE_DEV_Addr &SAP) const; // Compare two addresses for inequality. LPCTSTR get_path_name (void) const; diff --git a/ace/DEV_Addr.i b/ace/DEV_Addr.i index 89b4298332c..e76ed184d32 100644 --- a/ace/DEV_Addr.i +++ b/ace/DEV_Addr.i @@ -50,19 +50,17 @@ ACE_DEV_Addr::get_addr (void) const // Compare two addresses for equality. ACE_INLINE int -ACE_DEV_Addr::operator == (const ACE_Addr &sap) const +ACE_DEV_Addr::operator == (const ACE_DEV_Addr &sap) const { ACE_TRACE ("ACE_DEV_Addr::operator="); - return this->ACE_Addr::operator== (sap) - && ACE_OS::strcmp (this->devname_, - ((ACE_DEV_Addr &) sap).devname_) == 0; + return ACE_OS::strcmp (this->devname_, sap.devname_) == 0; } // Compare two addresses for inequality. ACE_INLINE int -ACE_DEV_Addr::operator != (const ACE_Addr &sap) const +ACE_DEV_Addr::operator != (const ACE_DEV_Addr &sap) const { ACE_TRACE ("ACE_DEV_Addr::operator!="); diff --git a/ace/FILE_Addr.h b/ace/FILE_Addr.h index e49240dbe7f..733dcf08f69 100644 --- a/ace/FILE_Addr.h +++ b/ace/FILE_Addr.h @@ -53,10 +53,10 @@ public: virtual int addr_to_string (char *addr, size_t) const; // Transform the current address into string format. - virtual int operator == (const ACE_Addr &SAP) const; + int operator == (const ACE_FILE_Addr &SAP) const; // Compare two addresses for equality. - virtual int operator != (const ACE_Addr &SAP) const; + int operator != (const ACE_FILE_Addr &SAP) const; // Compare two addresses for inequality. LPCTSTR get_path_name (void) const; diff --git a/ace/FILE_Addr.i b/ace/FILE_Addr.i index f364be3f719..b1f3aeb78c8 100644 --- a/ace/FILE_Addr.i +++ b/ace/FILE_Addr.i @@ -84,17 +84,15 @@ ACE_FILE_Addr::get_addr (void) const // Compare two addresses for equality. ACE_INLINE int -ACE_FILE_Addr::operator == (const ACE_Addr &sap) const +ACE_FILE_Addr::operator == (const ACE_FILE_Addr &sap) const { - return this->ACE_Addr::operator== (sap) - && ACE_OS::strcmp (this->filename_, - ((ACE_FILE_Addr &) sap).filename_) == 0; + return ACE_OS::strcmp (this->filename_, sap.filename_) == 0; } // Compare two addresses for inequality. ACE_INLINE int -ACE_FILE_Addr::operator != (const ACE_Addr &sap) const +ACE_FILE_Addr::operator != (const ACE_FILE_Addr &sap) const { return !((*this) == sap); // This is lazy, of course... ;-) } diff --git a/ace/INET_Addr.cpp b/ace/INET_Addr.cpp index 66abf1334b3..36ad5bca409 100644 --- a/ace/INET_Addr.cpp +++ b/ace/INET_Addr.cpp @@ -43,7 +43,7 @@ ACE_INET_Addr::dump (void) const // Compare two addresses for inequality. int -ACE_INET_Addr::operator != (const ACE_Addr &sap) const +ACE_INET_Addr::operator != (const ACE_INET_Addr &sap) const { ACE_TRACE ("ACE_INET_Addr::operator !="); return !((*this) == sap); @@ -52,15 +52,13 @@ ACE_INET_Addr::operator != (const ACE_Addr &sap) const // Compare two addresses for equality. int -ACE_INET_Addr::operator == (const ACE_Addr &sap) const +ACE_INET_Addr::operator == (const ACE_INET_Addr &sap) const { ACE_TRACE ("ACE_INET_Addr::operator =="); - const sockaddr_in &inet_sap = ((const ACE_INET_Addr &) sap).inet_addr_; - return this->ACE_Addr::operator == (sap) - && this->inet_addr_.sin_port == inet_sap.sin_port - && ACE_OS::memcmp ((void *) &this->inet_addr_.sin_addr, - (void *) &inet_sap.sin_addr, + return this->inet_addr_.sin_port == sap.inet_addr_.sin_port + && ACE_OS::memcmp ((void *) &this->inet_addr_.sin_addr, + (void *) &sap.inet_addr_.sin_addr, sizeof (this->inet_addr_.sin_addr)) == 0; } diff --git a/ace/INET_Addr.h b/ace/INET_Addr.h index 8fa8b80c7d4..7016d2a10d9 100644 --- a/ace/INET_Addr.h +++ b/ace/INET_Addr.h @@ -144,11 +144,11 @@ public: // Return the 4-byte IP address, converting it into host byte // order. - virtual int operator == (const ACE_Addr &SAP) const; + int operator == (const ACE_INET_Addr &SAP) const; // Compare two addresses for equality. The addresses are considered // equal if they contain the same IP address and port number. - virtual int operator != (const ACE_Addr &SAP) const; + int operator != (const ACE_INET_Addr &SAP) const; // Compare two addresses for inequality. void dump (void) const; diff --git a/ace/SPIPE_Addr.h b/ace/SPIPE_Addr.h index 2a69c851e2b..0696775b3c4 100644 --- a/ace/SPIPE_Addr.h +++ b/ace/SPIPE_Addr.h @@ -59,10 +59,10 @@ public: // Transform the string into the current addressing format. // = Equality/inequality tests - virtual int operator == (const ACE_Addr &SAP) const; + int operator == (const ACE_SPIPE_Addr &SAP) const; // Check for equality. - virtual int operator != (const ACE_Addr &SAP) const; + int operator != (const ACE_SPIPE_Addr &SAP) const; // Check for inequality // = SPIPE-specific address operations diff --git a/ace/SPIPE_Addr.i b/ace/SPIPE_Addr.i index 9aed87534e4..944c762483f 100644 --- a/ace/SPIPE_Addr.i +++ b/ace/SPIPE_Addr.i @@ -36,17 +36,16 @@ ACE_SPIPE_Addr::get_addr (void) const // Compare two addresses for equality. ACE_INLINE int -ACE_SPIPE_Addr::operator == (const ACE_Addr &sap) const +ACE_SPIPE_Addr::operator == (const ACE_SPIPE_Addr &sap) const { - return this->ACE_Addr::operator == (sap) - && ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_, - ((ACE_SPIPE_Addr &) sap).SPIPE_addr_.rendezvous_) == 0; + return ACE_OS::strcmp (this->SPIPE_addr_.rendezvous_, + sap.SPIPE_addr_.rendezvous_ ) == 0; } // Compare two addresses for inequality. ACE_INLINE int -ACE_SPIPE_Addr::operator != (const ACE_Addr &sap) const +ACE_SPIPE_Addr::operator != (const ACE_SPIPE_Addr &sap) const { return !((*this) == sap); // This is lazy, of course... ;-) } diff --git a/ace/UNIX_Addr.h b/ace/UNIX_Addr.h index 0e2e35d0baa..82ba01f2981 100644 --- a/ace/UNIX_Addr.h +++ b/ace/UNIX_Addr.h @@ -59,10 +59,10 @@ public: virtual int string_to_addr (const char addr[]); // Transform the string into the current addressing format. - virtual int operator == (const ACE_Addr &SAP) const; + int operator == (const ACE_UNIX_Addr &SAP) const; // Compare two addresses for equality. - virtual int operator != (const ACE_Addr &SAP) const; + int operator != (const ACE_UNIX_Addr &SAP) const; // Compare two addresses for inequality. const char *get_path_name (void) const; diff --git a/ace/UNIX_Addr.i b/ace/UNIX_Addr.i index f4bcfb6fad4..c07b43b493b 100644 --- a/ace/UNIX_Addr.i +++ b/ace/UNIX_Addr.i @@ -35,18 +35,17 @@ ACE_UNIX_Addr::addr_to_string (char s[], size_t len) const // Compare two addresses for equality. ACE_INLINE int -ACE_UNIX_Addr::operator == (const ACE_Addr &sap) const +ACE_UNIX_Addr::operator == (const ACE_UNIX_Addr &sap) const { - return this->ACE_Addr::operator == (sap) - && ACE_OS::strncmp (this->unix_addr_.sun_path, - ((const ACE_UNIX_Addr &) sap).unix_addr_.sun_path, - sizeof this->unix_addr_.sun_path) == 0; + return ACE_OS::strncmp (this->unix_addr_.sun_path, + sap.unix_addr_.sun_path, + sizeof this->unix_addr_.sun_path) == 0; } // Compare two addresses for inequality. ACE_INLINE int -ACE_UNIX_Addr::operator != (const ACE_Addr &sap) const +ACE_UNIX_Addr::operator != (const ACE_UNIX_Addr &sap) const { return !((*this) == sap); // This is lazy, of course... ;-) } |