SIGVerse with Python

Allowing natural assignment from C++ data type to Python data types and vice-versa is very important for seamless embedding of Python inside C++ Sigverse code To allow this kind of natural assignment, boost.python provides a system for registering converters between the languages

The aim of this tutorial is to show:

  • converting C++ data type to Python data type
  • converting Python data type to C++ data type
  • modifying both C++ and Python data type together

For instance, assigning an STL string to a python object looks like this:

Likewise, it is also important to be able to extract C++ objects from Python objects. Boost.python provides the extract type for this:

Please use the following code for onAction() function by using the complete code provided in the previous tutorial.

Please use the world file and Makefile provided in previous tutorial and use

    $make
    $sigserver.sh -w ./WorldSample.xml -p write_your_port_number

After the world file loads into sigviewer please push "Start". You shall see the following output in console

   42
   100
   142

This shows that aim of this tutorial to use boost converters from C++ to Python and vice versa have been accomplished.

If someone wants an advanced reference, please refer the following tutorial on how to write boost converters.

Counter: 10335, today: 2, yesterday: 2

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2013-12-28 (Sat) 14:21:41 (3764d)