/
usr
/
include
/
boost
/
python
/
/usr/include/boost/python
mkdir
upload
Name
Size
Mode
Actions
converter/
-
0755
rm
detail/
-
0755
rm
numpy/
-
0755
rm
object/
-
0755
rm
suite/
-
0755
rm
args.hpp
4194
0644
edit
dl
rm
args_fwd.hpp
1186
0644
edit
dl
rm
arg_from_python.hpp
2000
0644
edit
dl
rm
back_reference.hpp
1463
0644
edit
dl
rm
bases.hpp
1481
0644
edit
dl
rm
base_type_traits.hpp
878
0644
edit
dl
rm
borrowed.hpp
568
0644
edit
dl
rm
call.hpp
2749
0644
edit
dl
rm
call_method.hpp
2859
0644
edit
dl
rm
cast.hpp
2954
0644
edit
dl
rm
class.hpp
17866
0644
edit
dl
rm
class_fwd.hpp
772
0644
edit
dl
rm
copy_const_reference.hpp
1101
0644
edit
dl
rm
copy_non_const_reference.hpp
1141
0644
edit
dl
rm
data_members.hpp
9593
0644
edit
dl
rm
def.hpp
3187
0644
edit
dl
rm
default_call_policies.hpp
2279
0644
edit
dl
rm
def_visitor.hpp
2483
0644
edit
dl
rm
dict.hpp
3866
0644
edit
dl
rm
docstring_options.hpp
3505
0644
edit
dl
rm
enum.hpp
2999
0644
edit
dl
rm
errors.hpp
1397
0644
edit
dl
rm
exception_translator.hpp
939
0644
edit
dl
rm
exec.hpp
1756
0644
edit
dl
rm
extract.hpp
5988
0644
edit
dl
rm
handle.hpp
4503
0644
edit
dl
rm
handle_fwd.hpp
455
0644
edit
dl
rm
has_back_reference.hpp
654
0644
edit
dl
rm
implicit.hpp
1111
0644
edit
dl
rm
import.hpp
476
0644
edit
dl
rm
init.hpp
11490
0644
edit
dl
rm
instance_holder.hpp
2063
0644
edit
dl
rm
iterator.hpp
4308
0644
edit
dl
rm
list.hpp
3611
0644
edit
dl
rm
long.hpp
1637
0644
edit
dl
rm
lvalue_from_pytype.hpp
3614
0644
edit
dl
rm
make_constructor.hpp
8579
0644
edit
dl
rm
make_function.hpp
4482
0644
edit
dl
rm
manage_new_object.hpp
1087
0644
edit
dl
rm
module.hpp
425
0644
edit
dl
rm
module_init.hpp
2173
0644
edit
dl
rm
numpy.hpp
1120
0644
edit
dl
rm
object.hpp
851
0644
edit
dl
rm
object_attributes.hpp
3019
0644
edit
dl
rm
object_call.hpp
810
0644
edit
dl
rm
object_core.hpp
13329
0644
edit
dl
rm
object_fwd.hpp
462
0644
edit
dl
rm
object_items.hpp
1974
0644
edit
dl
rm
object_operators.hpp
4494
0644
edit
dl
rm
object_protocol.hpp
2730
0644
edit
dl
rm
object_protocol_core.hpp
2080
0644
edit
dl
rm
object_slices.hpp
4090
0644
edit
dl
rm
opaque_pointer_converter.hpp
5929
0644
edit
dl
rm
operators.hpp
14278
0644
edit
dl
rm
other.hpp
901
0644
edit
dl
rm
overloads.hpp
437
0644
edit
dl
rm
override.hpp
3538
0644
edit
dl
rm
pointee.hpp
892
0644
edit
dl
rm
proxy.hpp
2653
0644
edit
dl
rm
ptr.hpp
1239
0644
edit
dl
rm
pure_virtual.hpp
3655
0644
edit
dl
rm
raw_function.hpp
1483
0644
edit
dl
rm
refcount.hpp
960
0644
edit
dl
rm
reference_existing_object.hpp
1310
0644
edit
dl
rm
register_ptr_to_python.hpp
769
0644
edit
dl
rm
return_arg.hpp
2799
0644
edit
dl
rm
return_by_value.hpp
724
0644
edit
dl
rm
return_internal_reference.hpp
1285
0644
edit
dl
rm
return_opaque_pointer.hpp
1290
0644
edit
dl
rm
return_value_policy.hpp
675
0644
edit
dl
rm
scope.hpp
1878
0644
edit
dl
rm
self.hpp
889
0644
edit
dl
rm
signature.hpp
7579
0644
edit
dl
rm
slice.hpp
10643
0644
edit
dl
rm
slice_nil.hpp
912
0644
edit
dl
rm
ssize_t.hpp
735
0644
edit
dl
rm
stl_iterator.hpp
1325
0644
edit
dl
rm
str.hpp
10765
0644
edit
dl
rm
tag.hpp
538
0644
edit
dl
rm
to_python_converter.hpp
2431
0644
edit
dl
rm
to_python_indirect.hpp
2973
0644
edit
dl
rm
to_python_value.hpp
5574
0644
edit
dl
rm
tuple.hpp
1758
0644
edit
dl
rm
type_id.hpp
5262
0644
edit
dl
rm
with_custodian_and_ward.hpp
3546
0644
edit
dl
rm
wrapper.hpp
1023
0644
edit
dl
rm
Edit:
/usr/include/boost/python/data_members.hpp
(9593B)
// Copyright David Abrahams 2002. // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef DATA_MEMBERS_DWA2002328_HPP # define DATA_MEMBERS_DWA2002328_HPP # include <boost/python/detail/prefix.hpp> # include <boost/python/handle.hpp> # include <boost/python/return_value_policy.hpp> # include <boost/python/return_by_value.hpp> # include <boost/python/return_internal_reference.hpp> # include <boost/python/make_function.hpp> # include <boost/python/converter/builtin_converters.hpp> # include <boost/python/detail/indirect_traits.hpp> # include <boost/python/detail/not_specified.hpp> # include <boost/python/detail/value_arg.hpp> # include <boost/python/detail/type_traits.hpp> # include <boost/mpl/eval_if.hpp> # include <boost/mpl/if.hpp> # include <boost/mpl/vector/vector10.hpp> # include <boost/detail/workaround.hpp> namespace boost { namespace python { // // This file defines the make_getter and make_setter function // families, which are responsible for turning pointers, references, // and pointers-to-data-members into callable Python objects which // can be used for attribute access on wrapped classes. // namespace detail { // A small function object which handles the getting and setting of // data members. template <class Data, class Class> struct member { public: member(Data Class::*which) : m_which(which) {} Data& operator()(Class& c) const { return c.*m_which; } void operator()(Class& c, typename value_arg<Data>::type d) const { c.*m_which = d; } private: Data Class::*m_which; }; // A small function object which handles the getting and setting of // non-member objects. template <class Data> struct datum { public: datum(Data *which) : m_which(which) {} Data& operator()() const { return *m_which; } void operator()(typename value_arg<Data>::type d) const { *m_which = d; } private: Data *m_which; }; // // Helper metafunction for determining the default CallPolicy to use // for attribute access. If T is a [reference to a] class type X // whose conversion to python would normally produce a new copy of X // in a wrapped X class instance (as opposed to types such as // std::string, which are converted to native Python types, and // smart pointer types which produce a wrapped class instance of the // pointee type), to-python conversions will attempt to produce an // object which refers to the original C++ object, rather than a // copy. See default_member_getter_policy for rationale. // template <class T> struct default_getter_by_ref : mpl::and_< mpl::bool_< to_python_value< typename value_arg<T>::type >::uses_registry > , indirect_traits::is_reference_to_class< typename value_arg<T>::type > > { }; // Metafunction computing the default CallPolicy to use for reading // data members // // If it's a regular class type (not an object manager or other // type for which we have to_python specializations, use // return_internal_reference so that we can do things like // x.y.z = 1 // and get the right result. template <class T> struct default_member_getter_policy : mpl::if_< default_getter_by_ref<T> , return_internal_reference<> , return_value_policy<return_by_value> > {}; // Metafunction computing the default CallPolicy to use for reading // non-member data. template <class T> struct default_datum_getter_policy : mpl::if_< default_getter_by_ref<T> , return_value_policy<reference_existing_object> , return_value_policy<return_by_value> > {}; // // make_getter helper function family -- These helpers to // boost::python::make_getter are used to dispatch behavior. The // third argument is a workaround for a CWPro8 partial ordering bug // with pointers to data members. It should be convertible to // detail::true_ iff the first argument is a pointer-to-member, and // detail::false_ otherwise. The fourth argument is for compilers // which don't support partial ordering at all and should always be // passed 0L. #if BOOST_WORKAROUND(__EDG_VERSION__, <= 238) template <class D, class P> inline object make_getter(D& d, P& p, detail::false_, ...); #endif // Handle non-member pointers with policies template <class D, class Policies> inline object make_getter(D* d, Policies const& policies, detail::false_, int) { return python::make_function( detail::datum<D>(d), policies, mpl::vector1<D&>() ); } // Handle non-member pointers without policies template <class D> inline object make_getter(D* d, not_specified, detail::false_, long) { typedef typename default_datum_getter_policy<D>::type policies; return detail::make_getter(d, policies(), detail::false_(), 0); } // Handle pointers-to-members with policies template <class C, class D, class Policies> inline object make_getter(D C::*pm, Policies const& policies, detail::true_, int) { #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) typedef typename detail::remove_cv<C>::type Class; #else typedef C Class; #endif return python::make_function( detail::member<D,Class>(pm) , policies , mpl::vector2<D&,Class&>() ); } // Handle pointers-to-members without policies template <class C, class D> inline object make_getter(D C::*pm, not_specified, detail::true_, long) { typedef typename default_member_getter_policy<D>::type policies; return detail::make_getter(pm, policies(), detail::true_(), 0); } // Handle references template <class D, class P> inline object make_getter(D& d, P& p, detail::false_, ...) { // Just dispatch to the handler for pointer types. return detail::make_getter(&d, p, detail::false_(), 0L); } // // make_setter helper function family -- These helpers to // boost::python::make_setter are used to dispatch behavior. The // third argument is for compilers which don't support partial // ordering at all and should always be passed 0. // // Handle non-member pointers template <class D, class Policies> inline object make_setter(D* p, Policies const& policies, detail::false_, int) { return python::make_function( detail::datum<D>(p), policies, mpl::vector2<void,D const&>() ); } // Handle pointers-to-members template <class C, class D, class Policies> inline object make_setter(D C::*pm, Policies const& policies, detail::true_, int) { return python::make_function( detail::member<D,C>(pm) , policies , mpl::vector3<void, C&, D const&>() ); } // Handle references template <class D, class Policies> inline object make_setter(D& x, Policies const& policies, detail::false_, ...) { return detail::make_setter(&x, policies, detail::false_(), 0L); } } // // make_getter function family -- build a callable object which // retrieves data through the first argument and is appropriate for // use as the `get' function in Python properties . The second, // policies argument, is optional. We need both D& and D const& // overloads in order be able to handle rvalues. // template <class D, class Policies> inline object make_getter(D& d, Policies const& policies) { return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L); } template <class D, class Policies> inline object make_getter(D const& d, Policies const& policies) { return detail::make_getter(d, policies, detail::is_member_pointer<D>(), 0L); } template <class D> inline object make_getter(D& x) { detail::not_specified policy = detail::not_specified(); // suppress a SunPro warning return detail::make_getter(x, policy, detail::is_member_pointer<D>(), 0L); } # if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) template <class D> inline object make_getter(D const& d) { detail::not_specified policy = detail::not_specified(); // Suppress a SunPro warning return detail::make_getter(d, policy, detail::is_member_pointer<D>(), 0L); } # endif // // make_setter function family -- build a callable object which // writes data through the first argument and is appropriate for // use as the `set' function in Python properties . The second, // policies argument, is optional. We need both D& and D const& // overloads in order be able to handle rvalues. // template <class D, class Policies> inline object make_setter(D& x, Policies const& policies) { return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0); } template <class D, class Policies> inline object make_setter(D const& x, Policies const& policies) { return detail::make_setter(x, policies, detail::is_member_pointer<D>(), 0); } template <class D> inline object make_setter(D& x) { return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0); } # if !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) template <class D> inline object make_setter(D const& x) { return detail::make_setter(x, default_call_policies(), detail::is_member_pointer<D>(), 0); } # endif }} // namespace boost::python #endif // DATA_MEMBERS_DWA2002328_HPP
Save
cmd:
run