![]() |
Scarab
v2.11.1
Project 8 C++ Utility Library
|
#include <Python.h>#include <frameobject.h>#include <pythread.h>#include <cstddef>#include <cstring>#include <forward_list>#include <vector>#include <string>#include <stdexcept>#include <unordered_set>#include <unordered_map>#include <memory>#include <typeindex>#include <type_traits>
Go to the source code of this file.
Namespaces | |
| pybind11 | |
| glibc defines I as a macro which breaks things, e.g., boost template names | |
| pybind11::detail | |
| pybind11::detail::constexpr_impl | |
Macros | |
| #define | NAMESPACE_BEGIN(name) namespace name { |
| #define | NAMESPACE_END(name) } |
| #define | PYBIND11_NAMESPACE pybind11 |
| #define | PYBIND11_EXPORT __attribute__ ((visibility("default"))) |
| #define | PYBIND11_NOINLINE __attribute__ ((noinline)) |
| #define | PYBIND11_DEPRECATED(reason) __attribute__((deprecated(reason))) |
| #define | PYBIND11_VERSION_MAJOR 2 |
| #define | PYBIND11_VERSION_MINOR 3 |
| #define | PYBIND11_VERSION_PATCH dev1 |
| #define | PYBIND11_INSTANCE_METHOD_NEW(ptr, class_) PyMethod_New(ptr, nullptr, class_) |
| Include Python header, disable linking to pythonX_d.lib on Windows in debug mode. More... | |
| #define | PYBIND11_INSTANCE_METHOD_CHECK PyMethod_Check |
| #define | PYBIND11_INSTANCE_METHOD_GET_FUNCTION PyMethod_GET_FUNCTION |
| #define | PYBIND11_BYTES_CHECK PyString_Check |
| #define | PYBIND11_BYTES_FROM_STRING PyString_FromString |
| #define | PYBIND11_BYTES_FROM_STRING_AND_SIZE PyString_FromStringAndSize |
| #define | PYBIND11_BYTES_AS_STRING_AND_SIZE PyString_AsStringAndSize |
| #define | PYBIND11_BYTES_AS_STRING PyString_AsString |
| #define | PYBIND11_BYTES_SIZE PyString_Size |
| #define | PYBIND11_LONG_CHECK(o) (PyInt_Check(o) || PyLong_Check(o)) |
| #define | PYBIND11_LONG_AS_LONGLONG(o) (PyInt_Check(o) ? (long long) PyLong_AsLong(o) : PyLong_AsLongLong(o)) |
| #define | PYBIND11_LONG_FROM_SIGNED(o) PyInt_FromSsize_t((ssize_t) o) |
| #define | PYBIND11_LONG_FROM_UNSIGNED(o) PyInt_FromSize_t((size_t) o) |
| #define | PYBIND11_BYTES_NAME "str" |
| #define | PYBIND11_STRING_NAME "unicode" |
| #define | PYBIND11_SLICE_OBJECT PySliceObject |
| #define | PYBIND11_FROM_STRING PyString_FromString |
| #define | PYBIND11_STR_TYPE ::pybind11::bytes |
| #define | PYBIND11_BOOL_ATTR "__nonzero__" |
| #define | PYBIND11_NB_BOOL(ptr) ((ptr)->nb_nonzero) |
| #define | PYBIND11_PLUGIN_IMPL(name) |
| #define | PYBIND11_TRY_NEXT_OVERLOAD ((PyObject *) 1) |
| #define | PYBIND11_STRINGIFY(x) #x |
| #define | PYBIND11_TOSTRING(x) PYBIND11_STRINGIFY(x) |
| #define | PYBIND11_CONCAT(first, second) first##second |
| #define | PYBIND11_CHECK_PYTHON_VERSION |
| #define | PYBIND11_CATCH_INIT_EXCEPTIONS |
| #define | PYBIND11_PLUGIN(name) |
| #define | PYBIND11_MODULE(name, variable) |
| #define | PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) pybind11::detail::expand_side_effects{ ((PATTERN), void(), false)..., false } |
| #define | PYBIND11_RUNTIME_EXCEPTION(name, type) |
Typedefs | |
| using | ssize_t = Py_ssize_t |
| using | size_t = std::size_t |
| template<bool B, typename T = void> | |
| using | enable_if_t = typename std::enable_if< B, T >::type |
| from cpp_future import (convenient aliases from C++14/17) More... | |
| template<bool B, typename T , typename F > | |
| using | conditional_t = typename std::conditional< B, T, F >::type |
| template<typename T > | |
| using | remove_cv_t = typename std::remove_cv< T >::type |
| template<typename T > | |
| using | remove_reference_t = typename std::remove_reference< T >::type |
| template<size_t N> | |
| using | make_index_sequence = typename make_index_sequence_impl< N >::type |
| template<bool... Bs> | |
| using | select_indices = typename select_indices_impl< index_sequence<>, 0, Bs... >::type |
| template<bool B> | |
| using | bool_constant = std::integral_constant< bool, B > |
| Backports of std::bool_constant and std::negation to accommodate older compilers. More... | |
| template<typename... Ts> | |
| using | void_t = typename void_t_impl< Ts... >::type |
| template<class... Ts> | |
| using | all_of = std::is_same< bools< Ts::value..., true >, bools< true, Ts::value... > > |
| template<class... Ts> | |
| using | any_of = negation< all_of< negation< Ts >... > > |
| template<class... Ts> | |
| using | none_of = negation< any_of< Ts... > > |
| template<class T , template< class > class... Predicates> | |
| using | satisfies_all_of = all_of< Predicates< T >... > |
| template<class T , template< class > class... Predicates> | |
| using | satisfies_any_of = any_of< Predicates< T >... > |
| template<class T , template< class > class... Predicates> | |
| using | satisfies_none_of = none_of< Predicates< T >... > |
| template<typename T > | |
| using | intrinsic_t = typename intrinsic_type< T >::type |
| template<template< typename > class Predicate, typename Default , typename... Ts> | |
| using | exactly_one_t = typename exactly_one< Predicate, Default, Ts... >::type |
| template<typename T , typename... Us> | |
| using | deferred_t = typename deferred_type< T, Us... >::type |
| template<typename Base , typename Derived > | |
| using | is_strict_base_of = bool_constant< std::is_base_of< Base, Derived >::value &&!std::is_same< Base, Derived >::value > |
| template<typename Base , typename Derived > | |
| using | is_accessible_base_of = bool_constant< std::is_base_of< Base, Derived >::value &&std::is_convertible< Derived *, Base * >::value > |
| template<template< typename... > class Base, typename T > | |
| using | is_template_base_of = decltype(is_template_base_of_impl< Base >::check((intrinsic_t< T > *) nullptr)) |
| template<typename T > | |
| using | is_shared_ptr = is_instantiation< std::shared_ptr, T > |
| Check if T is std::shared_ptr<U> where U can be anything. More... | |
| template<typename T > | |
| using | is_function_pointer = bool_constant< std::is_pointer< T >::value &&std::is_function< typename std::remove_pointer< T >::type >::value > |
| template<typename Function , typename F = remove_reference_t<Function>> | |
| using | function_signature_t = conditional_t< std::is_function< F >::value, F, typename conditional_t< std::is_pointer< F >::value||std::is_member_pointer< F >::value, std::remove_pointer< F >, strip_function_object< F > >::type > |
| template<typename T > | |
| using | is_lambda = satisfies_none_of< remove_reference_t< T >, std::is_function, std::is_pointer, std::is_member_pointer > |
| using | expand_side_effects = bool[] |
| Apply a function over each element of a parameter pack. More... | |
Enumerations | |
| enum | return_value_policy : uint8_t { automatic = 0, automatic_reference, take_ownership, copy, move, reference, reference_internal } |
| Approach used to cast a previously unknown C++ instance into a Python object. More... | |
Functions | |
| static constexpr int | log2 (size_t n, int k=0) |
| static constexpr size_t | size_in_ptrs (size_t s) |
| constexpr size_t | instance_simple_holder_in_ptrs () |
| constexpr size_t | constexpr_sum () |
| Compile-time integer sum. More... | |
| template<typename T , typename... Ts> | |
| constexpr size_t | constexpr_sum (T n, Ts... ns) |
| constexpr int | first (int i) |
| Implementation details for constexpr functions. More... | |
| template<typename T , typename... Ts> | |
| constexpr int | first (int i, T v, Ts... vs) |
| constexpr int | last (int, int result) |
| template<typename T , typename... Ts> | |
| constexpr int | last (int i, int result, T v, Ts... vs) |
| template<template< typename > class Predicate, typename... Ts> | |
| constexpr int | constexpr_first () |
| template<template< typename > class Predicate, typename... Ts> | |
| constexpr int | constexpr_last () |
| Return the index of the last type in Ts which satisfies Predicate<T>, or -1 if none match. More... | |
| void | ignore_unused (const int *) |
| Ignore that a variable is unused in compiler warnings. More... | |
| __attribute__ ((noinline)) inline void pybind11_fail(const char *reason) | |
| Used internally. More... | |
Variables | |
| static constexpr auto | const_ = std::true_type{} |
| #define NAMESPACE_BEGIN | ( | name | ) | namespace name { |
Definition at line 13 of file detail/common.h.
| #define NAMESPACE_END | ( | name | ) | } |
Definition at line 16 of file detail/common.h.
| #define PYBIND11_BOOL_ATTR "__nonzero__" |
Definition at line 191 of file detail/common.h.
| #define PYBIND11_BYTES_AS_STRING PyString_AsString |
Definition at line 180 of file detail/common.h.
| #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyString_AsStringAndSize |
Definition at line 179 of file detail/common.h.
| #define PYBIND11_BYTES_CHECK PyString_Check |
Definition at line 176 of file detail/common.h.
| #define PYBIND11_BYTES_FROM_STRING PyString_FromString |
Definition at line 177 of file detail/common.h.
| #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyString_FromStringAndSize |
Definition at line 178 of file detail/common.h.
| #define PYBIND11_BYTES_NAME "str" |
Definition at line 186 of file detail/common.h.
| #define PYBIND11_BYTES_SIZE PyString_Size |
Definition at line 181 of file detail/common.h.
| #define PYBIND11_CATCH_INIT_EXCEPTIONS |
Definition at line 231 of file detail/common.h.
| #define PYBIND11_CHECK_PYTHON_VERSION |
Definition at line 215 of file detail/common.h.
| #define PYBIND11_CONCAT | ( | first, | |
| second | |||
| ) | first##second |
Definition at line 213 of file detail/common.h.
| #define PYBIND11_DEPRECATED | ( | reason | ) | __attribute__((deprecated(reason))) |
Definition at line 92 of file detail/common.h.
| #define PYBIND11_EXPAND_SIDE_EFFECTS | ( | PATTERN | ) | pybind11::detail::expand_side_effects{ ((PATTERN), void(), false)..., false } |
Definition at line 651 of file detail/common.h.
| #define PYBIND11_EXPORT __attribute__ ((visibility("default"))) |
Definition at line 79 of file detail/common.h.
| #define PYBIND11_FROM_STRING PyString_FromString |
Definition at line 189 of file detail/common.h.
| #define PYBIND11_INSTANCE_METHOD_CHECK PyMethod_Check |
Definition at line 174 of file detail/common.h.
| #define PYBIND11_INSTANCE_METHOD_GET_FUNCTION PyMethod_GET_FUNCTION |
Definition at line 175 of file detail/common.h.
Include Python header, disable linking to pythonX_d.lib on Windows in debug mode.
Compatibility macros for various Python versions
Definition at line 173 of file detail/common.h.
| #define PYBIND11_LONG_AS_LONGLONG | ( | o | ) | (PyInt_Check(o) ? (long long) PyLong_AsLong(o) : PyLong_AsLongLong(o)) |
Definition at line 183 of file detail/common.h.
| #define PYBIND11_LONG_CHECK | ( | o | ) | (PyInt_Check(o) || PyLong_Check(o)) |
Definition at line 182 of file detail/common.h.
| #define PYBIND11_LONG_FROM_SIGNED | ( | o | ) | PyInt_FromSsize_t((ssize_t) o) |
Definition at line 184 of file detail/common.h.
| #define PYBIND11_LONG_FROM_UNSIGNED | ( | o | ) | PyInt_FromSize_t((size_t) o) |
Definition at line 185 of file detail/common.h.
| #define PYBIND11_MODULE | ( | name, | |
| variable | |||
| ) |
This macro creates the entry point that will be invoked when the Python interpreter imports an extension module. The module name is given as the fist argument and it should not be in quotes. The second macro argument defines a variable of type py::module which can be used to initialize the module.
.. code-block:: cpp
PYBIND11_MODULE(example, m) {
m.doc() = "pybind11 example module";
Add bindings here m.def("foo", []() { return "Hello, World!"; }); }
Definition at line 283 of file detail/common.h.
| #define PYBIND11_NAMESPACE pybind11 |
Definition at line 26 of file detail/common.h.
| #define PYBIND11_NB_BOOL | ( | ptr | ) | ((ptr)->nb_nonzero) |
Definition at line 192 of file detail/common.h.
| #define PYBIND11_NOINLINE __attribute__ ((noinline)) |
Definition at line 86 of file detail/common.h.
| #define PYBIND11_PLUGIN | ( | name | ) |
Deprecated in favor of PYBIND11_MODULE***
This macro creates the entry point that will be invoked when the Python interpreter imports a plugin library. Please create a module in the function body and return the pointer to its underlying Python object at the end.
.. code-block:: cpp
PYBIND11_PLUGIN(example) {
pybind11::module m("example", "pybind11 example plugin");
/ Set up bindings here return m.ptr(); }
Definition at line 255 of file detail/common.h.
| #define PYBIND11_PLUGIN_IMPL | ( | name | ) |
Definition at line 194 of file detail/common.h.
| #define PYBIND11_RUNTIME_EXCEPTION | ( | name, | |
| type | |||
| ) |
Definition at line 664 of file detail/common.h.
| #define PYBIND11_SLICE_OBJECT PySliceObject |
Definition at line 188 of file detail/common.h.
| #define PYBIND11_STR_TYPE ::pybind11::bytes |
Definition at line 190 of file detail/common.h.
| #define PYBIND11_STRING_NAME "unicode" |
Definition at line 187 of file detail/common.h.
| #define PYBIND11_STRINGIFY | ( | x | ) | #x |
Definition at line 211 of file detail/common.h.
| #define PYBIND11_TOSTRING | ( | x | ) | PYBIND11_STRINGIFY(x) |
Definition at line 212 of file detail/common.h.
| #define PYBIND11_TRY_NEXT_OVERLOAD ((PyObject *) 1) |
Definition at line 210 of file detail/common.h.
| #define PYBIND11_VERSION_MAJOR 2 |
Definition at line 95 of file detail/common.h.
| #define PYBIND11_VERSION_MINOR 3 |
Definition at line 96 of file detail/common.h.
| #define PYBIND11_VERSION_PATCH dev1 |
Definition at line 97 of file detail/common.h.
1.8.13