XRootD
Loading...
Searching...
No Matches
XrdOucTable< T > Class Template Reference

#include <XrdOucTable.hh>

+ Collaboration diagram for XrdOucTable< T >:

Classes

union  OucTable.__unnamed122__
 

Public Member Functions

 XrdOucTable (int maxe)
 
 ~XrdOucTable ()
 
int Alloc ()
 
T * Apply (int(*func)(T *, void *), void *Arg, int Start=0)
 
void Delete (const char *key)
 
void Delete (int Tnum)
 
T * Find (const char *key, int *Tnum=0)
 
int Insert (T *Item, const char *key=0, int Tnum=-1)
 
T * Item (int Tnum, char **ikey=0)
 
int Next (int &Tnum)
 
T * Remove (const char *key)
 
T * Remove (int Tnum)
 

Detailed Description

template<class T>
class XrdOucTable< T >

Definition at line 37 of file XrdOucTable.hh.


Class Documentation

◆ XrdOucTable::OucTable.__unnamed122__

union XrdOucTable::OucTable.__unnamed122__
template<class T>
union XrdOucTable< T >::OucTable.__unnamed122__

Definition at line 151 of file XrdOucTable.hh.

+ Collaboration diagram for XrdOucTable< T >::OucTable.__unnamed122__:
Class Members
int Fnum
char * Key

Constructor & Destructor Documentation

◆ XrdOucTable()

template<class T >
XrdOucTable< T >::XrdOucTable ( int maxe)
inline

Definition at line 41 of file XrdOucTable.hh.

42 {int i;
43 Table = new OucTable[(unsigned int)maxe];
44 maxnum = maxe; curnum = 0; avlnum = 0;
45 for (i = 1; i < maxe; i++) Table[i-1].Fnum = i;
46 Table[maxe-1].Fnum = -1;
47 }

◆ ~XrdOucTable()

template<class T >
XrdOucTable< T >::~XrdOucTable ( )
inline

Definition at line 49 of file XrdOucTable.hh.

49{delete [] Table;}

Member Function Documentation

◆ Alloc()

template<class T >
int XrdOucTable< T >::Alloc ( )
inline

Definition at line 54 of file XrdOucTable.hh.

54 {int i = avlnum;
55 if (i >= 0) {avlnum = Table[i].Fnum;
56 if (i >= curnum) curnum = i+1;
57 }
58 return i;
59 }

Referenced by XrdOucTable< T >::Insert(), and XrdXrootdJob::Schedule().

+ Here is the caller graph for this function:

◆ Apply()

template<class T >
T * XrdOucTable< T >::Apply ( int(* func )(T *, void *),
void * Arg,
int Start = 0 )
inline

Definition at line 67 of file XrdOucTable.hh.

68 {int i;
69 for (i = Start; i < curnum; i++)
70 if (Table[i].Item && (*func)(Table[i].Item, Arg))
71 return Table[i].Item;
72 return (T *)0;
73 }
T * Item(int Tnum, char **ikey=0)

References XrdOucTable< T >::Item().

+ Here is the call graph for this function:

◆ Delete() [1/2]

template<class T >
void XrdOucTable< T >::Delete ( const char * key)
inline

Definition at line 83 of file XrdOucTable.hh.

84 {T *temp;
85 if ((temp = Remove(key))) delete temp;
86 }
T * Remove(int Tnum)

References XrdOucTable< T >::Remove().

+ Here is the call graph for this function:

◆ Delete() [2/2]

template<class T >
void XrdOucTable< T >::Delete ( int Tnum)
inline

Definition at line 78 of file XrdOucTable.hh.

79 {T *temp;
80 if ((temp = Remove(Tnum))) delete temp;
81 }

References XrdOucTable< T >::Remove().

+ Here is the call graph for this function:

◆ Find()

template<class T >
T * XrdOucTable< T >::Find ( const char * key,
int * Tnum = 0 )
inline

Definition at line 93 of file XrdOucTable.hh.

94 {int i;
95 for (i = 0; i < curnum; i++)
96 if (Table[i].Item && Table[i].Key && !strcmp(Table[i].Key, key))
97 {if (Tnum) *Tnum = i; return Table[i].Item;}
98 return 0;
99 }

References XrdOucTable< T >::Item().

Referenced by XrdXrootdJob::Cancel(), XrdOucTable< T >::Remove(), and XrdXrootdJob::Schedule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Insert()

template<class T >
int XrdOucTable< T >::Insert ( T * Item,
const char * key = 0,
int Tnum = -1 )
inline

Definition at line 105 of file XrdOucTable.hh.

106 {if ((Tnum < 0 && ((Tnum = Alloc()) < 0)) || Tnum >= maxnum) return -1;
107 Table[Tnum].Item = Item; Table[Tnum].Key = strdup(key);
108 return Tnum;
109 }

References XrdOucTable< T >::Alloc(), and XrdOucTable< T >::Item().

Referenced by XrdXrootdJob::Schedule().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Item()

template<class T >
T * XrdOucTable< T >::Item ( int Tnum,
char ** ikey = 0 )
inline

Definition at line 114 of file XrdOucTable.hh.

115 {if (Tnum < 0 || Tnum >= curnum || !Table[Tnum].Item) return (T *)0;
116 if (ikey) *ikey = Table[Tnum].Key;
117 return Table[Tnum].Item;
118 }

References XrdOucTable< T >::Item().

Referenced by XrdOucTable< T >::Apply(), XrdXrootdJob::Cancel(), XrdXrootdJob::DoIt(), XrdOucTable< T >::Find(), XrdOucTable< T >::Insert(), XrdOucTable< T >::Item(), XrdXrootdJob::List(), XrdOucTable< T >::Next(), and XrdOucTable< T >::Remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Next()

template<class T >
int XrdOucTable< T >::Next ( int & Tnum)
inline

Definition at line 123 of file XrdOucTable.hh.

123 {int i;
124 for (i = Tnum; i < curnum; i++)
125 if (Table[i].Item) {Tnum = i+1; return i;}
126 return -1;
127 }

References XrdOucTable< T >::Item().

Referenced by XrdXrootdJob::Cancel(), XrdXrootdJob::DoIt(), and XrdXrootdJob::List().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Remove() [1/2]

template<class T >
T * XrdOucTable< T >::Remove ( const char * key)
inline

Definition at line 144 of file XrdOucTable.hh.

144 {int i;
145 if (Find(key, &i)) return Remove(i);
146 return (T *)0;
147 }
T * Find(const char *key, int *Tnum=0)

References XrdOucTable< T >::Find(), and XrdOucTable< T >::Remove().

+ Here is the call graph for this function:

◆ Remove() [2/2]

template<class T >
T * XrdOucTable< T >::Remove ( int Tnum)
inline

Definition at line 132 of file XrdOucTable.hh.

133 {T *temp;
134 if (Tnum < 0 || Tnum >= curnum || !Table[Tnum].Item) return (T *)0;
135 if (Table[Tnum].Key) free(Table[Tnum].Key);
136 temp = Table[Tnum].Item; Table[Tnum].Item = 0;
137 Table[Tnum].Fnum = avlnum;
138 avlnum = Tnum;
139 if (Tnum == (curnum-1))
140 while(curnum && Table[curnum].Item == 0) curnum--;
141 return temp;
142 }

References XrdOucTable< T >::Item().

Referenced by XrdOucTable< T >::Delete(), XrdOucTable< T >::Delete(), XrdXrootdJob2Do::DoIt(), and XrdOucTable< T >::Remove().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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