I have a bunch of classes and APIs written in C++ and exposed to Python with help of Boost.Python
I am currently investigating the possibilities of creating the following architecture.
In python:
from boostPythonModule import *
AddFunction( boostPythonObject.Method1, args )
AddFunction( boostPythonObject.Method2, args )
AddFunction( boostPythonObject.Method2, args )
RunAll( ) # running is done by C++
In C++:
void AddFunction( boost::object method, boost::object args )
{
/// 1. Here i need to extract a real pointer to a function
/// 2. Make argument and type checking for a function under method
/// 3. Unpack all arguments to native types
/// 4. Store the pointer to a function somewhere in local storage
}
void RunAll( )
{
/// 1. run all previously stored functions and arguments for them
}
Basically I am trying to put all functions down to the native part of my program. The thing is that I am not sure if it's possible to extract all required data from Boost metainfo to do this in generic way - at compile time I should not know what functions I'm gonna call and what arguments they accept.
Few questions:
1. Is there any shared Python info tables I can access to check for some of this stuff ?
2. Boost.Python does type arguments checking. Can it be reused separately ?
Let me know your thoughts.
Thanks
AddFunction()? Wouldn't it be enough just to store the method and arguments somewhere and call those methods inRunAll()That way you would get any type related error you run into when you execute the methods and Boost.Python would do it for you.