I am trying to expose my Pyro to Python using C + + classes Boost. Here's a simple version of what I'm trying to do:
By promoting a class A to me: noncopyable and with a second class B method, which in terms of A takes away. I am showing the classes as follows: I expand B in Python like this: test.py: and thus call Extended B: Although it results in an error message: If the Any suggestions how to solve the problem? Thanks, but there is an option to remove noncopyable requirement on change See in the Boost Manual.
/ * Cover for B, then B can be extended into Python / struct BWP: Public B, Cover & lt; B & gt; {Cancel (A and A) {If (override do_something = this-> get_override ("do_something")) {do_something (A); Return; } And {b :: what_group (a); }} Zero default_ do_something (A and A) {it-> B :: What_Group (A); }}; BOOST_PYTHON_MODULE (some modules) {class_ & lt; A, Promotion: Non-Cocaable & gt; ("a"); Class_ & lt; BWrap, Promotion: Non-Coccalable & gt; ("B"). F ("dot_group", & amp; b :: dots_groups, and bwp :: default_d_sms); }
import some module class BDerived (SomeModule.B): Def do_something (auto, A): pass
try {py :: Object main = py :: import ("__ main__"); \ Py :: Object Global (main.tv ("___director")); \ Py :: object result = py :: exec_file ("test.py", global, global); \ Py :: object pluginClass = global ["BDerived"]; \ Py :: object plugin_base = pluginClass (); \ B & amp; Plugin = P :: Extract & lt; B & gt; (Plugin_base) BOOST_EXTRACT_WORKAROUND; AA; B.do_something (a); } Hold (py :: error_already_set) {PyErr_Print (); }
Type torre: No to_python (by-value) converter for type C ++ was found: A
A is not derived from
boost :: noncopyable , the code runs without error, but the logic < A> code_something (A & A) function copied during the call, even if it has been passed from context.
A because there is only one reason. .
bO_assembly (a); to
b.do_something (boost: ref (a)); .
Comments
Post a Comment