MCPcopy Create free account
hub / github.com/Singular/Singular / get

Method get

Singular/dyn_modules/pyobject/pyobject.cc:347–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345
346private:
347 PythonObject get(leftv value, int typeId)
348 {
349 if (typeId == PythonInterpreter::id()) return PythonCastStatic<>(value);
350
351 switch (typeId)
352 {
353 case INT_CMD: return PythonCastStatic<long>(value);
354 case STRING_CMD: return PythonCastStatic<const char*>(value);
355 case LIST_CMD: return PythonCastStatic<lists>(value);
356 case INTVEC_CMD: return PythonCastStatic<intvec*>(value);
357 }
358
359 sleftv tmp;
360 BOOLEAN newstruct_Assign_user(int, leftv, leftv); // declaring overloaded '='
361 if (!newstruct_Assign_user(PythonInterpreter::id(), &tmp, value))
362 return PythonCastStatic<>(&tmp);
363
364 if (typeId > MAX_TOK) // custom types
365 {
366 blackbox *bbx = getBlackboxStuff(typeId);
367 assume(bbx != NULL);
368 if (! bbx->blackbox_Op1(PythonInterpreter::id(), &tmp, value))
369 return PythonCastStatic<>(&tmp);
370 }
371
372 Werror("type '%s` incompatible with 'pyobject`", iiTwoOps(typeId));
373 return PythonObject();
374 }
375};
376
377template <class CastType>

Callers

nothing calls this directly

Calls 5

newstruct_Assign_userFunction · 0.85
getBlackboxStuffFunction · 0.85
WerrorFunction · 0.85
PythonObjectClass · 0.85
iiTwoOpsFunction · 0.50

Tested by

no test coverage detected