MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / getInt

Method getInt

SRC/interpreter/PythonModule.cpp:136–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136int
137PythonModule::getInt(int *data, int numArgs) {
138 if ((wrapper.getNumberArgs() - wrapper.getCurrentArg()) < numArgs) {
139 return -1;
140 }
141
142 for (int i = 0; i < numArgs; i++) {
143 PyObject *o = PyTuple_GetItem(wrapper.getCurrentArgv(), wrapper.getCurrentArg());
144 wrapper.incrCurrentArg();
145 if (PyLong_Check(o) || PyFloat_Check(o) || PyBool_Check(o)) {
146 PyErr_Clear();
147 data[i] = PyLong_AsLong(o);
148 if (PyErr_Occurred()) {
149 return -1;
150 }
151 } else {
152 return -1;
153 }
154 }
155
156 return 0;
157}
158
159int
160PythonModule::getDouble(double *data, int numArgs) {

Callers 1

OPS_GetIntInputFunction · 0.45

Calls 4

getNumberArgsMethod · 0.45
getCurrentArgMethod · 0.45
getCurrentArgvMethod · 0.45
incrCurrentArgMethod · 0.45

Tested by

no test coverage detected