annotate python_to_octave.h @ 375:d0a7f66393fc

Fix __py_class_name__ tests to work with Python 2 * __py_struct_from_dict__.cc: Fix __py_class_name__ tests to work with Python 2.
author Mike Miller <mtmiller@octave.org>
date Fri, 26 Aug 2016 18:51:29 -0700
parents a7d597726985
children 09a1acb81d8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
4da14cce0890 First launchpad.net check in.
David Grundberg <c04dgg@cs.umu.se>
parents:
diff changeset
1 /*
139
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
2
150
a3dc9d24ae38 maint: Add myself to copyright notices
Mike Miller <mtmiller@octave.org>
parents: 146
diff changeset
3 Copyright (C) 2015-2016 Mike Miller
139
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
4 Copyright (C) 2008 David Grundberg, HÃ¥kan Fors Nilsson
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
5
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
6 This file is part of Pytave.
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
7
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
8 Pytave is free software: you can redistribute it and/or modify it
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
9 under the terms of the GNU General Public License as published by the
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
10 Free Software Foundation, either version 3 of the License, or (at your
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
11 option) any later version.
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
12
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
13 Pytave is distributed in the hope that it will be useful, but WITHOUT
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
16 for more details.
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
17
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
18 You should have received a copy of the GNU General Public License
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
19 along with Pytave; see the file COPYING. If not, see
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
20 <http://www.gnu.org/licenses/>.
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
21
b12908ffa6df maint: Use Octave style for file copyright block, delete editor footer
Mike Miller <mtmiller@octave.org>
parents: 40
diff changeset
22 */
0
4da14cce0890 First launchpad.net check in.
David Grundberg <c04dgg@cs.umu.se>
parents:
diff changeset
23
174
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
24 /*! \file python_to_octave.h
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
25 \brief Conversion of data values from Python to GNU Octave
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
26
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
27 The functions in this file define the translation of Python
175
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
28 objects to GNU Octave values using the Boost.Python library and
174
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
29 the Octave/C++ API.
175
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
30
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
31 Features and capabilities of Octave's Python interface include:
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
32
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
33 - Import and call Python modules and functions from the Octave interpreter
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
34
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
35 - Automatically convert basic Octave and Python types seamlessly between the two environments
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
36
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
37 - \todo Be able to handle arbitrary unknown Python objects (print their repr, store in a variable, pass back in to a Python function)
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
38
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
39 - \todo Store references to Python functions (and other "callables") and be able to call them as if they were function handles
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
40
174
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
41 */
053253436eb6 doc: general documentation for python_to_octave.h file
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 169
diff changeset
42
141
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
43 #if ! defined (pytave_python_to_octave_h)
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
44 #define pytave_python_to_octave_h
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
45
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
46 #include <boost/python.hpp>
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
47 #include <ov.h>
0
4da14cce0890 First launchpad.net check in.
David Grundberg <c04dgg@cs.umu.se>
parents:
diff changeset
48
146
8e3d06f2f5cf Use Octave coding style for C++ sources, PEP8 style for Python sources
Mike Miller <mtmiller@octave.org>
parents: 141
diff changeset
49 namespace pytave
8e3d06f2f5cf Use Octave coding style for C++ sources, PEP8 style for Python sources
Mike Miller <mtmiller@octave.org>
parents: 141
diff changeset
50 {
175
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
51
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
52 //! Conversion from any Python object to an Octave value object.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
53 /*!
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
54 \param oct_value a reference to octave_value to store the result of the conversion.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
55 \param py_object a constant reference to a boost::python::object that contains the object to be converted.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
56 \see octvalue_to_pyobj
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
57 */
146
8e3d06f2f5cf Use Octave coding style for C++ sources, PEP8 style for Python sources
Mike Miller <mtmiller@octave.org>
parents: 141
diff changeset
58 void pyobj_to_octvalue (octave_value& oct_value,
8e3d06f2f5cf Use Octave coding style for C++ sources, PEP8 style for Python sources
Mike Miller <mtmiller@octave.org>
parents: 141
diff changeset
59 const boost::python::object& py_object);
175
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
60
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
61 //! Python tuples are converted to Octave value list objects.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
62 /*!
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
63 \param oct_list a reference to octave_value_list to store the result of the conversion.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
64 \param py_tuple a constant reference to a boost::python::tuple that contains the tuple to be converted.
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
65 \see octlist_to_pytuple
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
66 */
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
67 void pytuple_to_octlist (octave_value_list& oct_list,
a7d597726985 doc: doxygen config file and documentation
Juan Pablo Carbajal <ajuanpi+dev@gmail.com>
parents: 174
diff changeset
68 const boost::python::tuple& py_tuple);
0
4da14cce0890 First launchpad.net check in.
David Grundberg <c04dgg@cs.umu.se>
parents:
diff changeset
69 }
4da14cce0890 First launchpad.net check in.
David Grundberg <c04dgg@cs.umu.se>
parents:
diff changeset
70
141
4e5a620758fc Use consistent Octave style for header files
Mike Miller <mtmiller@octave.org>
parents: 139
diff changeset
71 #endif