psana_python::ProxyDictMethods Namespace Reference
[Psana_python]

Several methods interfacing ProxyDict methods with Python. More...


Functions

PyObjectkeys (PSEvt::ProxyDictI &proxyDict, PyObject *args)
 Return python list of keys from proxy dictionary.
std::vector< pytools::pyshared_ptrget_types (PyObject *arg0, const char *method)
std::pair< Pds::Src, std::string > arg_get_put (PyObject *args, bool needExact, const PSEvt::AliasMap *amap)
PyObjectget (PSEvt::ProxyDictI &proxyDict, PyObject *arg0, const PSEvt::Source &source, const std::string &key)
PyObjectget_compat_typeid (PSEvt::ProxyDictI &proxyDict, PyObject *arg0, PyObject *arg1)
PyObjectget_compat_string (PSEvt::ProxyDictI &proxyDict, PyObject *arg0)
PyObjectput (PSEvt::ProxyDictI &proxyDict, PyObject *arg0, const Pds::Src &source, const std::string &key)
PyObjectremove (PSEvt::ProxyDictI &proxyDict, PyObject *arg0, const Pds::Src &source, const std::string &key)


Detailed Description

Several methods interfacing ProxyDict methods with Python.

This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.

Version:
Id
ProxyDictMethods.h 8116 2014-05-01 17:17:21Z dubrovin@SLAC.STANFORD.EDU
Author:
Andy Salnikov


Function Documentation

PyObject * psana_python::ProxyDictMethods::keys ( PSEvt::ProxyDictI proxyDict,
PyObject args 
)

Return python list of keys from proxy dictionary.

In case of problem set error condition and returnz zero pointer

Parameters:
[in] proxyDict Dictionary instance
[in] args Python argument tuple passed to keys() method
Returns:
Either instance of list type (new reference) or zero pointer for errors.

Definition at line 49 of file ProxyDictMethods.cpp.

References plot_analyze::args, pytools::PyDataType< ConcreteType, CppType >::cppObject(), GUIAlignment::ex, ex_all_dets::i, PSEvt::ProxyDictI::keys(), pytools::PyDataType< ConcreteType, CppType >::Object_TypeCheck(), pytools::PyDataType< ConcreteType, CppType >::PyObject_FromCpp(), and ex_all_dets::src.

Referenced by BOOST_AUTO_TEST_CASE(), EnvObjectStore_keys(), Translator::TestModuleReadNDArrayString::event(), Translator::TestModuleNDArrayString::event(), PsanaModuleGetObjects::event(), ImgAlgos::CSPadCommonModeCorrection::event(), cspad_mod::CsPadCalib::event(), Event_keys(), psana_python::moduleFactory(), and TimeTool::Analyze::updateBeamStatusBasedOnIpm().

std::vector< pytools::pyshared_ptr > psana_python::ProxyDictMethods::get_types ( PyObject arg0,
const char *  method 
)

Returns the list types that are passed as a first argument to get() method. Not strictly a ProxyDict method, but shared between different classes which deal with ProxyDict. If argument is not good (not a type or not a list of types) then empty list is returned and Python exception is set.

Parameters:
[in] arg0 First argument to get() method
[out] method 
Returns:
Vector of Python objects

Definition at line 88 of file ProxyDictMethods.cpp.

References iter, and pytools::make_pyshared().

Referenced by get(), and remove().

std::pair< Pds::Src, std::string > psana_python::ProxyDictMethods::arg_get_put ( PyObject args,
bool  needExact,
const PSEvt::AliasMap amap 
)

Returns the Src and Key typically passed in arguments 1 & 2 to the get() or put() method. Not strictly a ProxyDict method, but shared between different classes which deal with ProxyDict. If both arguments are not present, returns NoSource and an empty string. If the first argument is a Pds::Src or PSEvt::Source, turns it into the appropriate Pds::Src - checking for an exact Src match if needExact is true. If the first argument is a string, again NoSource is returned and the key is this string.

Parameters:
[in] args arguments to the Python function
[in] needExact an exact Pds::Src is required, throws error if wildcard found in Source
[in] amap AliasMap to determine exact Pds::Src from alias
Returns:
pair with a Pds::Src and std::string

Definition at line 124 of file ProxyDictMethods.cpp.

References ex-ipython::amap, plot_analyze::args, pytools::PyDataType< ConcreteType, CppType >::cppObject(), PSEvt::Source::SrcMatch::isExact(), DCRange::key(), PSEvt::EventKey::noSource(), pytools::PyDataType< ConcreteType, CppType >::Object_TypeCheck(), expyda_andor_shape::source, PSEvt::Source::SrcMatch::src(), and ex_all_dets::src.

Referenced by EnvObjectStore_put(), Event_put(), and Event_remove().

PyObject * psana_python::ProxyDictMethods::get ( PSEvt::ProxyDictI proxyDict,
PyObject arg0,
const PSEvt::Source source,
const std::string &  key 
)

Implementation of the get method.

get(...) is very overloaded method, here is the list of possible argument combinations:

Returns:
New reference, 0 if error occurred.

Definition at line 227 of file ProxyDictMethods.cpp.

References PSEvt::ProxyDictI::get(), get_types(), psddl_python::ConverterMap::getToPyConverters(), SegGeometryCspad2x1V1::instance(), and expyda_andor_shape::source.

Referenced by EnvObjectStore_get(), and Event_get().

PyObject * psana_python::ProxyDictMethods::get_compat_typeid ( PSEvt::ProxyDictI proxyDict,
PyObject arg0,
PyObject arg1 
)

Implementation of pyana compatibility get() methods (deprecated):

Returns:
New reference, 0 if error occurred.

Definition at line 184 of file ProxyDictMethods.cpp.

References pytools::PyDataType< ConcreteType, CppType >::cppObject(), GUIAlignment::ex, psddl_python::ConverterMap::getFromPdsConverters(), SegGeometryCspad2x1V1::instance(), pytools::PyDataType< ConcreteType, CppType >::Object_TypeCheck(), and expyda_andor_shape::source.

Referenced by EnvObjectStore_get(), and Event_get().

PyObject * psana_python::ProxyDictMethods::get_compat_string ( PSEvt::ProxyDictI proxyDict,
PyObject arg0 
)

Implementation of pyana compatibility get() methods (deprecated):

Returns:
New reference, 0 if error occurred.

Definition at line 163 of file ProxyDictMethods.cpp.

References PSEvt::ProxyDictI::get(), DCRange::key(), and PSEvt::Source::null.

Referenced by Event_get().

PyObject * psana_python::ProxyDictMethods::put ( PSEvt::ProxyDictI proxyDict,
PyObject arg0,
const Pds::Src &  source,
const std::string &  key 
)

Add Python object to event, convert to C++ if possible. If it fails an exception is raised and zero pointer is returned, but may also throw C++ exception.

Definition at line 276 of file ProxyDictMethods.cpp.

References psddl_python::ConverterMap::getFromPyConverters(), SegGeometryCspad2x1V1::instance(), pytools::make_pyshared(), PSEvt::ProxyDictI::put(), and PSEvt::ProxyDictI::remove().

Referenced by EnvObjectStore_put(), and Event_put().

PyObject * psana_python::ProxyDictMethods::remove ( PSEvt::ProxyDictI proxyDict,
PyObject arg0,
const Pds::Src &  source,
const std::string &  key 
)

Remove object from event. If it fails an exception is raised and zero pointer is returned, but may also throw C++ exception.

Definition at line 324 of file ProxyDictMethods.cpp.

References get_types(), psddl_python::ConverterMap::getToPyConverters(), SegGeometryCspad2x1V1::instance(), and PSEvt::ProxyDictI::remove().

Referenced by Event_remove(), and TestFile::~TestFile().


Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7