\rst A mixin class which adds common functions to handle
, object
and various accessors.
More...
#include </builds/ipbus/ipbus-software/uhal/python/pybind11-python2/include/pybind11/pytypes.h>
Public Member Functions | |
iterator | begin () const |
\rst Return an iterator equivalent to calling iter() in Python. More... | |
iterator | end () const |
Return a sentinel which ends iteration. More... | |
item_accessor | operator[] (handle key) const |
\rst Return an internal functor to invoke the object's sequence protocol. More... | |
item_accessor | operator[] (const char *key) const |
See above (the only difference is that they key is provided as a string literal) More... | |
obj_attr_accessor | attr (handle key) const |
\rst Return an internal functor to access the object's attributes. More... | |
str_attr_accessor | attr (const char *key) const |
See above (the only difference is that they key is provided as a string literal) More... | |
args_proxy | operator* () const |
\rst Matches * unpacking in Python, e.g. More... | |
template<typename T > | |
bool | contains (T &&item) const |
Check if the given item is contained within this object, i.e. item in obj . More... | |
template<return_value_policy policy = return_value_policy::automatic_reference, typename... Args> | |
object | operator() (Args &&...args) const |
\rst Assuming the Python object is a function or implements the __call__ protocol, operator() invokes the underlying function, passing an arbitrary set of parameters. More... | |
template<return_value_policy policy = return_value_policy::automatic_reference, typename... Args> | |
PYBIND11_DEPRECATED ("call(...) was deprecated in favor of operator()(...)") object call(Args &&...args) const | |
bool | is (object_api const &other) const |
Equivalent to obj is other in Python. More... | |
bool | is_none () const |
Equivalent to obj is None in Python. More... | |
bool | equal (object_api const &other) const |
Equivalent to obj == other in Python. More... | |
bool | not_equal (object_api const &other) const |
bool | operator< (object_api const &other) const |
bool | operator<= (object_api const &other) const |
bool | operator> (object_api const &other) const |
bool | operator>= (object_api const &other) const |
object | operator- () const |
object | operator~ () const |
object | operator+ (object_api const &other) const |
object | operator+= (object_api const &other) const |
object | operator- (object_api const &other) const |
object | operator-= (object_api const &other) const |
object | operator* (object_api const &other) const |
object | operator*= (object_api const &other) const |
object | operator/ (object_api const &other) const |
object | operator/= (object_api const &other) const |
object | operator| (object_api const &other) const |
object | operator|= (object_api const &other) const |
object | operator& (object_api const &other) const |
object | operator&= (object_api const &other) const |
object | operator^ (object_api const &other) const |
object | operator^= (object_api const &other) const |
object | operator<< (object_api const &other) const |
object | operator<<= (object_api const &other) const |
object | operator>> (object_api const &other) const |
object | operator>>= (object_api const &other) const |
pybind11::str | str () const |
str_attr_accessor | doc () const |
Get or set the object's docstring, i.e. obj.__doc__ . More... | |
int | ref_count () const |
Return the object's current reference count. More... | |
handle | get_type () const |
iterator | begin () const |
\rst Return an iterator equivalent to calling iter() in Python. More... | |
iterator | end () const |
Return a sentinel which ends iteration. More... | |
item_accessor | operator[] (handle key) const |
\rst Return an internal functor to invoke the object's sequence protocol. More... | |
item_accessor | operator[] (object &&key) const |
See above (the only difference is that the key's reference is stolen) More... | |
item_accessor | operator[] (const char *key) const |
See above (the only difference is that the key is provided as a string literal) More... | |
obj_attr_accessor | attr (handle key) const |
\rst Return an internal functor to access the object's attributes. More... | |
obj_attr_accessor | attr (object &&key) const |
See above (the only difference is that the key's reference is stolen) More... | |
str_attr_accessor | attr (const char *key) const |
See above (the only difference is that the key is provided as a string literal) More... | |
args_proxy | operator* () const |
\rst Matches * unpacking in Python, e.g. More... | |
template<typename T > | |
bool | contains (T &&item) const |
Check if the given item is contained within this object, i.e. item in obj . More... | |
template<return_value_policy policy = return_value_policy::automatic_reference, typename... Args> | |
object | operator() (Args &&...args) const |
\rst Assuming the Python object is a function or implements the __call__ protocol, operator() invokes the underlying function, passing an arbitrary set of parameters. More... | |
template<return_value_policy policy = return_value_policy::automatic_reference, typename... Args> | |
PYBIND11_DEPRECATED ("call(...) was deprecated in favor of operator()(...)") object call(Args &&...args) const | |
bool | is (object_api const &other) const |
Equivalent to obj is other in Python. More... | |
bool | is_none () const |
Equivalent to obj is None in Python. More... | |
bool | equal (object_api const &other) const |
Equivalent to obj == other in Python. More... | |
bool | not_equal (object_api const &other) const |
bool | operator< (object_api const &other) const |
bool | operator<= (object_api const &other) const |
bool | operator> (object_api const &other) const |
bool | operator>= (object_api const &other) const |
object | operator- () const |
object | operator~ () const |
object | operator+ (object_api const &other) const |
object | operator+= (object_api const &other) |
object | operator- (object_api const &other) const |
object | operator-= (object_api const &other) |
object | operator* (object_api const &other) const |
object | operator*= (object_api const &other) |
object | operator/ (object_api const &other) const |
object | operator/= (object_api const &other) |
object | operator| (object_api const &other) const |
object | operator|= (object_api const &other) |
object | operator& (object_api const &other) const |
object | operator&= (object_api const &other) |
object | operator^ (object_api const &other) const |
object | operator^= (object_api const &other) |
object | operator<< (object_api const &other) const |
object | operator<<= (object_api const &other) |
object | operator>> (object_api const &other) const |
object | operator>>= (object_api const &other) |
pybind11::str | str () const |
str_attr_accessor | doc () const |
Get or set the object's docstring, i.e. obj.__doc__ . More... | |
int | ref_count () const |
Return the object's current reference count. More... | |
handle | get_type () const |
Private Member Functions | |
const Derived & | derived () const |
bool | rich_compare (object_api const &other, int value) const |
const Derived & | derived () const |
bool | rich_compare (object_api const &other, int value) const |
\rst A mixin class which adds common functions to handle
, object
and various accessors.
The only requirement for Derived
is to implement PyObject *Derived::ptr() const
. \endrst
str_attr_accessor object_api< D >::attr | ( | const char * | key | ) | const |
str_attr_accessor object_api< Derived >::attr | ( | const char * | key | ) | const |
See above (the only difference is that the key is provided as a string literal)
obj_attr_accessor object_api< D >::attr | ( | handle | key | ) | const |
\rst Return an internal functor to access the object's attributes.
Casting the returned detail::obj_attr_accessor
instance to a handle
or object
subclass causes a corresponding call to getattr
. Assigning a handle
or object
subclass causes a call to setattr
. \endrst
obj_attr_accessor object_api< Derived >::attr | ( | handle | key | ) | const |
\rst Return an internal functor to access the object's attributes.
Casting the returned detail::obj_attr_accessor
instance to a handle
or object
subclass causes a corresponding call to getattr
. Assigning a handle
or object
subclass causes a call to setattr
. \endrst
obj_attr_accessor object_api< D >::attr | ( | object && | key | ) | const |
iterator object_api< D >::begin |
iterator object_api< Derived >::begin | ( | ) | const |
\rst Return an iterator equivalent to calling iter()
in Python.
The object must be a collection which supports the iteration protocol. \endrst
bool object_api< Derived >::contains | ( | T && | item | ) | const |
Check if the given item is contained within this object, i.e. item in obj
.
|
inlineprivate |
Definition at line 70 of file pytypes.h.
Referenced by object_api< Derived >::is(), object_api< Derived >::is_none(), object_api< Derived >::ref_count(), and object_api< Derived >::rich_compare().
|
inlineprivate |
str_attr_accessor object_api< D >::doc |
str_attr_accessor object_api< Derived >::doc | ( | ) | const |
Get or set the object's docstring, i.e. obj.__doc__
.
iterator object_api< D >::end |
Return a sentinel which ends iteration.
Definition at line 2057 of file pytypes.h.
References iterator::sentinel().
iterator object_api< Derived >::end | ( | ) | const |
Return a sentinel which ends iteration.
|
inline |
Equivalent to obj == other in Python.
Definition at line 136 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Equivalent to obj == other in Python.
Definition at line 150 of file pytypes.h.
References object_api< Derived >::rich_compare().
handle object_api< D >::get_type |
Definition at line 2097 of file pytypes.h.
References type::handle_of().
handle object_api< Derived >::get_type | ( | ) | const |
|
inline |
Equivalent to obj is other
in Python.
Definition at line 132 of file pytypes.h.
References object_api< Derived >::derived().
|
inline |
Equivalent to obj is other
in Python.
Definition at line 146 of file pytypes.h.
References object_api< Derived >::derived().
|
inline |
Equivalent to obj is None
in Python.
Definition at line 134 of file pytypes.h.
References object_api< Derived >::derived().
|
inline |
Equivalent to obj is None
in Python.
Definition at line 148 of file pytypes.h.
References object_api< Derived >::derived().
|
inline |
Definition at line 137 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 151 of file pytypes.h.
References object_api< Derived >::rich_compare().
object object_api< Derived >::operator& | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator& | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator&= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator&= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator() | ( | Args &&... | args | ) | const |
\rst Assuming the Python object is a function or implements the __call__
protocol, operator()
invokes the underlying function, passing an arbitrary set of parameters.
The result is returned as a object
and may need to be converted back into a Python object using handle::cast()
.
When some of the arguments cannot be converted to Python objects, the function will throw a cast_error
exception. When the Python function call fails, a error_already_set
exception is thrown. \endrst
Definition at line 1625 of file cast.h.
References pybind11_fail().
object object_api< Derived >::operator() | ( | Args &&... | args | ) | const |
\rst Assuming the Python object is a function or implements the __call__
protocol, operator()
invokes the underlying function, passing an arbitrary set of parameters.
The result is returned as a object
and may need to be converted back into a Python object using handle::cast()
.
When some of the arguments cannot be converted to Python objects, the function will throw a cast_error
exception. When the Python function call fails, a error_already_set
exception is thrown. \endrst
args_proxy object_api< D >::operator* |
args_proxy object_api< Derived >::operator* | ( | ) | const |
\rst Matches * unpacking in Python, e.g.
to unpack arguments out of a tuple
or list
for a function call. Applying another * to the result yields unpacking, e.g. to unpack a dict as function keyword arguments. See :ref:calling_python_functions
. \endrst
object object_api< Derived >::operator* | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator* | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator*= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator*= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator+ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator+ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator+= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator+= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator- | ( | ) | const |
object object_api< Derived >::operator- | ( | ) | const |
object object_api< Derived >::operator- | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator- | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator-= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator-= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator/ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator/ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator/= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator/= | ( | object_api< Derived > const & | other | ) | const |
|
inline |
Definition at line 138 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 152 of file pytypes.h.
References object_api< Derived >::rich_compare().
object object_api< Derived >::operator<< | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator<< | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator<<= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator<<= | ( | object_api< Derived > const & | other | ) | const |
|
inline |
Definition at line 139 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 153 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 140 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 154 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 141 of file pytypes.h.
References object_api< Derived >::rich_compare().
|
inline |
Definition at line 155 of file pytypes.h.
References object_api< Derived >::rich_compare().
object object_api< Derived >::operator>> | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator>> | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator>>= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator>>= | ( | object_api< Derived > const & | other | ) | const |
item_accessor object_api< D >::operator[] | ( | const char * | key | ) | const |
item_accessor object_api< Derived >::operator[] | ( | const char * | key | ) | const |
See above (the only difference is that the key is provided as a string literal)
item_accessor object_api< D >::operator[] | ( | handle | key | ) | const |
\rst Return an internal functor to invoke the object's sequence protocol.
Casting the returned detail::item_accessor
instance to a handle
or object
subclass causes a corresponding call to __getitem__
. Assigning a handle
or object
subclass causes a call to __setitem__
. \endrst
item_accessor object_api< Derived >::operator[] | ( | handle | key | ) | const |
\rst Return an internal functor to invoke the object's sequence protocol.
Casting the returned detail::item_accessor
instance to a handle
or object
subclass causes a corresponding call to __getitem__
. Assigning a handle
or object
subclass causes a call to __setitem__
. \endrst
item_accessor object_api< D >::operator[] | ( | object && | key | ) | const |
object object_api< Derived >::operator^ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator^ | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator^= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator^= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator| | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator| | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator|= | ( | object_api< Derived > const & | other | ) |
object object_api< Derived >::operator|= | ( | object_api< Derived > const & | other | ) | const |
object object_api< Derived >::operator~ | ( | ) | const |
object object_api< Derived >::operator~ | ( | ) | const |
object_api< Derived >::PYBIND11_DEPRECATED | ( | "call(...) was deprecated in favor of operator()(...)" | ) | const && |
object_api< Derived >::PYBIND11_DEPRECATED | ( | "call(...) was deprecated in favor of operator()(...)" | ) | const && |
|
inline |
Return the object's current reference count.
Definition at line 171 of file pytypes.h.
References object_api< Derived >::derived().
|
inline |
Return the object's current reference count.
Definition at line 185 of file pytypes.h.
References object_api< Derived >::derived().
|
private |
Definition at line 2102 of file pytypes.h.
References object_api< Derived >::derived().
Referenced by object_api< Derived >::equal(), object_api< Derived >::not_equal(), object_api< Derived >::operator<(), object_api< Derived >::operator<=(), object_api< Derived >::operator>(), and object_api< Derived >::operator>=().
|
private |
pybind11::str object_api< D >::str |
pybind11::str object_api< Derived >::str | ( | ) | const |