annotate DEPENDENCIES/generic/include/boost/mpi/python.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>
Chris@16 2
Chris@16 3 // Use, modification and distribution is subject to the Boost Software
Chris@16 4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 5 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6
Chris@16 7 // Authors: Douglas Gregor
Chris@16 8 #ifndef BOOST_MPI_PYTHON_HPP
Chris@16 9 #define BOOST_MPI_PYTHON_HPP
Chris@16 10
Chris@16 11 #include <boost/python/object.hpp>
Chris@16 12
Chris@16 13 /** @file python.hpp
Chris@16 14 *
Chris@16 15 * This header interacts with the Python bindings for Boost.MPI. The
Chris@16 16 * routines in this header can be used to register user-defined and
Chris@16 17 * library-defined data types with Boost.MPI for efficient
Chris@16 18 * (de-)serialization and separate transmission of skeletons and
Chris@16 19 * content.
Chris@16 20 *
Chris@16 21 */
Chris@16 22
Chris@16 23 namespace boost { namespace mpi { namespace python {
Chris@16 24
Chris@16 25 /**
Chris@16 26 * @brief Register the type T for direct serialization within Boost.MPI
Chris@16 27 *
Chris@16 28 * The @c register_serialized function registers a C++ type for direct
Chris@16 29 * serialization within Boost.MPI. Direct serialization elides the use
Chris@16 30 * of the Python @c pickle package when serializing Python objects
Chris@16 31 * that represent C++ values. Direct serialization can be beneficial
Chris@16 32 * both to improve serialization performance (Python pickling can be
Chris@16 33 * very inefficient) and to permit serialization for Python-wrapped
Chris@16 34 * C++ objects that do not support pickling.
Chris@16 35 *
Chris@16 36 * @param value A sample value of the type @c T. This may be used
Chris@16 37 * to compute the Python type associated with the C++ type @c T.
Chris@16 38 *
Chris@16 39 * @param type The Python type associated with the C++ type @c
Chris@16 40 * T. If not provided, it will be computed from the same value @p
Chris@16 41 * value.
Chris@16 42 */
Chris@16 43 template<typename T>
Chris@16 44 void
Chris@16 45 register_serialized(const T& value = T(), PyTypeObject* type = 0);
Chris@16 46
Chris@16 47 /**
Chris@16 48 * @brief Registers a type for use with the skeleton/content mechanism
Chris@16 49 * in Python.
Chris@16 50 *
Chris@16 51 * The skeleton/content mechanism can only be used from Python with
Chris@16 52 * C++ types that have previously been registered via a call to this
Chris@16 53 * function. Both the sender and the transmitter must register the
Chris@16 54 * type. It is permitted to call this function multiple times for the
Chris@16 55 * same type @c T, but only one call per process per type is
Chris@16 56 * required. The type @c T must be Serializable.
Chris@16 57 *
Chris@16 58 * @param value A sample object of type T that will be used to
Chris@16 59 * determine the Python type associated with T, if @p type is not
Chris@16 60 * specified.
Chris@16 61 *
Chris@16 62 * @param type The Python type associated with the C++ type @c
Chris@16 63 * T. If not provided, it will be computed from the same value @p
Chris@16 64 * value.
Chris@16 65 */
Chris@16 66 template<typename T>
Chris@16 67 void
Chris@16 68 register_skeleton_and_content(const T& value = T(), PyTypeObject* type = 0);
Chris@16 69
Chris@16 70 } } } // end namespace boost::mpi::python
Chris@16 71
Chris@16 72 #ifndef BOOST_MPI_PYTHON_FORWARD_ONLY
Chris@16 73 # include <boost/mpi/python/serialize.hpp>
Chris@16 74 # include <boost/mpi/python/skeleton_and_content.hpp>
Chris@16 75 #else
Chris@16 76 # undef BOOST_MPI_PYTHON_FORWARD_ONLY
Chris@16 77 #endif
Chris@16 78
Chris@16 79 #endif // BOOST_MPI_PYTHON_HPP