os/ossrv/ossrv_pub/boost_apis/boost/python/object/instance.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/python/object/instance.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,51 @@
     1.4 +// Copyright David Abrahams 2002.
     1.5 +// Distributed under the Boost Software License, Version 1.0. (See
     1.6 +// accompanying file LICENSE_1_0.txt or copy at
     1.7 +// http://www.boost.org/LICENSE_1_0.txt)
     1.8 +#ifndef INSTANCE_DWA200295_HPP
     1.9 +# define INSTANCE_DWA200295_HPP
    1.10 +
    1.11 +# include <boost/python/detail/prefix.hpp>
    1.12 +# include <boost/type_traits/alignment_traits.hpp>
    1.13 +# include <cstddef>
    1.14 +
    1.15 +namespace boost { namespace python
    1.16 +{
    1.17 +  struct BOOST_PYTHON_DECL_FORWARD instance_holder;
    1.18 +}} // namespace boost::python
    1.19 +
    1.20 +namespace boost { namespace python { namespace objects { 
    1.21 +
    1.22 +// Each extension instance will be one of these
    1.23 +template <class Data = char>
    1.24 +struct instance
    1.25 +{
    1.26 +    PyObject_VAR_HEAD
    1.27 +    PyObject* dict;
    1.28 +    PyObject* weakrefs; 
    1.29 +    instance_holder* objects;
    1.30 +
    1.31 +    typedef typename type_with_alignment<
    1.32 +        ::boost::alignment_of<Data>::value
    1.33 +    >::type align_t;
    1.34 +          
    1.35 +    union
    1.36 +    {
    1.37 +        align_t align;
    1.38 +        char bytes[sizeof(Data)];
    1.39 +    } storage;
    1.40 +};
    1.41 +
    1.42 +template <class Data>
    1.43 +struct additional_instance_size
    1.44 +{
    1.45 +    typedef instance<Data> instance_data;
    1.46 +    typedef instance<char> instance_char;
    1.47 +    BOOST_STATIC_CONSTANT(
    1.48 +        std::size_t, value = sizeof(instance_data)
    1.49 +                           - BOOST_PYTHON_OFFSETOF(instance_char,storage));
    1.50 +};
    1.51 +
    1.52 +}}} // namespace boost::python::object
    1.53 +
    1.54 +#endif // INSTANCE_DWA200295_HPP