FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
xrootd/python/src/PyXRootDEnv.hh at master · cern-eos/xrootd · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
cern-eos
/
xrootd
Public
forked from
xrootd/xrootd
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
xrootd
/
python
/
src
/
PyXRootDEnv.hh
Copy path
More file actions
More file actions
Latest commit
History
History
History
202 lines (174 loc) · 7.04 KB
Breadcrumbs
xrootd
/
python
/
src
/
PyXRootDEnv.hh
Copy path
File metadata and controls
202 lines (174 loc) · 7.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//
------------------------------------------------------------------------------
//
Copyright (c) 2012-2013 by European Organization for Nuclear Research (CERN)
//
Author: Michal Simon <michal.simon@cern.ch>
//
------------------------------------------------------------------------------
//
This file is part of the XRootD software suite.
//
//
XRootD is free software: you can redistribute it and/or modify
//
it under the terms of the GNU Lesser General Public License as published by
//
the Free Software Foundation, either version 3 of the License, or
//
(at your option) any later version.
//
//
XRootD is distributed in the hope that it will be useful,
//
but WITHOUT ANY WARRANTY; without even the implied warranty of
//
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//
GNU General Public License for more details.
//
//
You should have received a copy of the GNU Lesser General Public License
//
along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//
//
In applying this licence, CERN does not waive the privileges and immunities
//
granted to it by virtue of its status as an Intergovernmental Organization
//
or submit itself to any jurisdiction.
//
------------------------------------------------------------------------------
#
ifndef
PYXROOTDENV_HH_
#
define
PYXROOTDENV_HH_
#
include
"
PyXRootD.hh
"
#
include
"
XrdCl/XrdClDefaultEnv.hh
"
#
include
"
XrdVersion.hh
"
namespace
PyXRootD
{
//
----------------------------------------------------------------------------
//
! Sets the given key in the xrootd client environment to the given value.
//
! @return : false if there is already a shell-imported setting for this key,
//
true otherwise
//
----------------------------------------------------------------------------
PyObject*
EnvPutString_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
, *value =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
ss
"
, &key, &value ) )
{
return
NULL
;
}
return
PyBool_FromLong
(
XrdCl::DefaultEnv::GetEnv
()->
PutString
( key, value ) );
}
//
----------------------------------------------------------------------------
//
! Gets the given key from the xrootd client environment. If key does not
//
! exist in the environment returns None.
//
----------------------------------------------------------------------------
PyObject*
EnvGetString_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
s
"
, &key) )
{
return
NULL
;
}
std::string value;
if
( !
XrdCl::DefaultEnv::GetEnv
()->
GetString
( key, value ) )
Py_RETURN_NONE;
return
Py_BuildValue
(
"
s
"
, value.
c_str
() );
}
//
----------------------------------------------------------------------------
//
! Deletes the given key from the xrootd client string environment.
//
! @return : false if there is a shell-imported setting for this key,
//
! true otherwise
//
----------------------------------------------------------------------------
PyObject*
EnvDelString_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
s
"
, &key ) )
{
return
NULL
;
}
return
PyBool_FromLong
(
XrdCl::DefaultEnv::GetEnv
()->
DelString
( key ) );
}
//
----------------------------------------------------------------------------
//
! Sets the given key in the xrootd client environment to the given value.
//
! @return : false if there is already a shell-imported setting for this key,
//
true otherwise
//
----------------------------------------------------------------------------
PyObject*
EnvPutInt_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
int
value =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
si
"
, &key, &value ) )
{
return
NULL
;
}
return
PyBool_FromLong
(
XrdCl::DefaultEnv::GetEnv
()->
PutInt
( key, value ) );
}
//
----------------------------------------------------------------------------
//
! Gets the given key from the xrootd client environment. If key does not
//
! exist in the environment returns None.
//
----------------------------------------------------------------------------
PyObject*
EnvGetInt_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
s
"
, &key) )
{
return
NULL
;
}
int
value =
0
;
if
( !
XrdCl::DefaultEnv::GetEnv
()->
GetInt
( key, value ) )
Py_RETURN_NONE;
return
Py_BuildValue
(
"
i
"
, value );
}
//
----------------------------------------------------------------------------
//
! Deletes the given key from the xrootd client integer environment.
//
! @return : false if there is a shell-imported setting for this key,
//
! true otherwise
//
----------------------------------------------------------------------------
PyObject*
EnvDelInt_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
s
"
, &key ) )
{
return
NULL
;
}
return
PyBool_FromLong
(
XrdCl::DefaultEnv::GetEnv
()->
DelInt
( key ) );
}
//
----------------------------------------------------------------------------
//
! Gets default parameter value for given key
//
----------------------------------------------------------------------------
PyObject*
EnvGetDefault_cpp
( PyObject *self, PyObject *args )
{
char
*key =
0
;
//
parse arguments
if
( !
PyArg_ParseTuple
( args,
"
s
"
, &key) )
{
return
NULL
;
}
std::string value;
if
(
XrdCl::DefaultEnv::GetEnv
()->
GetDefaultStringValue
( key, value ) )
return
Py_BuildValue
(
"
s
"
, value.
c_str
() );
int
val;
if
(
XrdCl::DefaultEnv::GetEnv
()->
GetDefaultIntValue
( key, val ) )
return
Py_BuildValue
(
"
s
"
,
std::to_string
( val ).
c_str
() );
Py_RETURN_NONE;
}
//
----------------------------------------------------------------------------
//
! @return : client version, e.g.: v4.10.0
//
----------------------------------------------------------------------------
PyObject*
XrdVersion_cpp
( PyObject *self, PyObject *args )
{
static
std::string
verstr
( XrdVERSION[
0
] ==
'
v
'
? &XrdVERSION[
1
] : XrdVERSION );
return
Py_BuildValue
(
"
s
"
, verstr.
c_str
() );
}
//
----------------------------------------------------------------------------
//
! Sets the XRootD client log level to the given value.
//
----------------------------------------------------------------------------
PyObject*
SetLogLevel_cpp
(PyObject *self, PyObject *args)
{
char
*value =
nullptr
;
if
(
PyArg_ParseTuple
(args,
"
s
"
, &value))
XrdCl::DefaultEnv::SetLogLevel
(value);
Py_RETURN_NONE;
}
//
----------------------------------------------------------------------------
//
! Sets the XRootD client log mask of the given level to the given value.
//
----------------------------------------------------------------------------
PyObject*
SetLogMask_cpp
(PyObject *self, PyObject *args)
{
char
*level =
nullptr
, *value =
nullptr
;
if
(
PyArg_ParseTuple
(args,
"
ss
"
, &level, &value))
XrdCl::DefaultEnv::SetLogMask
(level, value);
Py_RETURN_NONE;
}
}
#
endif
/*
PYENV_HH_
*/
Back
|
FazBrowse Home
|
New Git URL