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

#include <XrdSsiRRTable.hh>

Collaboration diagram for XrdSsiRRTable< T >:

Public Member Functions

 XrdSsiRRTable ()
 ~XrdSsiRRTable ()
void Add (T *item, uint64_t itemID)
void Clear ()
void Del (uint64_t itemID, bool finit=false)
T * LookUp (uint64_t itemID)
int Num ()
void Reset ()

Detailed Description

template<class T>
class XrdSsiRRTable< T >

Definition at line 38 of file XrdSsiRRTable.hh.

Constructor & Destructor Documentation

◆ XrdSsiRRTable()

template<class T>
XrdSsiRRTable< T >::XrdSsiRRTable ( )
inline

Definition at line 90 of file XrdSsiRRTable.hh.

90: baseItem(0), baseKey(0) {}

◆ ~XrdSsiRRTable()

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

Definition at line 92 of file XrdSsiRRTable.hh.

92{Reset();}

References Reset().

Here is the call graph for this function:

Member Function Documentation

◆ Add()

template<class T>
void XrdSsiRRTable< T >::Add ( T * item,
uint64_t itemID )
inline

Definition at line 42 of file XrdSsiRRTable.hh.

43 {rrtMutex.Lock();
44 if (baseItem != 0) theMap[itemID] = item;
45 else {baseKey = itemID;
46 baseItem = item;
47 }
48 rrtMutex.UnLock();
49 }

◆ Clear()

template<class T>
void XrdSsiRRTable< T >::Clear ( )
inline

Definition at line 51 of file XrdSsiRRTable.hh.

51{rrtMutex.Lock(); theMap.clear(); rrtMutex.UnLock();}

◆ Del()

template<class T>
void XrdSsiRRTable< T >::Del ( uint64_t itemID,
bool finit = false )
inline

Definition at line 53 of file XrdSsiRRTable.hh.

54 {XrdSsiMutexMon lck(rrtMutex);
55 if (baseItem && baseKey == itemID)
56 {if (finit) baseItem->Finalize();
57 baseItem = 0;
58 } else {
59 if (!finit) theMap.erase(itemID);
60 else {typename std::map<uint64_t,T*>::iterator it = theMap.find(itemID);
61 if (it != theMap.end()) it->second->Finalize();
62 theMap.erase(it);
63 }
64 }
65 }

◆ LookUp()

template<class T>
T * XrdSsiRRTable< T >::LookUp ( uint64_t itemID)
inline

Definition at line 67 of file XrdSsiRRTable.hh.

68 {XrdSsiMutexMon lck(rrtMutex);
69 if (baseItem && baseKey == itemID) return baseItem;
70 typename std::map<uint64_t,T*>::iterator it = theMap.find(itemID);
71 return (it == theMap.end() ? 0 : it->second);
72 }

◆ Num()

template<class T>
int XrdSsiRRTable< T >::Num ( )
inline

Definition at line 74 of file XrdSsiRRTable.hh.

74{return theMap.size() + (baseItem ? 1 : 0);}

◆ Reset()

template<class T>
void XrdSsiRRTable< T >::Reset ( )
inline

Definition at line 76 of file XrdSsiRRTable.hh.

77 {XrdSsiMutexMon lck(rrtMutex);
78 typename std::map<uint64_t, T*>::iterator it = theMap.begin();
79 while(it != theMap.end())
80 {it->second->Finalize();
81 it++;
82 }
83 theMap.clear();
84 if (baseItem)
85 {baseItem->Finalize();
86 baseItem = 0;
87 }
88 }

Referenced by ~XrdSsiRRTable().

Here is the caller graph for this function:

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