00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00009 00010 namespace OpenDDS { 00011 namespace DCPS { 00012 00013 ACE_INLINE 00014 PriorityKey::PriorityKey() 00015 : priority_(0), is_loopback_(false), is_active_(false) 00016 { 00017 } 00018 00019 ACE_INLINE 00020 PriorityKey::PriorityKey(Priority priority, ACE_INET_Addr address, bool is_loopback, bool active) 00021 : priority_(priority), address_(address), is_loopback_(is_loopback), is_active_(active) 00022 { 00023 } 00024 00025 ACE_INLINE 00026 bool 00027 PriorityKey::operator<(const PriorityKey& rhs) const 00028 { 00029 return (this->address_ < rhs.address_)? true: 00030 (rhs.address_ < this->address_)? false: 00031 this->priority_ < rhs.priority_? true: 00032 (rhs.priority_ < this->priority_)? false : 00033 (this->is_loopback_ != rhs.is_loopback_) ? rhs.is_loopback_ : 00034 (this->is_active_ != rhs.is_active_) ? rhs.is_active_ : 00035 false; 00036 } 00037 00038 ACE_INLINE 00039 bool 00040 PriorityKey::operator==(const PriorityKey& rhs) const 00041 { 00042 return (this->priority_ == rhs.priority_) 00043 && (this->address_ == rhs.address_) 00044 && (this->is_loopback_ == rhs.is_loopback_) 00045 && (this->is_active_ == rhs.is_active_); 00046 } 00047 00048 ACE_INLINE 00049 unsigned long 00050 PriorityKey::hash() const 00051 { 00052 return (this->priority_ << 16) + this->address_.hash() + this->is_loopback_ 00053 + this->is_active_; 00054 } 00055 00056 ACE_INLINE 00057 Priority& 00058 PriorityKey::priority() 00059 { 00060 return this->priority_; 00061 } 00062 00063 ACE_INLINE 00064 Priority 00065 PriorityKey::priority() const 00066 { 00067 return this->priority_; 00068 } 00069 00070 ACE_INLINE 00071 ACE_INET_Addr& 00072 PriorityKey::address() 00073 { 00074 return this->address_; 00075 } 00076 00077 ACE_INLINE 00078 ACE_INET_Addr 00079 PriorityKey::address() const 00080 { 00081 return this->address_; 00082 } 00083 00084 00085 ACE_INLINE 00086 bool& PriorityKey::is_loopback() 00087 { 00088 return this->is_loopback_; 00089 } 00090 00091 00092 ACE_INLINE 00093 bool PriorityKey::is_loopback() const 00094 { 00095 return this->is_loopback_; 00096 } 00097 00098 00099 ACE_INLINE 00100 bool& PriorityKey::is_active() 00101 { 00102 return this->is_active_; 00103 } 00104 00105 00106 ACE_INLINE 00107 bool PriorityKey::is_active() const 00108 { 00109 return this->is_active_; 00110 } 00111 00112 } 00113 } 00114 00115 OPENDDS_END_VERSIONED_NAMESPACE_DECL