xrootd
Loading...
Searching...
No Matches
XrdOucChain.hh
Go to the documentation of this file.
1#ifndef __OUC_CHAIN__
2#define __OUC_CHAIN__
3/******************************************************************************/
4/* */
5/* X r d O u c C h a i n . h h */
6/* */
7/* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */
8/* All Rights Reserved */
9/* Produced by Andrew Hanushevsky for Stanford University under contract */
10/* DE-AC02-76-SFO0515 with the Department of Energy */
11/* */
12/* This file is part of the XRootD software suite. */
13/* */
14/* XRootD is free software: you can redistribute it and/or modify it under */
15/* the terms of the GNU Lesser General Public License as published by the */
16/* Free Software Foundation, either version 3 of the License, or (at your */
17/* option) any later version. */
18/* */
19/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22/* License for more details. */
23/* */
24/* You should have received a copy of the GNU Lesser General Public License */
25/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27/* */
28/* The copyright holder's institutional names and contributor's names may not */
29/* be used to endorse or promote products derived from this software without */
30/* specific prior written permission of the institution or contributor. */
31/******************************************************************************/
32
33template<class T>
35{
36public:
39 XrdOucQSItem(T *item) {dataitem = item; nextelem = 0;}
41};
42
43template<class T>
45{
46public:
47
48int isEmpty() {return anchor == 0;}
49
51 if (!(cp = anchor)) return (T *)0;
53 cp->nextelem = 0;
54 return cp->dataitem;
55 }
56
57void Push(XrdOucQSItem<T> *item) {item->nextelem = anchor; anchor = item;}
58
61
62private:
64};
65
66template<class T>
68{
69public:
70
71void Add(XrdOucQSItem<T> *item)
72 {item->nextelem = 0;
73 if (lastelem) {lastelem->nextelem = item;
74 lastelem = item;
75 }
76 else anchor = lastelem = item;
77 }
78
79int isEmpty() {return anchor == 0;}
80
82 if (!(qp = anchor)) return (T *)0;
83 if (!(anchor = anchor->nextelem)) lastelem = 0;
84 return qp->dataitem;
85 }
86
89
90private:
93};
94#endif
Definition XrdOucChain.hh:35
XrdOucQSItem< T > * nextelem
Definition XrdOucChain.hh:37
XrdOucQSItem(T *item)
Definition XrdOucChain.hh:39
~XrdOucQSItem()
Definition XrdOucChain.hh:40
T * dataitem
Definition XrdOucChain.hh:38
Definition XrdOucChain.hh:68
XrdOucQSItem< T > * anchor
Definition XrdOucChain.hh:91
XrdOucQueue()
Definition XrdOucChain.hh:87
~XrdOucQueue()
Definition XrdOucChain.hh:88
int isEmpty()
Definition XrdOucChain.hh:79
XrdOucQSItem< T > * lastelem
Definition XrdOucChain.hh:92
void Add(XrdOucQSItem< T > *item)
Definition XrdOucChain.hh:71
T * Remove()
Definition XrdOucChain.hh:81
Definition XrdOucChain.hh:45
T * Pop()
Definition XrdOucChain.hh:50
XrdOucStack()
Definition XrdOucChain.hh:59
~XrdOucStack()
Definition XrdOucChain.hh:60
int isEmpty()
Definition XrdOucChain.hh:48
void Push(XrdOucQSItem< T > *item)
Definition XrdOucChain.hh:57
XrdOucQSItem< T > * anchor
Definition XrdOucChain.hh:63