HepMC3 event record library
Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
type Class Reference
+ Inheritance diagram for type:
+ Collaboration diagram for type:

Public Member Functions

 PYBIND11_DEPRECATED ("Use reinterpret_borrow<object>() or reinterpret_steal<object>()") object(handle h
 
handle release ()
 
template<typename T >
cast () const &
 
template<typename T >
cast () &&
 
template<typename T >
cast () const &
 
template<typename T >
cast () &&
 
template<>
void cast () const &
 
template<>
void cast () &&
 
template<typename T >
cast () const
 
PyObject * ptr () const
 Return the underlying PyObject * pointer. More...
 
PyObject *& ptr ()
 
const handleinc_ref () const &
 
const handledec_ref () const &
 
 operator bool () const
 Return true when the handle wraps a valid Python object. More...
 
bool operator== (const handle &h) const
 
bool operator!= (const handle &h) const
 
bool check () const
 

Static Public Member Functions

static handle handle_of (handle h)
 Return a type handle from a handle or an object. More...
 
static type of (handle h)
 Return a type object from a handle or an object. More...
 
template<typename T >
static handle handle_of ()
 
template<typename T >
static type of ()
 

Data Fields

bool is_borrowed: handle(h) { if (is_borrowed) inc_ref()
 

Protected Attributes

PyObject * m_ptr = nullptr
 

Detailed Description

Definition at line 904 of file pytypes.h.

Member Function Documentation

◆ cast()

T cast
inherited

\rst Attempt to cast the Python object into the given C++ type. A cast_error will be throw upon failure. \endrst

Definition at line 1743 of file cast.h.

◆ dec_ref()

const handle& dec_ref ( ) const &
inlineinherited

\rst Manually decrease the reference count of the Python object. Usually, it is preferable to use the object class which derives from handle and calls this function automatically. Returns a reference to itself. \endrst

Definition at line 199 of file pytypes.h.

◆ handle_of() [1/2]

handle handle_of
static

Convert C++ type to handle if previously registered. Does not convert standard types, like int, float. etc. yet. See https://github.com/pybind/pybind11/issues/2486

Definition at line 2200 of file cast.h.

◆ handle_of() [2/2]

static handle handle_of ( handle  h)
inlinestatic

Return a type handle from a handle or an object.

Definition at line 909 of file pytypes.h.

References handle::handle().

◆ inc_ref()

const handle& inc_ref ( ) const &
inlineinherited

\rst Manually increase the reference count of the Python object. Usually, it is preferable to use the object class which derives from handle and calls this function automatically. Returns a reference to itself. \endrst

Definition at line 192 of file pytypes.h.

◆ of() [1/2]

static type of ( )
inlinestatic

Convert C++ type to type if previously registered. Does not convert standard types, like int, float. etc. yet. See https://github.com/pybind/pybind11/issues/2486

Definition at line 925 of file pytypes.h.

◆ of() [2/2]

static type of ( handle  h)
inlinestatic

Return a type object from a handle or an object.

Definition at line 912 of file pytypes.h.

References handle_of().

◆ operator bool()

operator bool ( ) const
inlineexplicitinherited

Return true when the handle wraps a valid Python object.

Definition at line 207 of file pytypes.h.

◆ operator==()

bool operator== ( const handle h) const
inlineinherited

\rst Deprecated: Check that the underlying pointers are the same. Equivalent to obj1 is obj2 in Python. \endrst

Definition at line 213 of file pytypes.h.

◆ ptr()

PyObject* ptr ( ) const
inlineinherited

Return the underlying PyObject * pointer.

Definition at line 184 of file pytypes.h.

◆ release()

handle release ( )
inlineinherited

\rst Resets the internal pointer to nullptr without decreasing the object's reference count. The function returns a raw handle to the original Python object. \endrst

Definition at line 249 of file pytypes.h.

References handle::handle().


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