C++ で記述され、Boost.Python の助けを借りて Python に公開されたクラスと API がたくさんあります。
私は現在、次のアーキテクチャを作成する可能性を調査しています。
パイソンでは:
from boostPythonModule import *
AddFunction( boostPythonObject.Method1, args )
AddFunction( boostPythonObject.Method2, args )
AddFunction( boostPythonObject.Method2, args )
RunAll( ) # running is done by C++
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
}
基本的に、すべての関数をプログラムのネイティブ部分に配置しようとしています。問題は、Boost メタ情報から必要なすべてのデータを抽出して一般的な方法でこれを行うことができるかどうかわからないということです。コンパイル時に、呼び出す関数とそれらが受け入れる引数を知る必要はありません。
いくつかの質問:
1. このようなものを確認するためにアクセスできる共有 Python 情報テーブルはありますか?
2. Boost.Python は型引数のチェックを行います。別々に再利用できますか?
あなたの考えを聞かせてください。
ありがとう