Re: [pygccxml-development] Status of code inserters
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <ba...@ir...> - 2006-09-07 15:30:31
|
Allen Bierbaum wrote: > Sounds like a well thought out plan to me. I would be more then happy > to help test it out once you have it implemented and integrated into py++. If you still want to do some initial tests you could do so with the current svn version. However, only public (non-pure) virtual member functions currently support the function transformers, all other member types ignore them. There's no convenience method to add transformers to the decl_wrapper so you just have to manipulate the new list attribute "function_transformers" directly. Example: image.member_function("get_size").function_transformers.extend([output_t(1), output_t(2)]) The attribute "function_transformers" is just a list that contains all transformers/policies that should be applied. For the time being you also have to import the transformer objects explicitly: from pyplusplus.function_transformers.arg_policies import * After that, the following four policies are available: - output_t(index): Argument index (1-based) is an output variable Example: C++: void getValue(int& v) or void getValue(int* v) Policy: output_t(1) -> Python: v = getValue() - input_t(index): Argument index is an input variable Example: C++: void setValue(int& v) or void setValue(int* v) Policy: input_t(1) -> Python: setValue(v) - input_array_t(index, size): Handles an input array of a fixed size. Example: C++: void setVec3(double* v) Policy: input_array_t(1,3) -> Python: setVec3([x,y,z]) - output_array_t(index, size): Handles an output array of a fixed size. Example: C++: void getVec3(double* v) Policy: output_array_t(1,3) -> Python: x,y,z = getVec3() - Matthias - |