00001 #ifndef __XRDCnsXref_H_ 00002 #define __XRDCnsXref_H_ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d C n s X r e f . h h */ 00006 /* */ 00007 /* (c) 2009 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: XrdCnsXref.hh 30949 2009-11-02 16:37:58Z ganis $ 00014 00015 #include "XrdOuc/XrdOucHash.hh" 00016 #include "XrdSys/XrdSysPthread.hh" 00017 00018 class XrdCnsXref 00019 { 00020 public: 00021 00022 00023 char Add(const char *Key, char xref=0); 00024 00025 char *Apply(int (*func)(const char *, char *, void *), void *Arg) 00026 {return xTable.Apply(func, Arg);} 00027 00028 char Default(const char *Dflt=0); 00029 00030 char *Key (char xref); 00031 00032 char Find(const char *xref); 00033 00034 XrdCnsXref(const char *Dflt=0, int MTProt=1); 00035 ~XrdCnsXref(); 00036 00037 private: 00038 00039 int availI(); 00040 int c2i(char xCode); 00041 XrdSysMutex xMutex; 00042 XrdOucHash<char> xTable; 00043 static char *xIndex; 00044 00045 static const int yTSize = '~'-'0'+1; 00046 char *yTable[yTSize]; 00047 int availIdx; 00048 int isMT; 00049 }; 00050 #endif