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 ()
PyObjectproxy (PyObject *pyclid, PyObject *pykey)
PyObjectnewPyDataObject (const char *klass, void *addr=0)

Public Attributes

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

Constructor & Destructor Documentation

◆ PyProxyDict()

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

Definition at line 409 of file SgPyDataModel.h.

409 :
410 m_sgSvc( sgSvc )
411 {}
StoreGateSvc * m_sgSvc

◆ ~PyProxyDict()

SG::PyProxyDict::~PyProxyDict ( )
inline

Definition at line 413 of file SgPyDataModel.h.

414 {}

Member Function Documentation

◆ newPyDataObject()

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

Definition at line 447 of file SgPyDataModel.h.

448 {
449 PyObject* obj = NULL;
450 if ( !(obj = TPython::CPPInstance_FromVoidPtr((void*)addr, klass)) ) {
451 throw CPyCppyy::PyException();
452 }
453 return obj;
454 }
_object PyObject

◆ proxy()

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

Definition at line 417 of file SgPyDataModel.h.

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


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