xrootd
Loading...
Searching...
No Matches
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/* 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
33#include <cstring>
34#include <strings.h>
35#include <cstdlib>
36
37#include "XrdCms/XrdCmsTypes.hh"
39
40/******************************************************************************/
41/* C l a s s X r d C m s P I n f o */
42/******************************************************************************/
43
45{
46public:
50
51inline int And(const SMask_t mask)
52 {return ((rovec &= mask)|(rwvec &= mask)|(ssvec &= mask)) != 0;}
53
54inline void Or(const XrdCmsPInfo *pi)
55 {rovec |= pi->rovec; rwvec |= pi->rwvec; ssvec |= pi->ssvec;}
56
57inline void Set(const XrdCmsPInfo *pi)
58 {rovec = pi->rovec; rwvec = pi->rwvec; ssvec = pi->ssvec;}
59
63 {Set(&rhs); return *this;}
64};
65
66/******************************************************************************/
67/* C l a s s X r d C m s P L i s t */
68/******************************************************************************/
69
71{
72public:
73friend class XrdCmsPList_Anchor;
74
75inline XrdCmsPList *Next() {return next;}
76inline char *Path() {return pathname;}
77const char *PType();
78
79 XrdCmsPList(const char *pname="", XrdCmsPInfo *pi=0)
80 : next(0), pathname(strdup(pname)), pathlen(strlen(pname)),
81 pathtype(0) {if (pi) pathmask.Set(pi);}
82
84
85private:
86
92char reserved[3];
93};
94
96{
97public:
98
99inline void Lock() {mutex.Lock();}
100inline void UnLock() {mutex.UnLock();}
101
102 int Add(const char *pname, XrdCmsPInfo *pinfo);
103
104inline void Empty(XrdCmsPList *newlist=0)
105 {Lock();
106 XrdCmsPList *p = next;
107 while(p) {next = p->next; delete p; p = next;}
108 next = newlist;
109 UnLock();
110 }
111
112 int Find(const char *pname, XrdCmsPInfo &masks);
113
114inline XrdCmsPList *First() {return next;}
115
116 SMask_t Insert(const char *pname, XrdCmsPInfo *pinfo);
117
118inline int NotEmpty() {return next != 0;}
119
120 void Remove(SMask_t mask);
121
122const char *Type(const char *pname);
123
124inline XrdCmsPList *Zorch(XrdCmsPList *newlist=0)
125 {Lock();
126 XrdCmsPList *p = next;
127 next = newlist;
128 UnLock();
129 return p;
130 }
131
133
135
136private:
137
140};
141#endif
unsigned long long SMask_t
Definition XrdCmsTypes.hh:33
Definition XrdCmsPList.hh:45
XrdCmsPInfo()
Definition XrdCmsPList.hh:60
XrdCmsPInfo & operator=(const XrdCmsPInfo &rhs)
Definition XrdCmsPList.hh:62
SMask_t ssvec
Definition XrdCmsPList.hh:49
~XrdCmsPInfo()
Definition XrdCmsPList.hh:61
int And(const SMask_t mask)
Definition XrdCmsPList.hh:51
SMask_t rovec
Definition XrdCmsPList.hh:47
SMask_t rwvec
Definition XrdCmsPList.hh:48
void Set(const XrdCmsPInfo *pi)
Definition XrdCmsPList.hh:57
void Or(const XrdCmsPInfo *pi)
Definition XrdCmsPList.hh:54
Definition XrdCmsPList.hh:96
void Remove(SMask_t mask)
XrdCmsPList * Zorch(XrdCmsPList *newlist=0)
Definition XrdCmsPList.hh:124
int NotEmpty()
Definition XrdCmsPList.hh:118
void Empty(XrdCmsPList *newlist=0)
Definition XrdCmsPList.hh:104
void UnLock()
Definition XrdCmsPList.hh:100
int Find(const char *pname, XrdCmsPInfo &masks)
void Lock()
Definition XrdCmsPList.hh:99
const char * Type(const char *pname)
int Add(const char *pname, XrdCmsPInfo *pinfo)
XrdSysMutex mutex
Definition XrdCmsPList.hh:138
XrdCmsPList_Anchor()
Definition XrdCmsPList.hh:132
SMask_t Insert(const char *pname, XrdCmsPInfo *pinfo)
~XrdCmsPList_Anchor()
Definition XrdCmsPList.hh:134
XrdCmsPList * next
Definition XrdCmsPList.hh:139
XrdCmsPList * First()
Definition XrdCmsPList.hh:114
Definition XrdCmsPList.hh:71
char * pathname
Definition XrdCmsPList.hh:89
XrdCmsPList(const char *pname="", XrdCmsPInfo *pi=0)
Definition XrdCmsPList.hh:79
XrdCmsPList * Next()
Definition XrdCmsPList.hh:75
XrdCmsPInfo pathmask
Definition XrdCmsPList.hh:87
char pathtype
Definition XrdCmsPList.hh:91
int pathlen
Definition XrdCmsPList.hh:90
XrdCmsPList * next
Definition XrdCmsPList.hh:88
const char * PType()
char * Path()
Definition XrdCmsPList.hh:76
~XrdCmsPList()
Definition XrdCmsPList.hh:83
char reserved[3]
Definition XrdCmsPList.hh:92
Definition XrdSysPthread.hh:165
void Lock()
Definition XrdSysPthread.hh:222
void UnLock()
Definition XrdSysPthread.hh:224