CepGen 1.2.5
Central exclusive processes event generator
|
Smart pointer to a Python object and its dereferencing operator. More...
#include <CepGenAddOns/PythonWrapper/ObjectPtr.h>
Public Member Functions | |
ObjectPtr (PyObject *, bool wrap_only=false) | |
template<typename T > | |
bool | is () const |
Check if a Python object holds a given C++ type. | |
template<typename T > | |
T | value () const |
Cast a Python object into a C++ type. | |
template<typename T > | |
bool | isVector () const |
Check if a Python object is compatible with a vector of uniform objects. | |
template<typename T > | |
std::vector< T > | vector () const |
Retrieve a vector of objects, either from a Python list or tuple. | |
template<typename... Args> | |
ObjectPtr | operator() (Args &&... args) |
Call a python function with an uncounted set of arguments. | |
ObjectPtr | call (const ObjectPtr &) const |
Call a python function with a tuple of arguments. | |
ObjectPtr | attribute (const std::string &) const |
Retrieve the attribute from a python object. | |
template<> | |
bool | is () const |
template<> | |
bool | is () const |
template<> | |
bool | is () const |
template<> | |
bool | is () const |
template<> | |
bool | is () const |
template<> | |
bool | is () const |
template<> | |
bool | value () const |
template<> | |
int | value () const |
template<> | |
unsigned long | value () const |
template<> | |
long long | value () const |
template<> | |
double | value () const |
template<> | |
Limits | value () const |
template<> | |
ParametersList | value () const |
template<> | |
ObjectPtr | tupleFromVector (const std::vector< PyObject * > &vec) |
Static Public Member Functions | |
static ObjectPtr | wrap (PyObject *) |
Wrap a PyObject without cleaning at the destructor. | |
static ObjectPtr | importModule (const std::string &) |
Import a Python module in a new reference-counted Python object. | |
static ObjectPtr | defineModule (const std::string &, const std::string &) |
Define a Python module from a Python code in a new reference-counted Python object. | |
template<typename T > | |
static ObjectPtr | make (const T &) |
Build a new Python object from a C++ one. | |
template<typename T > | |
static ObjectPtr | make (const std::vector< T > &vec) |
Build a new Python list from a C++ STL vector. | |
template<typename T > | |
static ObjectPtr | tupleFromVector (const std::vector< T > &) |
Build a Python tuple from a (uniform) vector of objects. | |
template<typename... Args> | |
static ObjectPtr | tuple (const std::tuple< Args... > &c_tuple) |
Build a Python tuple from a C++ tuple. | |
template<> | |
ObjectPtr | make (PyObject *const &obj) |
template<> | |
ObjectPtr | make (const int &val) |
template<> | |
ObjectPtr | make (const bool &val) |
template<> | |
ObjectPtr | make (const double &val) |
template<> | |
ObjectPtr | make (const Limits &val) |
template<> | |
ObjectPtr | make (const ParametersList &plist) |
Friends | |
std::ostream & | operator<< (std::ostream &, const ObjectPtr &) |
Definition at line 36 of file ObjectPtr.h.
|
explicit |
Definition at line 42 of file ObjectPtr.cpp.
ObjectPtr attribute | ( | const std::string & | attr | ) | const |
Definition at line 368 of file ObjectPtr.cpp.
Definition at line 364 of file ObjectPtr.cpp.
|
static |
Definition at line 378 of file ObjectPtr.cpp.
|
static |
Definition at line 374 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 51 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 61 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 67 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 77 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 93 of file ObjectPtr.cpp.
bool is | ( | ) | const |
Definition at line 102 of file ObjectPtr.cpp.
bool is | ( | ) | const |
bool isVector |
Definition at line 108 of file ObjectPtr.cpp.
|
static |
Definition at line 276 of file ObjectPtr.cpp.
|
static |
Definition at line 281 of file ObjectPtr.cpp.
|
static |
Definition at line 267 of file ObjectPtr.cpp.
Definition at line 295 of file ObjectPtr.cpp.
|
static |
Definition at line 300 of file ObjectPtr.cpp.
|
static |
Definition at line 52 of file ObjectPtr.h.
|
static |
|
static |
Definition at line 262 of file ObjectPtr.cpp.
ObjectPtr operator() | ( | Args &&... | args | ) |
Definition at line 93 of file ObjectPtr.h.
|
static |
Definition at line 77 of file ObjectPtr.h.
ObjectPtr tupleFromVector | ( | const std::vector< PyObject * > & | vec | ) |
Definition at line 344 of file ObjectPtr.cpp.
|
static |
Definition at line 336 of file ObjectPtr.cpp.
bool value | ( | ) | const |
Definition at line 149 of file ObjectPtr.cpp.
int value | ( | ) | const |
Definition at line 155 of file ObjectPtr.cpp.
unsigned long value | ( | ) | const |
Definition at line 166 of file ObjectPtr.cpp.
long long value | ( | ) | const |
Definition at line 178 of file ObjectPtr.cpp.
double value | ( | ) | const |
Definition at line 185 of file ObjectPtr.cpp.
Limits value | ( | ) | const |
Definition at line 206 of file ObjectPtr.cpp.
ParametersList value | ( | ) | const |
Definition at line 216 of file ObjectPtr.cpp.
T value | ( | ) | const |
std::vector< T > vector |
Definition at line 130 of file ObjectPtr.cpp.
|
static |
Definition at line 45 of file ObjectPtr.cpp.
|
friend |
Definition at line 357 of file ObjectPtr.cpp.