Classes | Typedefs | Functions
type_caster_base.h File Reference
#include "../pytypes.h"
#include "common.h"
#include "descr.h"
#include "internals.h"
#include "typeid.h"
#include <cstdint>
#include <iterator>
#include <new>
#include <string>
#include <type_traits>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <utility>
#include <vector>
Include dependency graph for type_caster_base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  container_mapped_type_traits< Container, SFINAE >
 
struct  container_mapped_type_traits< Container, typename std::enable_if< negation< std::is_same< typename Container::mapped_type, Container > >::value >::type >
 
struct  container_mapped_type_traits< Container, typename std::enable_if< std::is_same< typename Container::mapped_type, Container >::value >::type >
 
struct  container_value_type_traits< Container, SFINAE >
 
struct  container_value_type_traits< Container, typename std::enable_if< negation< std::is_same< typename Container::value_type, Container > >::value >::type >
 
struct  container_value_type_traits< Container, typename std::enable_if< std::is_same< typename Container::value_type, Container >::value >::type >
 
struct  impl_recursive_container_traits< Container, SFINAE >
 
struct  impl_recursive_container_traits< Container, typename std::enable_if< container_value_type_traits< Container >::has_value_type >::type >
 
struct  impl_type_to_check_recursively< T, is_this_a_map >
 
struct  impl_type_to_check_recursively< std::pair< A, B >, true >
 
struct  is_copy_assignable< T >
 
struct  is_copy_assignable< recursive_bottom >
 
struct  is_copy_assignable< std::pair< T1, T2 > >
 
struct  is_copy_constructible< T >
 
struct  is_copy_constructible< recursive_bottom >
 
struct  is_copy_constructible< std::pair< T1, T2 > >
 
struct  is_move_constructible< T >
 
struct  is_move_constructible< recursive_bottom >
 
struct  is_move_constructible< std::pair< T1, T2 > >
 
struct  values_and_holders::iterator
 
class  loader_life_support
 
struct  polymorphic_type_hook< itype, SFINAE >
 
struct  polymorphic_type_hook_base< itype, SFINAE >
 
struct  polymorphic_type_hook_base< itype, detail::enable_if_t< std::is_polymorphic< itype >::value > >
 
struct  recursive_bottom
 
struct  recursive_container_traits< Container, SFINAE >
 
class  type_caster_base< type >
 Generic type caster for objects stored on the heap. More...
 
class  type_caster_generic
 
struct  value_and_holder
 
struct  values_and_holders
 

Typedefs

template<typename T >
using cast_op_type = conditional_t< std::is_pointer< remove_reference_t< T > >::value, typename std::add_pointer< intrinsic_t< T > >::type, typename std::add_lvalue_reference< intrinsic_t< T > >::type >
 
template<typename T >
using movable_cast_op_type = conditional_t< std::is_pointer< typename std::remove_reference< T >::type >::value, typename std::add_pointer< intrinsic_t< T > >::type, conditional_t< std::is_rvalue_reference< T >::value, typename std::add_rvalue_reference< intrinsic_t< T > >::type, typename std::add_lvalue_reference< intrinsic_t< T > >::type > >
 

Functions

const std::vector< detail::type_info * > & all_type_info (PyTypeObject *type)
 
std::pair< decltype(internals::registered_types_py)::iterator, bool > all_type_info_get_cache (PyTypeObject *type)
 
PYBIND11_NOINLINE void all_type_info_populate (PyTypeObject *t, std::vector< type_info * > &bases)
 
PYBIND11_NOINLINE handle find_registered_python_instance (void *src, const detail::type_info *tinfo)
 
detail::type_info * get_global_type_info (const std::type_index &tp)
 
detail::type_info * get_local_type_info (const std::type_index &tp)
 
PYBIND11_NOINLINE handle get_object_handle (const void *ptr, const detail::type_info *type)
 
PyThreadState * get_thread_state_unchecked ()
 
PYBIND11_NOINLINE handle get_type_handle (const std::type_info &tp, bool throw_if_missing)
 
PYBIND11_NOINLINE detail::type_info * get_type_info (const std::type_index &tp, bool throw_if_missing=false)
 
PYBIND11_NOINLINE detail::type_info * get_type_info (PyTypeObject *type)
 
PYBIND11_NOINLINE bool isinstance_generic (handle obj, const std::type_info &tp)
 
void keep_alive_impl (handle nurse, handle patient)
 
PyObject * make_new_instance (PyTypeObject *type)
 
PYBIND11_NOINLINE std::string type_info_description (const std::type_info &ti)
 

Typedef Documentation

◆ cast_op_type

template<typename T >
using cast_op_type = conditional_t<std::is_pointer<remove_reference_t<T> >::value, typename std::add_pointer<intrinsic_t<T> >::type, typename std::add_lvalue_reference<intrinsic_t<T> >::type>

Determine suitable casting operator for pointer-or-lvalue-casting type casters. The type caster needs to provide operator T*() and operator T&() operators.

If the type supports moving the value away via an operator T&&() && method, it should use movable_cast_op_type instead.

Definition at line 808 of file type_caster_base.h.

◆ movable_cast_op_type

template<typename T >
using movable_cast_op_type = conditional_t<std::is_pointer<typename std::remove_reference<T>::type>::value, typename std::add_pointer<intrinsic_t<T> >::type, conditional_t<std::is_rvalue_reference<T>::value, typename std::add_rvalue_reference<intrinsic_t<T> >::type, typename std::add_lvalue_reference<intrinsic_t<T> >::type> >

Determine suitable casting operator for a type caster with a movable value. Such a type caster needs to provide operator T*(), operator T&(), and operator T&&() &&. The latter will be called in appropriate contexts where the value can be moved rather than copied.

These operator are automatically provided when using the PYBIND11_TYPE_CASTER macro.

Definition at line 823 of file type_caster_base.h.

Function Documentation

◆ all_type_info()

const std::vector<detail::type_info *>& all_type_info ( PyTypeObject *  type)
inline

Extracts vector of type_info pointers of pybind-registered roots of the given Python type. Will be just 1 pybind type for the Python type of a pybind-registered class, or for any Python-side derived class that uses single inheritance. Will contain as many types as required for a Python class that uses multiple inheritance to inherit (directly or indirectly) from multiple pybind-registered classes. Will be empty if neither the type nor any base classes are pybind-registered.

The value is cached for the lifetime of the Python type.

Definition at line 169 of file type_caster_base.h.

◆ all_type_info_get_cache()

std::pair<decltype(internals::registered_types_py)::iterator, bool> all_type_info_get_cache ( PyTypeObject *  type)
inline

Definition at line 2273 of file pybind11.h.

◆ all_type_info_populate()

PYBIND11_NOINLINE void all_type_info_populate ( PyTypeObject *  t,
std::vector< type_info * > &  bases 
)

Definition at line 106 of file type_caster_base.h.

◆ find_registered_python_instance()

PYBIND11_NOINLINE handle find_registered_python_instance ( void *  src,
const detail::type_info *  tinfo 
)

Definition at line 240 of file type_caster_base.h.

◆ get_global_type_info()

detail::type_info* get_global_type_info ( const std::type_index &  tp)
inline

Definition at line 205 of file type_caster_base.h.

◆ get_local_type_info()

detail::type_info* get_local_type_info ( const std::type_index &  tp)
inline

Definition at line 196 of file type_caster_base.h.

◆ get_object_handle()

PYBIND11_NOINLINE handle get_object_handle ( const void *  ptr,
const detail::type_info *  type 
)

Definition at line 473 of file type_caster_base.h.

◆ get_thread_state_unchecked()

PyThreadState* get_thread_state_unchecked ( )
inline

Definition at line 486 of file type_caster_base.h.

◆ get_type_handle()

PYBIND11_NOINLINE handle get_type_handle ( const std::type_info &  tp,
bool  throw_if_missing 
)

Definition at line 234 of file type_caster_base.h.

◆ get_type_info() [1/2]

PYBIND11_NOINLINE detail::type_info* get_type_info ( const std::type_index &  tp,
bool  throw_if_missing = false 
)

Return the type info for a given C++ type; on lookup failure can either throw or return nullptr.

Definition at line 216 of file type_caster_base.h.

◆ get_type_info() [2/2]

PYBIND11_NOINLINE detail::type_info* get_type_info ( PyTypeObject *  type)

Gets a single pybind11 type info for a python type. Returns nullptr if neither the type nor any ancestors are pybind11-registered. Throws an exception if there are multiple bases–use all_type_info instead if you want to support multiple bases.

Definition at line 184 of file type_caster_base.h.

◆ isinstance_generic()

PYBIND11_NOINLINE bool isinstance_generic ( handle  obj,
const std::type_info &  tp 
)

Definition at line 465 of file type_caster_base.h.

◆ keep_alive_impl()

void keep_alive_impl ( handle  nurse,
handle  patient 
)

Definition at line 2224 of file pybind11.h.

◆ make_new_instance()

PyObject* make_new_instance ( PyTypeObject *  type)
inline

Instance creation function for all pybind11 types. It allocates the internal instance layout for holding C++ objects and holders. Allocation is done lazily (the first time the instance is cast to a reference or pointer), and initialization is done by an __init__ function.

Definition at line 349 of file class.h.

◆ type_info_description()

PYBIND11_NOINLINE std::string type_info_description ( const std::type_info &  ti)

Definition at line 1167 of file type_caster_base.h.



gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:11:46