xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdCms
XrdCmsPList.hh
Go to the documentation of this file.
1
#ifndef XRDCMSPLIST__H
2
#define XRDCMSPLIST__H
3
/******************************************************************************/
4
/* */
5
/* X r d C m s P L i s t . h h */
6
/* */
7
/* (c) 2007 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
13
// $Id$
14
15
#include <string.h>
16
#include <strings.h>
17
#include <stdlib.h>
18
19
#include "
XrdCms/XrdCmsTypes.hh
"
20
#include "
XrdSys/XrdSysPthread.hh
"
21
22
/******************************************************************************/
23
/* C l a s s X r d C m s P I n f o */
24
/******************************************************************************/
25
26
class
XrdCmsPInfo
27
{
28
public
:
29
SMask_t
rovec
;
30
SMask_t
rwvec
;
31
SMask_t
ssvec
;
32
33
inline
int
And
(
const
SMask_t
mask)
34
{
return
((
rovec
&= mask)|(
rwvec
&= mask)|(
ssvec
&= mask)) != 0;}
35
36
inline
void
Or
(
const
XrdCmsPInfo
*pi)
37
{
rovec
|= pi->
rovec
;
rwvec
|= pi->
rwvec
;
ssvec
|= pi->
ssvec
;}
38
39
inline
void
Set
(
const
XrdCmsPInfo
*pi)
40
{
rovec
= pi->
rovec
;
rwvec
= pi->
rwvec
;
ssvec
= pi->
ssvec
;}
41
42
XrdCmsPInfo
() {
rovec
=
rwvec
=
ssvec
= 0;}
43
~XrdCmsPInfo
() {}
44
XrdCmsPInfo
&
operator =
(
const
XrdCmsPInfo
&rhs)
45
{
Set
(&rhs);
return
*
this
;}
46
};
47
48
/******************************************************************************/
49
/* C l a s s X r d C m s P L i s t */
50
/******************************************************************************/
51
52
class
XrdCmsPList
53
{
54
public
:
55
friend
class
XrdCmsPList_Anchor
;
56
57
inline
XrdCmsPList
*
Next
() {
return
next
;}
58
inline
char
*
Path
() {
return
pathname
;}
59
const
char
*
PType
();
60
61
XrdCmsPList
(
const
char
*pname=
""
,
XrdCmsPInfo
*pi=0)
62
:
next
(0),
pathname
(strdup(pname)),
pathlen
(strlen(pname)),
63
pathtype
(0) {
if
(pi)
pathmask
.
Set
(pi);}
64
65
~XrdCmsPList
() {
if
(
pathname
) free(
pathname
);}
66
67
private
:
68
69
XrdCmsPInfo
pathmask
;
70
XrdCmsPList
*
next
;
71
char
*
pathname
;
72
int
pathlen
;
73
char
pathtype
;
74
char
reserved
[3];
75
};
76
77
class
XrdCmsPList_Anchor
78
{
79
public
:
80
81
inline
void
Lock
() {
mutex
.
Lock
();}
82
inline
void
UnLock
() {
mutex
.
UnLock
();}
83
84
int
Add
(
const
char
*pname,
XrdCmsPInfo
*pinfo);
85
86
inline
void
Empty
(
XrdCmsPList
*newlist=0)
87
{
Lock
();
88
XrdCmsPList
*p =
next
;
89
while
(p) {
next
= p->
next
;
delete
p; p =
next
;}
90
next
= newlist;
91
UnLock
();
92
}
93
94
int
Find
(
const
char
*pname,
XrdCmsPInfo
&masks);
95
96
inline
XrdCmsPList
*
First
() {
return
next
;}
97
98
SMask_t
Insert
(
const
char
*pname,
XrdCmsPInfo
*pinfo);
99
100
inline
int
NotEmpty
() {
return
next
!= 0;}
101
102
void
Remove
(
SMask_t
mask);
103
104
const
char
*
Type
(
const
char
*pname);
105
106
inline
XrdCmsPList
*
Zorch
(
XrdCmsPList
*newlist=0)
107
{
Lock
();
108
XrdCmsPList
*p =
next
;
109
next
= newlist;
110
UnLock
();
111
return
p;
112
}
113
114
XrdCmsPList_Anchor
() {
next
= 0;}
115
116
~XrdCmsPList_Anchor
() {
Empty
();}
117
118
private
:
119
120
XrdSysMutex
mutex
;
121
XrdCmsPList
*
next
;
122
};
123
#endif
Generated by
1.8.1.2