Logo ROOT  
Reference Guide
PyStrings.cxx
Go to the documentation of this file.
1// Author: Wim Lavrijsen, Nov 2008
2
3// Bindings
4#include "PyROOT.h"
5#include "PyStrings.h"
6
7
8//- data _____________________________________________________________________
31
36
47
54
55
56////////////////////////////////////////////////////////////////////////////////
57
58#define PYROOT_INITIALIZE_STRING( var, str ) \
59 if ( ! ( PyStrings::var = PyROOT_PyUnicode_InternFromString( (char*)#str ) ) ) \
60 return kFALSE
61
63// Build cache of commonly used python strings (the cache is python intern, so
64// all strings are shared python-wide, not just in PyROOT).
65 PYROOT_INITIALIZE_STRING( gBases, __bases__ );
67 PYROOT_INITIALIZE_STRING( gClass, __class__ );
68 PYROOT_INITIALIZE_STRING( gCppEq, __cpp_eq__ );
69 PYROOT_INITIALIZE_STRING( gCppNe, __cpp_ne__ );
70 PYROOT_INITIALIZE_STRING( gDeref, __deref__ );
73 return kFALSE;
75 PYROOT_INITIALIZE_STRING( gFollow, __follow__ );
76 PYROOT_INITIALIZE_STRING( gGetItem, __getitem__ );
81 PYROOT_INITIALIZE_STRING( gModule, __module__ );
84 PYROOT_INITIALIZE_STRING( gCppName, __cppname__ );
88
93
103 PYROOT_INITIALIZE_STRING( gVectorAt, _vector__at );
104
108 PYROOT_INITIALIZE_STRING( gSetBranchAddress, SetBranchAddress );
110 PYROOT_INITIALIZE_STRING( gTClassDynCast, _TClass__DynamicCast );
111
112 return kTRUE;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116/// Remove all cached python strings.
117
119 Py_DECREF( PyStrings::gBases ); PyStrings::gBases = 0;
120 Py_DECREF( PyStrings::gBase ); PyStrings::gBase = 0;
121 Py_DECREF( PyStrings::gClass ); PyStrings::gClass = 0;
122 Py_DECREF( PyStrings::gCppEq ); PyStrings::gCppEq = 0;
123 Py_DECREF( PyStrings::gCppNe ); PyStrings::gCppNe = 0;
124 Py_DECREF( PyStrings::gDeref ); PyStrings::gDeref = 0;
125 Py_DECREF( PyStrings::gDict ); PyStrings::gDict = 0;
127 Py_DECREF( PyStrings::gEq ); PyStrings::gEq = 0;
128 Py_DECREF( PyStrings::gFollow ); PyStrings::gFollow = 0;
130 Py_DECREF( PyStrings::gInit ); PyStrings::gInit = 0;
131 Py_DECREF( PyStrings::gIter ); PyStrings::gIter = 0;
132 Py_DECREF( PyStrings::gLen ); PyStrings::gLen = 0;
134 Py_DECREF( PyStrings::gModule ); PyStrings::gModule = 0;
135 Py_DECREF( PyStrings::gMRO ); PyStrings::gMRO = 0;
136 Py_DECREF( PyStrings::gName ); PyStrings::gName = 0;
139 Py_DECREF( PyStrings::gNe ); PyStrings::gNe = 0;
141
142 Py_DECREF( PyStrings::gAdd ); PyStrings::gAdd = 0;
143 Py_DECREF( PyStrings::gSub ); PyStrings::gSub = 0;
144 Py_DECREF( PyStrings::gMul ); PyStrings::gMul = 0;
145 Py_DECREF( PyStrings::gDiv ); PyStrings::gDiv = 0;
146
147 Py_DECREF( PyStrings::gAt ); PyStrings::gAt = 0;
148 Py_DECREF( PyStrings::gBegin ); PyStrings::gBegin = 0;
149 Py_DECREF( PyStrings::gEnd ); PyStrings::gEnd = 0;
150 Py_DECREF( PyStrings::gFirst ); PyStrings::gFirst = 0;
151 Py_DECREF( PyStrings::gSecond ); PyStrings::gSecond = 0;
152 Py_DECREF( PyStrings::gSize ); PyStrings::gSize = 0;
157
158 Py_DECREF( PyStrings::gBranch ); PyStrings::gBranch = 0;
159 Py_DECREF( PyStrings::gFitFCN ); PyStrings::gFitFCN = 0;
160 Py_DECREF( PyStrings::gROOTns ); PyStrings::gROOTns = 0;
162 Py_DECREF( PyStrings::gSetFCN ); PyStrings::gSetFCN = 0;
164
165 Py_INCREF( Py_None );
166 return Py_None;
167}
#define PYROOT__div__
Definition: PyROOT.h:102
#define PyROOT_PyUnicode_FromString
Definition: PyROOT.h:82
#define PYROOT_INITIALIZE_STRING(var, str)
Definition: PyStrings.cxx:58
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
_object PyObject
Definition: TPyArg.h:20
R__EXTERN PyObject * gIter
Definition: PyStrings.h:28
R__EXTERN PyObject * gSetFCN
Definition: PyStrings.h:59
R__EXTERN PyObject * gSecond
Definition: PyStrings.h:48
R__EXTERN PyObject * gClass
Definition: PyStrings.h:18
R__EXTERN PyObject * gCppEq
Definition: PyStrings.h:19
R__EXTERN PyObject * gAt
Definition: PyStrings.h:44
R__EXTERN PyObject * gName
Definition: PyStrings.h:33
R__EXTERN PyObject * gEq
Definition: PyStrings.h:24
R__EXTERN PyObject * gBase
Definition: PyStrings.h:17
R__EXTERN PyObject * gSize
Definition: PyStrings.h:49
R__EXTERN PyObject * gAdd
Definition: PyStrings.h:39
R__EXTERN PyObject * gGetSize
Definition: PyStrings.h:50
R__EXTERN PyObject * gLifeLine
Definition: PyStrings.h:30
R__EXTERN PyObject * gDict
Definition: PyStrings.h:22
R__EXTERN PyObject * gCppNameNew
Definition: PyStrings.h:35
R__EXTERN PyObject * gLen
Definition: PyStrings.h:29
R__EXTERN PyObject * gMul
Definition: PyStrings.h:41
R__EXTERN PyObject * gEmptyString
Definition: PyStrings.h:23
R__EXTERN PyObject * gFitFCN
Definition: PyStrings.h:56
R__EXTERN PyObject * gROOTns
Definition: PyStrings.h:57
R__EXTERN PyObject * gNe
Definition: PyStrings.h:36
R__EXTERN PyObject * gTemplate
Definition: PyStrings.h:52
R__EXTERN PyObject * gModule
Definition: PyStrings.h:31
R__EXTERN PyObject * gBases
Definition: PyStrings.h:16
R__EXTERN PyObject * gTClassDynCast
Definition: PyStrings.h:60
R__EXTERN PyObject * gMRO
Definition: PyStrings.h:32
R__EXTERN PyObject * gGetItem
Definition: PyStrings.h:26
R__EXTERN PyObject * gBegin
Definition: PyStrings.h:45
R__EXTERN PyObject * gFollow
Definition: PyStrings.h:25
R__EXTERN PyObject * gDiv
Definition: PyStrings.h:42
R__EXTERN PyObject * gInit
Definition: PyStrings.h:27
R__EXTERN PyObject * gCppNe
Definition: PyStrings.h:20
R__EXTERN PyObject * gSub
Definition: PyStrings.h:40
R__EXTERN PyObject * gEnd
Definition: PyStrings.h:46
R__EXTERN PyObject * gTypeCode
Definition: PyStrings.h:37
R__EXTERN PyObject * gDeref
Definition: PyStrings.h:21
R__EXTERN PyObject * gFirst
Definition: PyStrings.h:47
R__EXTERN PyObject * gSetBranchAddress
Definition: PyStrings.h:58
R__EXTERN PyObject * gVectorAt
Definition: PyStrings.h:53
R__EXTERN PyObject * gCppName
Definition: PyStrings.h:34
R__EXTERN PyObject * ggetSize
Definition: PyStrings.h:51
R__EXTERN PyObject * gBranch
Definition: PyStrings.h:55
Bool_t CreatePyStrings()
Definition: PyStrings.cxx:62
PyObject * DestroyPyStrings()
Remove all cached python strings.
Definition: PyStrings.cxx:118
VSD Structures.
Definition: StringConv.hxx:21
static constexpr double second
Definition: first.py:1