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 408 of file SgPyDataModel.h.

Constructor & Destructor Documentation

◆ PyProxyDict()

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

Definition at line 412 of file SgPyDataModel.h.

412 :
413 m_sgSvc( sgSvc )
414 {}
StoreGateSvc * m_sgSvc

◆ ~PyProxyDict()

SG::PyProxyDict::~PyProxyDict ( )
inline

Definition at line 416 of file SgPyDataModel.h.

417 {}

Member Function Documentation

◆ newPyDataObject()

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

Definition at line 450 of file SgPyDataModel.h.

451 {
452 PyObject* obj = NULL;
453 if ( !(obj = TPython::CPPInstance_FromVoidPtr((void*)addr, klass)) ) {
454#ifdef ATLAS_HAVE_CPYCPPYY
455 throw CPyCppyy::PyException();
456#else
457 throw std::runtime_error ("Python exception");
458#endif // ATLAS_HAVE_CPYCPPYY
459 }
460 return obj;
461 }
_object PyObject

◆ proxy()

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

Definition at line 420 of file SgPyDataModel.h.

421 {
422 _SGPY_MSG("PyProxyDict::proxy(...)...");
423
424 PyObject* pyproxy = NULL;
425
426 unsigned int id_tmp = 0;
427 if (!PyArg_Parse( pyclid, "I", &id_tmp )) {
428 return nullptr;
429 }
430
431 CLID id = id_tmp;
432 std::string skey;
433 if (pykey != Py_None) {
434 skey = RootUtils::PyGetString (pykey).first;
435 }
436 SG::DataProxy* proxy = skey.empty()
437 ? m_sgSvc->proxy(id)
438 : m_sgSvc->proxy(id, skey);
439 _SGPY_MSG("PyProxyDict::proxy("
440 << (proxy ? proxy->clID() : id) << ", "
441 << (proxy ? proxy->name() : skey) << ")...");
442 pyproxy = TPython::CPPInstance_FromVoidPtr((void*)proxy,
443 "SG::DataProxy");
444
445 _SGPY_MSG("PyProxyDict::proxy(...)... [done]");
446 return pyproxy;
447 }
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 410 of file SgPyDataModel.h.


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