HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PY_OpaqueObject Class Reference

#include <PY_OpaqueObject.h>

+ Inheritance diagram for PY_OpaqueObject:

Public Member Functions

 PY_OpaqueObject () noexcept
 
 PY_OpaqueObject (std::nullptr_t) noexcept
 
 PY_OpaqueObject (void *opaque_py_object, bool new_ref=false) noexcept
 
 ~PY_OpaqueObject ()
 
void reset () noexcept
 Releases ownership and sets to nullptr. More...
 
void reset (void *opaque_py_object, bool new_ref) noexcept
 
void resetToNone ()
 Set to the Py_None() More...
 
voidopaqueObject () const noexcept
 
voidreleaseOpaqueObject () noexcept
 Releases ownership of the managed object as a void *, and resets. More...
 
PY_PyObjectpyObject () const noexcept
 
PY_PyObjectreleasePyObject () noexcept
 
 operator bool () const noexcept
 Return true if *this owns an object (ie. != nullptr) More...
 
 PY_OpaqueObject (const PY_OpaqueObject &opaque_object) noexcept
 
PY_OpaqueObjectoperator= (const PY_OpaqueObject &opaque_object) noexcept
 
 PY_OpaqueObject (PY_OpaqueObject &&opaque_object) noexcept
 
PY_OpaqueObjectoperator= (PY_OpaqueObject &&opaque_object) noexcept
 
PY_OpaqueObjectoperator= (std::nullptr_t) noexcept
 
bool operator== (const PY_OpaqueObject &opaque_object) const noexcept
 
bool operator!= (const PY_OpaqueObject &opaque_object) const noexcept
 
bool equalsOpaqueObject (void *opaque_py_object) const noexcept
 

Friends

bool operator== (const PY_OpaqueObject &opaque_object, std::nullptr_t) noexcept
 
bool operator== (std::nullptr_t, const PY_OpaqueObject &opaque_object) noexcept
 
bool operator!= (const PY_OpaqueObject &opaque_object, std::nullptr_t) noexcept
 
bool operator!= (std::nullptr_t, const PY_OpaqueObject &opaque_object) noexcept
 

Detailed Description

Definition at line 24 of file PY_OpaqueObject.h.

Constructor & Destructor Documentation

PY_OpaqueObject::PY_OpaqueObject ( )
inlinenoexcept

Definition at line 27 of file PY_OpaqueObject.h.

PY_OpaqueObject::PY_OpaqueObject ( std::nullptr_t  )
inlinenoexcept

Definition at line 28 of file PY_OpaqueObject.h.

PY_OpaqueObject::PY_OpaqueObject ( void opaque_py_object,
bool  new_ref = false 
)
inlineexplicitnoexcept

Construct instances of this class with an opaque PY_PyObject pointer (which may be null). On destruction, the reference counter will be decremented. By default, opaque_py_object will have its reference count incremented on construction. To avoid this, set new_ref=true to signify that we are being passed ownership of a new object.

Definition at line 36 of file PY_OpaqueObject.h.

PY_OpaqueObject::~PY_OpaqueObject ( )
inline

Definition at line 40 of file PY_OpaqueObject.h.

PY_OpaqueObject::PY_OpaqueObject ( const PY_OpaqueObject opaque_object)
inlinenoexcept

Copy construct/assign

Definition at line 47 of file PY_OpaqueObject.h.

PY_OpaqueObject::PY_OpaqueObject ( PY_OpaqueObject &&  opaque_object)
inlinenoexcept

Move construct/assign

Definition at line 61 of file PY_OpaqueObject.h.

Member Function Documentation

bool PY_OpaqueObject::equalsOpaqueObject ( void opaque_py_object) const
noexcept

The comparison operators and equalsOpaqueObject compare using the eq operator.

void* PY_OpaqueObject::opaqueObject ( ) const
inlinenoexcept

Return a borrowed reference to our opaque PyObject *. If the caller will hold a reference to this object after the PY_OpaqueObject has been deleted, it is up to the caller to increment the reference count.

Definition at line 92 of file PY_OpaqueObject.h.

PY_OpaqueObject::operator bool ( ) const
inlineexplicitnoexcept

Return true if *this owns an object (ie. != nullptr)

Definition at line 134 of file PY_OpaqueObject.h.

bool PY_OpaqueObject::operator!= ( const PY_OpaqueObject opaque_object) const
inlinenoexcept

The comparison operators and equalsOpaqueObject compare using the eq operator.

Definition at line 128 of file PY_OpaqueObject.h.

PY_OpaqueObject& PY_OpaqueObject::operator= ( const PY_OpaqueObject opaque_object)
inlinenoexcept

Copy construct/assign

Definition at line 51 of file PY_OpaqueObject.h.

PY_OpaqueObject& PY_OpaqueObject::operator= ( PY_OpaqueObject &&  opaque_object)
inlinenoexcept

Move construct/assign

Definition at line 66 of file PY_OpaqueObject.h.

PY_OpaqueObject& PY_OpaqueObject::operator= ( std::nullptr_t  )
inlinenoexcept

Move construct/assign

Definition at line 72 of file PY_OpaqueObject.h.

bool PY_OpaqueObject::operator== ( const PY_OpaqueObject opaque_object) const
inlinenoexcept

The comparison operators and equalsOpaqueObject compare using the eq operator.

Definition at line 126 of file PY_OpaqueObject.h.

PY_PyObject* PY_OpaqueObject::pyObject ( ) const
inlinenoexcept

Return a borrowed reference as a PyObject *.

Using this method requires that the caller includes PY_CPythonAPI.h, only call this in a .C file to avoid polluting Python header symbols into rest of the codebase.

Definition at line 108 of file PY_OpaqueObject.h.

void* PY_OpaqueObject::releaseOpaqueObject ( )
inlinenoexcept

Releases ownership of the managed object as a void *, and resets.

Definition at line 96 of file PY_OpaqueObject.h.

PY_PyObject* PY_OpaqueObject::releasePyObject ( )
inlinenoexcept

Releases ownership of the managed object as PY_Object *, and resets.

Using this method requires that the caller includes PY_CPythonAPI.h, only call this in a .C file to avoid polluting Python header symbols into rest of the codebase.

Definition at line 116 of file PY_OpaqueObject.h.

void PY_OpaqueObject::reset ( )
noexcept

Releases ownership and sets to nullptr.

void PY_OpaqueObject::reset ( void opaque_py_object,
bool  new_ref 
)
noexcept

Release ownerhsip of old ptr and assign a new PY_PyObject. If !new_ref (aka borrowed), opaque_py_object's refcount is incremented

void PY_OpaqueObject::resetToNone ( )

Set to the Py_None()

Friends And Related Function Documentation

bool operator!= ( const PY_OpaqueObject opaque_object,
std::nullptr_t   
)
friend

Definition at line 148 of file PY_OpaqueObject.h.

bool operator!= ( std::nullptr_t  ,
const PY_OpaqueObject opaque_object 
)
friend

Definition at line 153 of file PY_OpaqueObject.h.

bool operator== ( const PY_OpaqueObject opaque_object,
std::nullptr_t   
)
friend

Definition at line 138 of file PY_OpaqueObject.h.

bool operator== ( std::nullptr_t  ,
const PY_OpaqueObject opaque_object 
)
friend

Definition at line 143 of file PY_OpaqueObject.h.


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