HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pyTracing.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_PY_TRACING_H
8 #define PXR_BASE_TF_PY_TRACING_H
9 
10 #include "pxr/pxr.h"
11 
12 #ifdef PXR_PYTHON_SUPPORT_ENABLED
14 #endif // PXR_PYTHON_SUPPORT_ENABLED
15 
16 #include "pxr/base/tf/api.h"
17 
18 #include <functional>
19 #include <memory>
20 
22 
23 #ifdef PXR_PYTHON_SUPPORT_ENABLED
24 /// \struct TfPyTraceInfo
25 /// Structure passed to python trace functions. See the Python C API
26 /// documentation reference for the meaning of \a what and \a arg.
27 struct TfPyTraceInfo {
28  PyObject *arg;
29  char const *funcName;
30  char const *fileName;
31  int funcLine;
32  int what;
33 };
34 
35 typedef std::function<void (TfPyTraceInfo const &)> TfPyTraceFn;
36 typedef std::shared_ptr<TfPyTraceFn> TfPyTraceFnId;
37 
38 /// Register \a f as a python trace function.
39 /// It will be invoked for python tracing events. If python is not yet
40 /// initialized, the function will not be invoked until python is initialized.
41 TF_API TfPyTraceFnId TfPyRegisterTraceFn(TfPyTraceFn const &f);
42 
43 // For internal use only. Do not use.
44 void Tf_PyFabricateTraceEvent(TfPyTraceInfo const &info);
45 
46 // For internal use only. Do not use.
47 void Tf_PyTracingPythonInitialized();
48 #else
49 /// \struct TfPyTraceInfo
50 /// For storage alignment when PXR_PYTHON_SUPPORT_ENABLED is not enabled.
52 typedef std::function<void (TfPyTraceInfo const &)> TfPyTraceFn;
53 typedef std::shared_ptr<TfPyTraceFn> TfPyTraceFnId;
54 #endif // PXR_PYTHON_SUPPORT_ENABLED
55 
57 
58 #endif // PXR_BASE_TF_PY_TRACING_H
#define TF_API
Definition: api.h:23
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
Definition: core.h:1859
std::shared_ptr< TfPyTraceFn > TfPyTraceFnId
Definition: pyTracing.h:53
GLfloat f
Definition: glcorearb.h:1926
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1425
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:74
std::function< void(TfPyTraceInfo const &)> TfPyTraceFn
Definition: pyTracing.h:51