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

`#include <XrdOucTable.hh>`

Collaboration diagram for XrdOucTable< T >:

## Classes

union | OucTable.__unnamed0__

## 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.__unnamed0__

union XrdOucTable::OucTable.__unnamed0__

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

Definition at line 153 of file XrdOucTable.hh.

Collaboration diagram for XrdOucTable< T >::OucTable.__unnamed0__:

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.

{int i;
Table = new OucTable[(unsigned int)maxe];
maxnum = maxe; curnum = 0; avlnum = 0;
for (i = 1; i < maxe; i++) Table[i-1].Fnum = i;
Table[maxe-1].Fnum = -1;
}
XrdOucTable
Definition XrdOucTable.hh:38

## ~XrdOucTable()

template<class T>

XrdOucTable< T >::~XrdOucTable | ( |  | ) |

inline

Definition at line 49 of file XrdOucTable.hh.

{delete [] Table;}

## Member Function Documentation

## Alloc()

template<class T>

int XrdOucTable< T >::Alloc | ( |  | ) |

inline

Definition at line 54 of file XrdOucTable.hh.

{int i = avlnum;
if (i >= 0) {avlnum = Table[i].Fnum;
if (i >= curnum) curnum = i+1;
}
return i;
}

Referenced by Insert().

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.

{int i;
for (i = Start; i < curnum; i++)
if (Table[i].Item && (*func)(Table[i].Item, Arg))
return Table[i].Item;
return (T *)0;
}
XrdOucTable::Item
T * Item(int Tnum, char **ikey=0)
Definition XrdOucTable.hh:114

References 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.

{T *temp;
if ((temp = Remove(key))) delete temp;
}
XrdOucTable::Remove
T * Remove(int Tnum)
Definition XrdOucTable.hh:132

References 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.

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

References 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.

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

References Item().

Referenced by Remove().

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.

{if ((Tnum < 0 && ((Tnum = Alloc()) < 0)) || Tnum >= maxnum) return -1;
Table[Tnum].Item = Item; Table[Tnum].Key = strdup(key);
return Tnum;
}
XrdOucTable::Alloc
int Alloc()
Definition XrdOucTable.hh:54

References Alloc(), and Item().

Here is the call 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.

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

References Item().

Referenced by Apply(), Find(), Insert(), Item(), Next(), and 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.

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

References Item().

Here is the call graph for this function:

## Remove() [1/2]

template<class T>

T * XrdOucTable< T >::Remove | ( | const char * | key | ) |

inline

Definition at line 146 of file XrdOucTable.hh.

{int i;
if (Find(key, &i)) return Remove(i);
return (T *)0;
}
XrdOucTable::Find
T * Find(const char *key, int *Tnum=0)
Definition XrdOucTable.hh:93

References Find(), and 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.

{T *temp;
if (Tnum < 0 || Tnum >= curnum || !Table[Tnum].Item) return (T *)0;
if (Table[Tnum].Key) free(Table[Tnum].Key);
temp = Table[Tnum].Item; Table[Tnum].Item = 0;
Table[Tnum].Fnum = avlnum;
avlnum = Tnum;
if (Tnum == (curnum-1))
{if (curnum == maxnum) curnum--;
while(curnum && Table[curnum].Item == 0) curnum--;
}
return temp;
}

References Item().

Referenced by Delete(), Delete(), and 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:

- XrdOucTable.hh