ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
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  {}

◆ ~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  }

◆ 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  }

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:
RootUtils::PyException
CPyCppyy::PyException PyException
Definition: Utility.h:24
SG::PyProxyDict::m_sgSvc
StoreGateSvc * m_sgSvc
Definition: SgPyDataModel.h:407
StdJOSetup.sgSvc
sgSvc
Definition: StdJOSetup.py:37
SG::PyProxyDict::proxy
PyObject * proxy(PyObject *pyclid, PyObject *pykey)
Definition: SgPyDataModel.h:417
klass
This class describe the base functionalities of a HypoTool used by the ComboAlg.
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
StoreGateSvc::proxy
virtual SG::DataProxy * proxy(const void *const pTransient) const override final
get proxy for a given data object address in memory
_SGPY_MSG
#define _SGPY_MSG(x)
Definition: SgPyMsg.h:22
RootUtils::PyGetString
std::pair< std::string, bool > PyGetString(PyObject *s)
Convert python string -> C++ string for py2 and py3.
Definition: PyGetString.h:40
python.PyAthena.obj
obj
Definition: PyAthena.py:135
SG::DataProxy
Definition: DataProxy.h:44
PyObject
_object PyObject
Definition: IPyComponent.h:26