00001 #ifndef __XRDCMSRTABLE_HH_ 00002 #define __XRDCMSRTABLE_HH_ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C m s R T a b l e . h h */ 00006 /* */ 00007 /* (c) 2007 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id: XrdCmsRTable.hh 32231 2010-02-05 18:24:46Z ganis $ 00014 00015 #include <string.h> 00016 00017 #include "XrdCms/XrdCmsNode.hh" 00018 #include "XrdCms/XrdCmsTypes.hh" 00019 #include "XrdSys/XrdSysPthread.hh" 00020 00021 class XrdCmsRTable 00022 { 00023 public: 00024 00025 short Add(XrdCmsNode *nP); 00026 00027 void Del(XrdCmsNode *nP); 00028 00029 XrdCmsNode *Find(short Num, int Inst); 00030 00031 void Send(const char *What, const char *data, int dlen); 00032 00033 void Lock() {myMutex.Lock();} 00034 00035 void UnLock() {myMutex.UnLock();} 00036 00037 XrdCmsRTable() {memset(Rtable, 0, sizeof(Rtable)); Hwm = -1;} 00038 00039 ~XrdCmsRTable() {} 00040 00041 private: 00042 00043 XrdSysMutex myMutex; 00044 XrdCmsNode *Rtable[maxRD]; 00045 int Hwm; 00046 }; 00047 00048 namespace XrdCms 00049 { 00050 extern XrdCmsRTable RTable; 00051 } 00052 #endif