HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
wrapTypeHelpers.h
Go to the documentation of this file.
1
//
2
// Copyright 2016 Pixar
3
//
4
// Licensed under the terms set forth in the LICENSE.txt file available at
5
// https://openusd.org/license.
6
//
7
#ifndef PXR_BASE_TF_WRAP_TYPE_HELPERS_H
8
#define PXR_BASE_TF_WRAP_TYPE_HELPERS_H
9
10
#include "
pxr/pxr.h
"
11
12
#include "
pxr/base/tf/api.h
"
13
#include "
pxr/base/tf/pyObjWrapper.h
"
14
#include "
pxr/base/tf/type.h
"
15
#include "pxr/external/boost/python/class.hpp"
16
#include "pxr/external/boost/python/def_visitor.hpp"
17
18
PXR_NAMESPACE_OPEN_SCOPE
19
20
// Private implementation namespace; public types are exposed below.
21
namespace
TfType_WrapHelpers {
22
23
using namespace
pxr_boost::python;
24
25
struct
_PythonClass
: def_visitor<_PythonClass>
26
{
27
friend
class
def_visitor_access;
28
29
private
:
30
template
<
class
CLS,
class
T>
31
void
_Visit(CLS &
c
,
T
*)
const
{
32
if
(
TfType
t
= TfType::Find<T>())
33
t
.DefinePythonClass(c);
34
}
35
36
public
:
37
template
<
class
CLS>
38
void
visit
(CLS &c)
const
{
39
// Use function template resolution to wrap the type
40
// appropriately depending on whether it is a polymorphic
41
// wrapper<> type.
42
typedef
typename
CLS::wrapped_type
Type
;
43
_Visit(c, detail::unwrap_wrapper((Type*)0));
44
}
45
};
46
47
}
// namespace TfType_WrapHelpers
48
49
50
/// \struct TfTypePythonClass
51
/// A boost.python visitor that associates the Python class object created by
52
/// the wrapping with the TfType of the C++ type being wrapped.
53
///
54
/// Example use:
55
/// \code
56
/// class_<Foo, ...>("Foo", ...)
57
/// .def( TfTypePythonClass() )
58
/// \endcode
59
///
60
struct
TfTypePythonClass
:
public
TfType_WrapHelpers::_PythonClass
{};
61
62
/// A helper for wrapping C++ types.
63
/// This method defines a TfType for the given python class object, and also
64
/// recursively defines TfTypes for all the Python bases if necessary.
65
TF_API
TfType
TfType_DefinePythonTypeAndBases
(
const
pxr_boost::python::object
& classObj );
66
67
PXR_NAMESPACE_CLOSE_SCOPE
68
69
#endif // PXR_BASE_TF_WRAP_TYPE_HELPERS_H
TF_API
#define TF_API
Definition:
api.h:23
SOP_AttribCreate_2_0Enums::Type
Type
Definition:
SOP_AttribCreate-2.0.proto.h:90
TfType_WrapHelpers::_PythonClass::visit
void visit(CLS &c) const
Definition:
wrapTypeHelpers.h:38
TfTypePythonClass
Definition:
wrapTypeHelpers.h:60
Tf_MakePyConstructor::object
bp::object object
Definition:
makePyConstructor.h:172
TfType_WrapHelpers::_PythonClass
Definition:
wrapTypeHelpers.h:25
pxr.h
TfType_DefinePythonTypeAndBases
TF_API TfType TfType_DefinePythonTypeAndBases(const pxr_boost::python::object &classObj)
api.h
OBJ_MatchTransform::T
t
GLdouble t
Definition:
glad.h:2397
pyObjWrapper.h
PXR_NAMESPACE_OPEN_SCOPE
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition:
path.h:1425
PXR_NAMESPACE_CLOSE_SCOPE
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition:
pxr.h:74
nanovdb::io::c
c
Definition:
IO.h:328
TfType
Definition:
type.h:47
type.h
pxr
base
tf
wrapTypeHelpers.h
Generated on Wed Aug 27 2025 03:07:51 for HDK by
1.8.6