OpenDDS::DCPS::PriorityKey Class Reference

Encapsulate a priority value and internet address as a key. More...

#include <PriorityKey.h>

List of all members.

Public Member Functions

 PriorityKey ()
 PriorityKey (Priority priority, ACE_INET_Addr address, bool is_loopback, bool active)
bool operator< (const PriorityKey &rhs) const
bool operator== (const PriorityKey &rhs) const
unsigned long hash () const
Prioritypriority ()
Priority priority () const
ACE_INET_Addr & address ()
ACE_INET_Addr address () const
bool & is_loopback ()
bool is_loopback () const
bool & is_active ()
bool is_active () const

Private Attributes

Priority priority_
ACE_INET_Addr address_
bool is_loopback_
bool is_active_


Detailed Description

Encapsulate a priority value and internet address as a key.

This class is encapsulates a priority value and an internet address value for use as a key in either an STL container or an ACE hash container. The '<' operator is used by the STL containers and the '==' operator and hash() method are used by the ACE hash map container(s). The ACE hash map container(s) also require the use of a default constructor as well.

To use keys of this type as an STL container key, simply include this type as the key template parameter. An example usage is:

typedef std::map<PriorityKey, ValueType> PriorityMap;

To use this type as an ACE hash container key, use the function object templates ACE_Hash and ACE_Equal_To for the HASH_KEY and COMPARE_KEYS template parameters. An example usage is:

typedef ACE_Hash_Map_Manager_Ex< PriorityKey, ValueType, ACE_Hash<PriorityKey>, ACE_Equal_To<PriorityKey>, SynchType > PriorityHashMap;

Default copy constructor and assigment are sufficient. Readonly and read/write accessors for member data are provided.

Definition at line 50 of file PriorityKey.h.


Constructor & Destructor Documentation

ACE_INLINE OpenDDS::DCPS::PriorityKey::PriorityKey (  ) 

Definition at line 12 of file PriorityKey.inl.

00013   : priority_(0), is_loopback_(false), is_active_(false)
00014 {
00015 }

ACE_INLINE OpenDDS::DCPS::PriorityKey::PriorityKey ( Priority  priority,
ACE_INET_Addr  address,
bool  is_loopback,
bool  active 
)

Definition at line 18 of file PriorityKey.inl.

00019   : priority_(priority), address_(address), is_loopback_(is_loopback), is_active_(active)
00020 {
00021 }


Member Function Documentation

ACE_INLINE ACE_INET_Addr OpenDDS::DCPS::PriorityKey::address (  )  const

Definition at line 77 of file PriorityKey.inl.

References address_.

00078 {
00079   return this->address_;
00080 }

ACE_INLINE ACE_INET_Addr & OpenDDS::DCPS::PriorityKey::address (  ) 

Definition at line 70 of file PriorityKey.inl.

References address_.

Referenced by OpenDDS::DCPS::TcpTransport::accept_datalink(), and OpenDDS::DCPS::TcpTransport::connect_datalink().

00071 {
00072   return this->address_;
00073 }

ACE_INLINE unsigned long OpenDDS::DCPS::PriorityKey::hash (  )  const

Definition at line 48 of file PriorityKey.inl.

References address_, is_active_, and is_loopback_.

00049 {
00050   return (this->priority_ << 16) + this->address_.hash() + this->is_loopback_
00051     + this->is_active_;
00052 }

ACE_INLINE bool OpenDDS::DCPS::PriorityKey::is_active (  )  const

Definition at line 105 of file PriorityKey.inl.

References is_active_.

00106 {
00107   return this->is_active_;
00108 }

ACE_INLINE bool & OpenDDS::DCPS::PriorityKey::is_active (  ) 

Definition at line 98 of file PriorityKey.inl.

References is_active_.

Referenced by OpenDDS::DCPS::TcpTransport::accept_datalink(), and OpenDDS::DCPS::TcpTransport::connect_datalink().

00099 {
00100   return this->is_active_;
00101 }

ACE_INLINE bool OpenDDS::DCPS::PriorityKey::is_loopback (  )  const

Definition at line 91 of file PriorityKey.inl.

References is_loopback_.

00092 {
00093   return this->is_loopback_;
00094 }

ACE_INLINE bool & OpenDDS::DCPS::PriorityKey::is_loopback (  ) 

Definition at line 84 of file PriorityKey.inl.

References is_loopback_.

Referenced by OpenDDS::DCPS::TcpTransport::accept_datalink(), and OpenDDS::DCPS::TcpTransport::connect_datalink().

00085 {
00086   return this->is_loopback_;
00087 }

ACE_INLINE bool OpenDDS::DCPS::PriorityKey::operator< ( const PriorityKey rhs  )  const

Definition at line 25 of file PriorityKey.inl.

References address_, is_active_, is_loopback_, and priority_.

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 }

ACE_INLINE bool OpenDDS::DCPS::PriorityKey::operator== ( const PriorityKey rhs  )  const

Definition at line 38 of file PriorityKey.inl.

References address_, is_active_, is_loopback_, and priority_.

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 }

ACE_INLINE Priority OpenDDS::DCPS::PriorityKey::priority (  )  const

Definition at line 63 of file PriorityKey.inl.

References priority_.

00064 {
00065   return this->priority_;
00066 }

ACE_INLINE Priority & OpenDDS::DCPS::PriorityKey::priority (  ) 

Definition at line 56 of file PriorityKey.inl.

References priority_.

Referenced by OpenDDS::DCPS::TcpTransport::accept_datalink(), and OpenDDS::DCPS::TcpTransport::connect_datalink().

00057 {
00058   return this->priority_;
00059 }


Member Data Documentation

ACE_INET_Addr OpenDDS::DCPS::PriorityKey::address_ [private]

Definition at line 86 of file PriorityKey.h.

Referenced by address(), hash(), operator<(), and operator==().

bool OpenDDS::DCPS::PriorityKey::is_active_ [private]

Definition at line 89 of file PriorityKey.h.

Referenced by hash(), is_active(), operator<(), and operator==().

bool OpenDDS::DCPS::PriorityKey::is_loopback_ [private]

Definition at line 88 of file PriorityKey.h.

Referenced by hash(), is_loopback(), operator<(), and operator==().

Priority OpenDDS::DCPS::PriorityKey::priority_ [private]

Definition at line 83 of file PriorityKey.h.

Referenced by operator<(), operator==(), and priority().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:28 2016 for OpenDDS by  doxygen 1.4.7