Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
PyStrings.cxx
Go to the documentation of this file.
1// Bindings
2#include "CPyCppyy.h"
3#include "PyStrings.h"
4
5
6//- data _____________________________________________________________________
40
43
48
51
63
66
68
71
74
78
79
80//-----------------------------------------------------------------------------
81#define CPPYY_INITIALIZE_STRING(var, str) \
82 if (!(PyStrings::var = CPyCppyy_PyText_InternFromString((char*)#str))) \
83 return false
84
86// Build cache of commonly used python strings (the cache is python intern, so
87// all strings are shared python-wide, not just in cppyy).
91 CPPYY_INITIALIZE_STRING(gCopy, copy);
92#if PY_VERSION_HEX < 0x03000000
94#else
96#endif
105 if (!(PyStrings::gEmptyString = CPyCppyy_PyText_FromString((char*)"")))
106 return false;
112 CPPYY_INITIALIZE_STRING(gInit, __init__);
125 CPPYY_INITIALIZE_STRING(gCTypesType, _type_);
126
129
134
137
139 CPPYY_INITIALIZE_STRING(gBegin, begin);
140 CPPYY_INITIALIZE_STRING(gEnd, end);
141 CPPYY_INITIALIZE_STRING(gFirst, first);
142 CPPYY_INITIALIZE_STRING(gSecond, second);
144 CPPYY_INITIALIZE_STRING(gTemplate, Template);
146 CPPYY_INITIALIZE_STRING(gInsert, insert);
147 CPPYY_INITIALIZE_STRING(gValueType, value_type);
149
152
154
157
160
164
165 return true;
166}
167
168
169//-----------------------------------------------------------------------------
171// Remove all cached python strings.
172 Py_DECREF(PyStrings::gBases); PyStrings::gBases = nullptr;
173 Py_DECREF(PyStrings::gBase); PyStrings::gBase = nullptr;
174 Py_DECREF(PyStrings::gCopy); PyStrings::gCopy = nullptr;
175 Py_DECREF(PyStrings::gCppBool); PyStrings::gCppBool = nullptr;
176 Py_DECREF(PyStrings::gCppName); PyStrings::gCppName = nullptr;
177 Py_DECREF(PyStrings::gAnnotations); PyStrings::gAnnotations = nullptr;
178 Py_DECREF(PyStrings::gCType); PyStrings::gCType = nullptr;
179 Py_DECREF(PyStrings::gDeref); PyStrings::gDeref = nullptr;
180 Py_DECREF(PyStrings::gPreInc); PyStrings::gPreInc = nullptr;
181 Py_DECREF(PyStrings::gPostInc); PyStrings::gPostInc = nullptr;
182 Py_DECREF(PyStrings::gDict); PyStrings::gDict = nullptr;
183 Py_DECREF(PyStrings::gEmptyString); PyStrings::gEmptyString = nullptr;
184 Py_DECREF(PyStrings::gEq); PyStrings::gEq = nullptr;
185 Py_DECREF(PyStrings::gFollow); PyStrings::gFollow = nullptr;
186 Py_DECREF(PyStrings::gGetItem); PyStrings::gGetItem = nullptr;
187 Py_DECREF(PyStrings::gGetNoCheck); PyStrings::gGetNoCheck = nullptr;
188 Py_DECREF(PyStrings::gSetItem); PyStrings::gSetItem = nullptr;
189 Py_DECREF(PyStrings::gInit); PyStrings::gInit = nullptr;
190 Py_DECREF(PyStrings::gIter); PyStrings::gIter = nullptr;
191 Py_DECREF(PyStrings::gLen); PyStrings::gLen = nullptr;
192 Py_DECREF(PyStrings::gLifeLine); PyStrings::gLifeLine = nullptr;
193 Py_DECREF(PyStrings::gModule); PyStrings::gModule = nullptr;
194 Py_DECREF(PyStrings::gMRO); PyStrings::gMRO = nullptr;
195 Py_DECREF(PyStrings::gName); PyStrings::gName = nullptr;
196 Py_DECREF(PyStrings::gNe); PyStrings::gNe = nullptr;
197 Py_DECREF(PyStrings::gTypeCode); PyStrings::gTypeCode = nullptr;
198 Py_DECREF(PyStrings::gCTypesType); PyStrings::gCTypesType = nullptr;
199
200 Py_DECREF(PyStrings::gUnderlying); PyStrings::gUnderlying = nullptr;
201 Py_DECREF(PyStrings::gRealInit); PyStrings::gRealInit = nullptr;
202
203 Py_DECREF(PyStrings::gAdd); PyStrings::gAdd = nullptr;
204 Py_DECREF(PyStrings::gSub); PyStrings::gSub = nullptr;
205 Py_DECREF(PyStrings::gMul); PyStrings::gMul = nullptr;
206 Py_DECREF(PyStrings::gDiv); PyStrings::gDiv = nullptr;
207
208 Py_DECREF(PyStrings::gLShift); PyStrings::gLShift = nullptr;
209 Py_DECREF(PyStrings::gLShiftC); PyStrings::gLShiftC = nullptr;
210
211 Py_DECREF(PyStrings::gAt); PyStrings::gAt = nullptr;
212 Py_DECREF(PyStrings::gBegin); PyStrings::gBegin = nullptr;
213 Py_DECREF(PyStrings::gEnd); PyStrings::gEnd = nullptr;
214 Py_DECREF(PyStrings::gFirst); PyStrings::gFirst = nullptr;
215 Py_DECREF(PyStrings::gSecond); PyStrings::gSecond = nullptr;
216 Py_DECREF(PyStrings::gSize); PyStrings::gSize = nullptr;
217 Py_DECREF(PyStrings::gTemplate); PyStrings::gTemplate = nullptr;
218 Py_DECREF(PyStrings::gVectorAt); PyStrings::gVectorAt = nullptr;
219 Py_DECREF(PyStrings::gInsert); PyStrings::gInsert = nullptr;
220 Py_DECREF(PyStrings::gValueType); PyStrings::gValueType = nullptr;
221 Py_DECREF(PyStrings::gValueSize); PyStrings::gValueSize = nullptr;
222
223 Py_DECREF(PyStrings::gCppReal); PyStrings::gCppReal = nullptr;
224 Py_DECREF(PyStrings::gCppImag); PyStrings::gCppImag = nullptr;
225
226 Py_DECREF(PyStrings::gThisModule); PyStrings::gThisModule = nullptr;
227
228 Py_DECREF(PyStrings::gDispInit); PyStrings::gDispInit = nullptr;
229 Py_DECREF(PyStrings::gDispGet); PyStrings::gDispGet = nullptr;
230
231 Py_DECREF(PyStrings::gExPythonize); PyStrings::gExPythonize = nullptr;
232 Py_DECREF(PyStrings::gPythonize); PyStrings::gPythonize = nullptr;
233
234 Py_DECREF(PyStrings::gArray); PyStrings::gArray = nullptr;
235 Py_DECREF(PyStrings::gDType); PyStrings::gDType = nullptr;
236 Py_DECREF(PyStrings::gFromBuffer); PyStrings::gFromBuffer = nullptr;
237
239}
#define CPPYY__div__
Definition CPyCppyy.h:111
#define Py_RETURN_NONE
Definition CPyCppyy.h:268
#define CPyCppyy_PyText_FromString
Definition CPyCppyy.h:81
_object PyObject
#define CPPYY_INITIALIZE_STRING(var, str)
Definition PyStrings.cxx:81
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
PyObject * gCTypesType
Definition PyStrings.cxx:39
PyObject * gDispGet
Definition PyStrings.cxx:70
PyObject * gCastCpp
Definition PyStrings.cxx:14
PyObject * gAssign
Definition PyStrings.cxx:7
PyObject * gRealInit
Definition PyStrings.cxx:42
PyObject * gExPythonize
Definition PyStrings.cxx:72
PyObject * gLifeLine
Definition PyStrings.cxx:29
PyObject * gGetItem
Definition PyStrings.cxx:23
PyObject * gThisModule
Definition PyStrings.cxx:67
PyObject * gCppBool
Definition PyStrings.cxx:11
PyObject * gCppName
Definition PyStrings.cxx:12
PyObject * gFromBuffer
Definition PyStrings.cxx:77
PyObject * gCppReal
Definition PyStrings.cxx:64
PyObject * gVectorAt
Definition PyStrings.cxx:59
PyObject * gLShiftC
Definition PyStrings.cxx:50
PyObject * gPythonize
Definition PyStrings.cxx:73
PyObject * gTypeCode
Definition PyStrings.cxx:38
PyObject * gPostInc
Definition PyStrings.cxx:18
PyObject * gCppImag
Definition PyStrings.cxx:65
PyObject * gBases
Definition PyStrings.cxx:8
PyObject * gValueSize
Definition PyStrings.cxx:62
PyObject * gTemplate
Definition PyStrings.cxx:58
PyObject * gAnnotations
Definition PyStrings.cxx:13
PyObject * gDispInit
Definition PyStrings.cxx:69
PyObject * gEmptyString
Definition PyStrings.cxx:20
PyObject * gSetItem
Definition PyStrings.cxx:25
PyObject * gUnderlying
Definition PyStrings.cxx:41
PyObject * gGetNoCheck
Definition PyStrings.cxx:24
PyObject * gCppRepr
Definition PyStrings.cxx:35
PyObject * gValueType
Definition PyStrings.cxx:61
PyObject * DestroyPyStrings()
bool CreatePyStrings()
Definition PyStrings.cxx:85
PyObject * gThisModule
Definition CPPMethod.cxx:30