HepMC3 event record library
Public Member Functions | Data Fields | Private Types | Private Member Functions
accessor< Policy > Class Template Reference
+ Inheritance diagram for accessor< Policy >:
+ Collaboration diagram for accessor< Policy >:

Public Member Functions

 accessor (handle obj, key_type key)
 
 accessor (const accessor &)=default
 
 accessor (accessor &&)=default
 
void operator= (const accessor &a) &&
 
void operator= (const accessor &a) &
 
template<typename T >
void operator= (T &&value) &&
 
template<typename T >
void operator= (T &&value) &
 
iterator begin () const
 
iterator end () const
 Return a sentinel which ends iteration. More...
 
item_accessor operator[] (handle key) const
 
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
 
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
 
object operator* (object_api const &other) const
 
bool contains (T &&item) const
 Check if the given item is contained within this object, i.e. item in obj. More...
 
object operator() (Args &&...args) const
 
 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- (object_api const &other) 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
 
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
 

Data Fields

template<typename T = Policy>
PYBIND11_DEPRECATED("Use of obj.attr(...) as bool is deprecated in favor of pybind11::hasattr(obj, ...)") explicit operator enable_if_t< std key_type key
 
object cache
 

Private Types

using key_type = typename Policy::key_type
 

Private Member Functions

const accessor< Policy > & derived () const
 
bool rich_compare (object_api const &other, int value) const
 

Detailed Description

template<typename Policy>
class accessor< Policy >

Definition at line 491 of file pytypes.h.

Member Function Documentation

◆ attr() [1/2]

str_attr_accessor attr ( const char *  key) const
inherited

See above (the only difference is that they key is provided as a string literal)

Definition at line 85 of file pytypes.h.

◆ attr() [2/2]

obj_attr_accessor attr ( handle  key) const
inherited

\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

Definition at line 83 of file pytypes.h.

◆ begin()

iterator begin
inherited

\rst Return an iterator equivalent to calling iter() in Python. The object must be a collection which supports the iteration protocol. \endrst

Definition at line 63 of file pytypes.h.

◆ contains()

bool contains ( T &&  item) const
inherited

Check if the given item is contained within this object, i.e. item in obj.

Definition at line 96 of file pytypes.h.

◆ doc()

Get or set the object's docstring, i.e. obj.__doc__.

Definition at line 151 of file pytypes.h.

◆ end()

iterator end
inherited

Return a sentinel which ends iteration.

Definition at line 65 of file pytypes.h.

◆ equal()

bool equal ( object_api< accessor< Policy > > const &  other) const
inlineinherited

Equivalent to obj == other in Python.

Definition at line 119 of file pytypes.h.

◆ is()

bool is ( object_api< accessor< Policy > > const &  other) const
inlineinherited

Equivalent to obj is other in Python.

Definition at line 115 of file pytypes.h.

◆ is_none()

bool is_none ( ) const
inlineinherited

Equivalent to obj is None in Python.

Definition at line 117 of file pytypes.h.

◆ operator()()

object operator() ( Args &&...  args) const
inherited

\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 109 of file cast.h.

◆ operator*()

args_proxy operator*
inherited

\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

Definition at line 93 of file pytypes.h.

◆ operator[]() [1/2]

item_accessor operator[] ( const char *  key) const
inherited

See above (the only difference is that they key is provided as a string literal)

Definition at line 75 of file pytypes.h.

◆ operator[]() [2/2]

item_accessor operator[] ( handle  key) const
inherited

\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

Definition at line 73 of file pytypes.h.

◆ ref_count()

int ref_count ( ) const
inlineinherited

Return the object's current reference count.

Definition at line 154 of file pytypes.h.


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