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