This is Unofficial EPICS BASE Doxygen Site
caServerID Class Reference

#include "caServerID.h"

+ Inheritance diagram for caServerID:

Public Member Functions

 caServerID (const struct sockaddr_in &addrIn, unsigned priority)
 
bool operator== (const caServerID &) const
 
resTableIndex hash () const
 
osiSockAddr address () const
 
unsigned priority () const
 

Detailed Description

Definition at line 27 of file caServerID.h.

Constructor & Destructor Documentation

caServerID::caServerID ( const struct sockaddr_in &  addrIn,
unsigned  priority 
)
inline

Definition at line 39 of file caServerID.h.

40  :
41  addr ( addrIn ), pri ( static_cast <ca_uint8_t> ( priorityIn ) )
42 {
43  assert ( priorityIn <= 0xff );
44 }
#define assert(exp)
Declare that a condition should be true.
Definition: epicsAssert.h:70

Member Function Documentation

osiSockAddr caServerID::address ( ) const
inline

Definition at line 73 of file caServerID.h.

74 {
75  osiSockAddr tmp;
76  tmp.ia = this->addr;
77  return tmp;
78 }
struct sockaddr_in ia
Definition: osiSock.h:157
resTableIndex caServerID::hash ( ) const
inline

Definition at line 56 of file caServerID.h.

57 {
58  // start with a very small server table to speed
59  // up the flush traverse for the frequent case -
60  // a small numbers of servers
61  const unsigned caServerMinIndexBitWidth = 2u;
62  const unsigned caServerMaxIndexBitWidth = 32u;
63 
64  unsigned index;
65  index = this->addr.sin_addr.s_addr;
66  index ^= this->addr.sin_port;
67  index ^= this->addr.sin_port >> 8u;
68  index ^= this->pri;
69  return integerHash ( caServerMinIndexBitWidth,
70  caServerMaxIndexBitWidth, index );
71 }
resTableIndex integerHash(unsigned MIN_INDEX_WIDTH, unsigned MAX_ID_WIDTH, const T &id)
Definition: resourceLib.h:1032
bool caServerID::operator== ( const caServerID rhs) const
inline

Definition at line 46 of file caServerID.h.

47 {
48  if ( this->addr.sin_addr.s_addr == rhs.addr.sin_addr.s_addr &&
49  this->addr.sin_port == rhs.addr.sin_port &&
50  this->pri == rhs.pri ) {
51  return true;
52  }
53  return false;
54 }
unsigned caServerID::priority ( ) const
inline

Definition at line 80 of file caServerID.h.

81 {
82  return this->pri;
83 }

The documentation for this class was generated from the following file: