Logo ROOT   6.18/05
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 _____________________________________________________________________
30
35
46
53
54
55////////////////////////////////////////////////////////////////////////////////
56
57#define PYROOT_INITIALIZE_STRING( var, str ) \
58 if ( ! ( PyStrings::var = PyROOT_PyUnicode_InternFromString( (char*)#str ) ) ) \
59 return kFALSE
60
62// Build cache of commonly used python strings (the cache is python intern, so
63// all strings are shared python-wide, not just in PyROOT).
64 PYROOT_INITIALIZE_STRING( gBases, __bases__ );
66 PYROOT_INITIALIZE_STRING( gClass, __class__ );
67 PYROOT_INITIALIZE_STRING( gCppEq, __cpp_eq__ );
68 PYROOT_INITIALIZE_STRING( gCppNe, __cpp_ne__ );
69 PYROOT_INITIALIZE_STRING( gDeref, __deref__ );
72 return kFALSE;
74 PYROOT_INITIALIZE_STRING( gFollow, __follow__ );
75 PYROOT_INITIALIZE_STRING( gGetItem, __getitem__ );
80 PYROOT_INITIALIZE_STRING( gModule, __module__ );
83 PYROOT_INITIALIZE_STRING( gCppName, __cppname__ );
86
91
101 PYROOT_INITIALIZE_STRING( gVectorAt, _vector__at );
102
106 PYROOT_INITIALIZE_STRING( gSetBranchAddress, SetBranchAddress );
108 PYROOT_INITIALIZE_STRING( gTClassDynCast, _TClass__DynamicCast );
109
110 return kTRUE;
111}
112
113////////////////////////////////////////////////////////////////////////////////
114/// Remove all cached python strings.
115
117 Py_DECREF( PyStrings::gBases ); PyStrings::gBases = 0;
118 Py_DECREF( PyStrings::gBase ); PyStrings::gBase = 0;
119 Py_DECREF( PyStrings::gClass ); PyStrings::gClass = 0;
120 Py_DECREF( PyStrings::gCppEq ); PyStrings::gCppEq = 0;
121 Py_DECREF( PyStrings::gCppNe ); PyStrings::gCppNe = 0;
122 Py_DECREF( PyStrings::gDeref ); PyStrings::gDeref = 0;
123 Py_DECREF( PyStrings::gDict ); PyStrings::gDict = 0;
125 Py_DECREF( PyStrings::gEq ); PyStrings::gEq = 0;
126 Py_DECREF( PyStrings::gFollow ); PyStrings::gFollow = 0;
128 Py_DECREF( PyStrings::gInit ); PyStrings::gInit = 0;
129 Py_DECREF( PyStrings::gIter ); PyStrings::gIter = 0;
130 Py_DECREF( PyStrings::gLen ); PyStrings::gLen = 0;
132 Py_DECREF( PyStrings::gModule ); PyStrings::gModule = 0;
133 Py_DECREF( PyStrings::gMRO ); PyStrings::gMRO = 0;
134 Py_DECREF( PyStrings::gName ); PyStrings::gName = 0;
136 Py_DECREF( PyStrings::gNe ); PyStrings::gNe = 0;
138
139 Py_DECREF( PyStrings::gAdd ); PyStrings::gAdd = 0;
140 Py_DECREF( PyStrings::gSub ); PyStrings::gSub = 0;
141 Py_DECREF( PyStrings::gMul ); PyStrings::gMul = 0;
142 Py_DECREF( PyStrings::gDiv ); PyStrings::gDiv = 0;
143
144 Py_DECREF( PyStrings::gAt ); PyStrings::gAt = 0;
145 Py_DECREF( PyStrings::gBegin ); PyStrings::gBegin = 0;
146 Py_DECREF( PyStrings::gEnd ); PyStrings::gEnd = 0;
147 Py_DECREF( PyStrings::gFirst ); PyStrings::gFirst = 0;
148 Py_DECREF( PyStrings::gSecond ); PyStrings::gSecond = 0;
149 Py_DECREF( PyStrings::gSize ); PyStrings::gSize = 0;
154
155 Py_DECREF( PyStrings::gBranch ); PyStrings::gBranch = 0;
156 Py_DECREF( PyStrings::gFitFCN ); PyStrings::gFitFCN = 0;
157 Py_DECREF( PyStrings::gROOTns ); PyStrings::gROOTns = 0;
159 Py_DECREF( PyStrings::gSetFCN ); PyStrings::gSetFCN = 0;
161
162 Py_INCREF( Py_None );
163 return Py_None;
164}
#define PYROOT__div__
Definition: PyROOT.h:102
#define PyROOT_PyUnicode_FromString
Definition: PyROOT.h:82
#define PYROOT_INITIALIZE_STRING(var, str)
Definition: PyStrings.cxx:57
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:58
R__EXTERN PyObject * gSecond
Definition: PyStrings.h:47
R__EXTERN PyObject * gClass
Definition: PyStrings.h:18
R__EXTERN PyObject * gCppEq
Definition: PyStrings.h:19
R__EXTERN PyObject * gAt
Definition: PyStrings.h:43
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:48
R__EXTERN PyObject * gAdd
Definition: PyStrings.h:38
R__EXTERN PyObject * gGetSize
Definition: PyStrings.h:49
R__EXTERN PyObject * gLifeLine
Definition: PyStrings.h:30
R__EXTERN PyObject * gDict
Definition: PyStrings.h:22
R__EXTERN PyObject * gLen
Definition: PyStrings.h:29
R__EXTERN PyObject * gMul
Definition: PyStrings.h:40
R__EXTERN PyObject * gEmptyString
Definition: PyStrings.h:23
R__EXTERN PyObject * gFitFCN
Definition: PyStrings.h:55
R__EXTERN PyObject * gROOTns
Definition: PyStrings.h:56
R__EXTERN PyObject * gNe
Definition: PyStrings.h:35
R__EXTERN PyObject * gTemplate
Definition: PyStrings.h:51
R__EXTERN PyObject * gModule
Definition: PyStrings.h:31
R__EXTERN PyObject * gBases
Definition: PyStrings.h:16
R__EXTERN PyObject * gTClassDynCast
Definition: PyStrings.h:59
R__EXTERN PyObject * gMRO
Definition: PyStrings.h:32
R__EXTERN PyObject * gGetItem
Definition: PyStrings.h:26
R__EXTERN PyObject * gBegin
Definition: PyStrings.h:44
R__EXTERN PyObject * gFollow
Definition: PyStrings.h:25
R__EXTERN PyObject * gDiv
Definition: PyStrings.h:41
R__EXTERN PyObject * gInit
Definition: PyStrings.h:27
R__EXTERN PyObject * gCppNe
Definition: PyStrings.h:20
R__EXTERN PyObject * gSub
Definition: PyStrings.h:39
R__EXTERN PyObject * gEnd
Definition: PyStrings.h:45
R__EXTERN PyObject * gTypeCode
Definition: PyStrings.h:36
R__EXTERN PyObject * gDeref
Definition: PyStrings.h:21
R__EXTERN PyObject * gFirst
Definition: PyStrings.h:46
R__EXTERN PyObject * gSetBranchAddress
Definition: PyStrings.h:57
R__EXTERN PyObject * gVectorAt
Definition: PyStrings.h:52
R__EXTERN PyObject * gCppName
Definition: PyStrings.h:34
R__EXTERN PyObject * ggetSize
Definition: PyStrings.h:50
R__EXTERN PyObject * gBranch
Definition: PyStrings.h:54
Bool_t CreatePyStrings()
Definition: PyStrings.cxx:61
PyObject * DestroyPyStrings()
Remove all cached python strings.
Definition: PyStrings.cxx:116
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
static constexpr double second
Definition: first.py:1