XRootD
XrdCmsRTable Class Reference

#include <XrdCmsRTable.hh>

+ Collaboration diagram for XrdCmsRTable:

Public Member Functions

 XrdCmsRTable ()
 
 ~XrdCmsRTable ()
 
short Add (XrdCmsNode *nP)
 
void Del (XrdCmsNode *nP)
 
XrdCmsNodeFind (short Num, int Inst)
 
void Lock ()
 
void Send (const char *What, const char *data, int dlen)
 
void UnLock ()
 

Detailed Description

Definition at line 39 of file XrdCmsRTable.hh.

Constructor & Destructor Documentation

◆ XrdCmsRTable()

XrdCmsRTable::XrdCmsRTable ( )
inline

Definition at line 55 of file XrdCmsRTable.hh.

55 {memset(Rtable, 0, sizeof(Rtable)); Hwm = -1;}

◆ ~XrdCmsRTable()

XrdCmsRTable::~XrdCmsRTable ( )
inline

Definition at line 57 of file XrdCmsRTable.hh.

57 {}

Member Function Documentation

◆ Add()

short XrdCmsRTable::Add ( XrdCmsNode nP)

Definition at line 46 of file XrdCmsRTable.cc.

47 {
48  int i;
49 
50 // Find a free slot for this node.
51 //
52  myMutex.Lock();
53  for (i = 1; i < maxRD; i++) if (!Rtable[i]) break;
54 
55 // Insert the node if found
56 //
57  if (i >= maxRD) i = 0;
58  else {Rtable[i] = nP;
59  if (i > Hwm) Hwm = i;
60  }
61 
62 // All done
63 //
64  myMutex.UnLock();
65  return static_cast<short>(i);
66 }
#define maxRD
Definition: XrdCmsTypes.hh:44

References maxRD, and XrdCmsNode::UnLock().

+ Here is the call graph for this function:

◆ Del()

void XrdCmsRTable::Del ( XrdCmsNode nP)

Definition at line 72 of file XrdCmsRTable.cc.

73 {
74  int i;
75 
76 // Find the slot for this node.
77 //
78  myMutex.Lock();
79  for (i = 1; i <= Hwm; i++) if (Rtable[i] == nP) break;
80 
81 // Remove the node if found
82 //
83  if (i <= Hwm)
84  {Rtable[i] = 0;
85  if (i == Hwm) {while(--i) if (Rtable[i]) break; Hwm = i;}
86  }
87 
88 // All done
89 //
90  myMutex.UnLock();
91 }

Referenced by XrdCmsProtocol::Process().

+ Here is the caller graph for this function:

◆ Find()

XrdCmsNode * XrdCmsRTable::Find ( short  Num,
int  Inst 
)

Definition at line 101 of file XrdCmsRTable.cc.

102 {
103 
104 // Find the instance of the node in the indicated slot
105 //
106  if (Num <= Hwm && Rtable[Num] && Rtable[Num]->Inst() == Inst)
107  return Rtable[Num];
108  return (XrdCmsNode *)0;
109 }

◆ Lock()

void XrdCmsRTable::Lock ( )
inline

Definition at line 51 of file XrdCmsRTable.hh.

51 {myMutex.Lock();}

References XrdSysMutex::Lock().

+ Here is the call graph for this function:

◆ Send()

void XrdCmsRTable::Send ( const char *  What,
const char *  data,
int  dlen 
)

Definition at line 115 of file XrdCmsRTable.cc.

116 {
117  EPNAME("Send");
118  int i;
119 
120 // Send the data to all nodes in this table
121 //
122  myMutex.Lock();
123  for (i = 1; i <= Hwm; i++)
124  if (Rtable[i])
125  {DEBUG(What <<" to " <<Rtable[i]->Ident);
126  Rtable[i]->Send(data, dlen);
127  }
128  myMutex.UnLock();
129 }
#define DEBUG(x)
Definition: XrdBwmTrace.hh:54
#define EPNAME(x)
Definition: XrdBwmTrace.hh:56
int Send(const char *buff, int blen=0)
Definition: XrdCmsNode.hh:184

References DEBUG, and EPNAME.

Referenced by XrdCmsState::Monitor().

+ Here is the caller graph for this function:

◆ UnLock()

void XrdCmsRTable::UnLock ( )
inline

Definition at line 53 of file XrdCmsRTable.hh.

53 {myMutex.UnLock();}

References XrdSysMutex::UnLock().

+ Here is the call graph for this function:

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