ATLAS Offline Software
Loading...
Searching...
No Matches
SG::PyProxyDict Struct Reference

a python front-end to the IProxyDict interface PyProxyDict encapsulates getting python objects from the raw C++ ones ones gets from the C++ store. More...

#include <SgPyDataModel.h>

Collaboration diagram for SG::PyProxyDict:

Public Member Functions

 PyProxyDict (StoreGateSvc *sgSvc)
 ~PyProxyDict ()
PyObject * proxy (PyObject *pyclid, PyObject *pykey)
PyObject * newPyDataObject (const char *klass, void *addr=0)

Public Attributes

StoreGateSvc * m_sgSvc

Detailed Description

a python front-end to the IProxyDict interface PyProxyDict encapsulates getting python objects from the raw C++ ones ones gets from the C++ store.

Definition at line 391 of file SgPyDataModel.h.

Constructor & Destructor Documentation

◆ PyProxyDict()

SG::PyProxyDict::PyProxyDict ( StoreGateSvc * sgSvc)
inline

Definition at line 395 of file SgPyDataModel.h.

395 :
396 m_sgSvc( sgSvc )
397 {}
StoreGateSvc * m_sgSvc

◆ ~PyProxyDict()

SG::PyProxyDict::~PyProxyDict ( )
inline

Definition at line 399 of file SgPyDataModel.h.

400 {}

Member Function Documentation

◆ newPyDataObject()

PyObject * SG::PyProxyDict::newPyDataObject ( const char * klass,
void * addr = 0 )
inline

Definition at line 433 of file SgPyDataModel.h.

434 {
435 PyObject* obj = NULL;
436 if ( !(obj = TPython::CPPInstance_FromVoidPtr((void*)addr, klass)) ) {
437#ifdef ATLAS_HAVE_CPYCPPYY
438 throw CPyCppyy::PyException();
439#else
440 throw std::runtime_error ("Python exception");
441#endif // ATLAS_HAVE_CPYCPPYY
442 }
443 return obj;
444 }
_object PyObject

◆ proxy()

PyObject * SG::PyProxyDict::proxy ( PyObject * pyclid,
PyObject * pykey )
inline

Definition at line 403 of file SgPyDataModel.h.

404 {
405 _SGPY_MSG("PyProxyDict::proxy(...)...");
406
407 PyObject* pyproxy = NULL;
408
409 unsigned int id_tmp = 0;
410 if (!PyArg_Parse( pyclid, "I", &id_tmp )) {
411 return nullptr;
412 }
413
414 CLID id = id_tmp;
415 std::string skey;
416 if (pykey != Py_None) {
417 skey = RootUtils::PyGetString (pykey).first;
418 }
419 SG::DataProxy* proxy = skey.empty()
420 ? m_sgSvc->proxy(id)
421 : m_sgSvc->proxy(id, skey);
422 _SGPY_MSG("PyProxyDict::proxy("
423 << (proxy ? proxy->clID() : id) << ", "
424 << (proxy ? proxy->name() : skey) << ")...");
425 pyproxy = TPython::CPPInstance_FromVoidPtr((void*)proxy,
426 "SG::DataProxy");
427
428 _SGPY_MSG("PyProxyDict::proxy(...)... [done]");
429 return pyproxy;
430 }
uint32_t CLID
The Class ID type.
#define _SGPY_MSG(x)
Definition SgPyMsg.h:22
std::pair< std::string, bool > PyGetString(PyObject *s)
Convert python string -> C++ string for py2 and py3.
Definition PyGetString.h:40
PyObject * proxy(PyObject *pyclid, PyObject *pykey)

Member Data Documentation

◆ m_sgSvc

StoreGateSvc* SG::PyProxyDict::m_sgSvc

Definition at line 393 of file SgPyDataModel.h.


The documentation for this struct was generated from the following file: