Archived
This forum has been archived. Please start a new discussion on GitHub.
Transfering classes between Python and C++
gmueckl
in Help Center
Hi!
I've got the following problem: I'm considering to port an application which doing considerable mathematical stuff over to Ice, but that would require me to use both C++ and Python interfaces. Now the problem is that we so far have written all the math classes in C++ and we would need to be able to create copies of them in Python. To this end, the class slice type would get me the class copied, but that would end up with a reimplementation of all the math code in Python, which would be serious code duplication.
Can you suggest a way in which we can use the C++ implementation of the classes in Python client processes? My current thoughts are about using the current boost::python wrapper to the C++ code and the required Python class factories to create classes which are derived from both the slice base interface and the C++ classes. Could that approach work?
I've got the following problem: I'm considering to port an application which doing considerable mathematical stuff over to Ice, but that would require me to use both C++ and Python interfaces. Now the problem is that we so far have written all the math classes in C++ and we would need to be able to create copies of them in Python. To this end, the class slice type would get me the class copied, but that would end up with a reimplementation of all the math code in Python, which would be serious code duplication.
Can you suggest a way in which we can use the C++ implementation of the classes in Python client processes? My current thoughts are about using the current boost::python wrapper to the C++ code and the required Python class factories to create classes which are derived from both the slice base interface and the C++ classes. Could that approach work?
0
