From 01a529b46fd4af3fd19488f93e5e569e6ee9fc7e Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Tue, 3 Jan 2017 11:40:38 +0100 Subject: [PATCH] cleaned the common.h --- src/common.h | 108 --------------------------------------------------- 1 file changed, 108 deletions(-) diff --git a/src/common.h b/src/common.h index b7da720..7fbfb27 100644 --- a/src/common.h +++ b/src/common.h @@ -1,10 +1,3 @@ -/* - * common.h - * - * Created on: 15 Apr 2016 - * Author: hbruintjes - */ - #pragma once #include "config.h" @@ -27,104 +20,3 @@ using namespace pybind11::literals; PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr) PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr) - -namespace pybind11 { -namespace detail { -/** - * Dummy type caster for handle, so functions can return pybind11 handles directly - */ -/*template <> class type_caster { -public: - bool load(handle src, bool) { - value = handle(src).inc_ref(); - return true; - } - - static handle cast(handle src, return_value_policy policy, handle parent) { - switch(policy) { - case return_value_policy::automatic: - case return_value_policy::copy: - case return_value_policy::take_ownership: - return handle(src); - case return_value_policy::reference: - return handle(src).inc_ref(); - case return_value_policy::reference_internal: - parent.inc_ref(); - return handle(src); - } - return handle(src); - } - PYBIND11_TYPE_CASTER(handle, _("handle")); -};*/ -/* -template struct tuple_caster { - typedef TupleType type; - template - using type_conv = type_caster::type>; - - bool load(handle src, bool convert) { - pybind11::tuple tup(src, true); - if (!tup.check()) - return false; - - return loadItem<0, Keys...>(tup, convert); - } - - static handle cast(const type &src, return_value_policy policy, handle parent) { - pybind11::tuple tup(sizeof...(Keys)); - if (!castItem<0, Keys...>(tup, src, policy, parent)) { - return handle(); - } - - return tup.release(); - } - -private: - template - bool loadItem(pybind11::tuple& tup, bool convert) { - type_conv conv; - if (!conv.load(tup[N], convert)) - return false; - std::get(value) = static_cast(conv); - return loadItem(tup, convert); - } - - template - bool loadItem(pybind11::tuple& tup, bool convert) { - type_conv conv; - if (!conv.load(tup[N], convert)) - return false; - std::get(value) = static_cast(conv); - return true; - } - - template - static bool castItem(pybind11::tuple& tup, const type &src, return_value_policy policy, handle parent) { - auto obj = type_conv::cast(std::get(src), policy, parent); - object value_ = object(obj, false); - if (!obj) { - return false; - } - return castItem(tup, src, policy, parent); - } - - template - static bool castItem(pybind11::tuple& tu, const type &src, return_value_policy policy, handle parent) { - auto obj = type_conv::cast(std::get(src), policy, parent); - object value_ = object(obj, false); - if (!obj) { - return false; - } - return true; - } -}; - -template struct type_caster> - : tuple_caster, Types...> { }; - -template struct type_caster> - : tuple_caster, Type1, Type2> { }; -*/ - -} -}