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

#include <pyObjWrapper.h>

+ Inheritance diagram for TfPyObjWrapper:

Detailed Description

Boost Python object wrapper.

Provides a wrapper around hboost::python::object that works correctly for the following basic operations regardless of the GIL state: default construction, copy construction, assignment, (in)equality comparison, hash_value(), and destruction.

None of those work correctly in the presence of an unlocked GIL for hboost::python::object. This class only actually acquires the GIL for default construction, destruction and for some (in)equality comparisons. The other operations do not require taking the GIL.

This is primarily useful in cases where a hboost::python::object might be destroyed without a locked GIL by a client blind to that fact. This occurs when a registry, for example, holds type-erased objects. If one of the type-erased objects in the registry happens to hold a hboost::python::object, that type-erased object must be destroyed while the GIL is held but it's unreasonable to require that the registry know that. This class helps solve that problem.

This class also provides many of the operators that hboost::python::object provides, by virtue of deriving from hboost::python::api::object_operators<T>. However it is important to note that callers must ensure the GIL is held before using these operators!

Definition at line 161 of file pyObjWrapper.h.


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