This sub-package implements function transformation functionality
defines controller classes which help to define the function transformation
The idea behind implementation of “Function Transformation” functionality is simple: Py++ defines few templates. Transformers are just editors for the templates. In most cases, transformers don’t directly edit the template, but use controller classes for this purpose. Controller classes provide an abstraction of the templates.
Bases: object
base class for all controller classes
Bases: pyplusplus.function_transformers.controllers.sealed_fun_controller_t
Bases: pyplusplus.function_transformers.controllers.sealed_fun_controller_t
Bases: pyplusplus.function_transformers.controllers.virtual_mem_fun_controller_t
Bases: pyplusplus.function_transformers.controllers.controller_base_t
base class for free and member function controllers
Bases: object
defines C++ variable
| Parameters: |
|
|---|
Bases: object
function wrapper variables manager
Almost every time we define new transformer, we need to define variables. It is important to keep the variable names unique. This class will ensure this. Every time you declare new variable, it will return the unique variable name. The name will be built from the original variable name and some index, which will make the variable to be unique.
declare variable
| Parameters: |
|
|---|---|
| Returns: | the variable name, which is unique in a whole scope, based on “name” argument |
| Return type: | str |
register predefined variable name
There are use cases, where it is convenience to define variables within a template. In such cases, the only thing that should be done is registering a unique name of the variable.
Bases: pyplusplus.function_transformers.controllers.controller_base_t
Bases: pyplusplus.function_transformers.controllers.sealed_fun_controller_t
Bases: pyplusplus.function_transformers.controllers.controller_base_t
defines :class:function_transformation_t class
the class holds function transformation definition - all transformations that should be applied
defines few templates, which will be used to create a function-wrapper definition.
defines :class:transformer_t class
Bases: object
Base class for a function transformer.
| Parameter: | function – reference to function declaration |
|---|
transformers should override the method, in order to define custom transformation for free function.
| Parameter: | controller – instance of free_fun_controller_t class |
|---|
Transformers should override the method, in order to define custom transformation for non-virtual member function.
| Parameter: | controller – instance of mem_fun_controller_t class |
|---|
Transformers should override the method, in order to define custom transformation for virtual member function.
| Parameter: | controller – instance of virtual_mem_fun_controller_t class |
|---|
returns reference to the desired argument
| Parameter: | reference – name( str ) or index( int ) of the argument |
|---|
returns type of the desired argument or return type of the function
| Parameter: | reference – name( str ) or index( int ) of the argument |
|---|
defines few argument transformation classes
Bases: pyplusplus.function_transformers.transformers.type_modifier_t
Handles a single input variable.
Replaces the actual argument type with some integral type, so you could use ctypes package.
void do_something(int** image) -> do_something(unsigned int image_address)
Constructor.
The specified argument must be a reference or a pointer.
| Parameter: | arg_ref (int) – Index of the argument that is an output value |
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an input/output array with fixed size.
void do_something(double* v) -> v2 = do_something(object v2)
where v2 is a Python sequence
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an input/output matrix with fixed size.
transpose_matrix(double m[2][3]) -> m = transpose_matrix(object m) # m must be a sequence of 2 sequences of 3 floats
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles a single input/output variable.
void do_something(int& v) -> v = do_something(v)
Constructor.
The specified argument must be a reference or a pointer.
| Parameter: | arg_ref (int) – Index of the argument that is an in/out value |
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
handles an input of C buffer:
void write( byte *buffer, int size ) -> void write( python sequence )
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an input array with fixed size.
void do_something(double* v) -> do_something(object v2)
where v2 is a Python sequence
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an input matrix with fixed size.
is_identity(double m[3][3]) -> is_identity(object m) # m must be a sequence of 3 sequences of 3 floats
Constructor.
| Parameter: | rows, columns (int) – The fixed size of the input matrix |
|---|
Bases: pyplusplus.function_transformers.transformers.type_modifier_t
Handles a single input variable.
The reference on the specified variable is removed.
void set_value(int& v) -> void set_value(int v)
| Parameter: | arg_ref (int) – Index of the argument that is an input value |
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an output array of a fixed size.
void get_vec3(double* v) -> v = get_vec3() # v will be a list with 3 floats
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles an output matrix with fixed size.
get_matrix(double m[3][3]) -> m = get_matrix() # m will be a sequence of 3 sequences of 3 floats
Constructor.
| Parameters: |
|
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Handles a single output variable.
The specified variable is removed from the argument list and is turned into a return value.
void get_value(int& v) -> v = get_value()
Bases: pyplusplus.function_transformers.transformers.type_modifier_t
see http://boost.org/libs/python/doc/v2/faq.html#ownership
Constructor.
| Parameter: | arg_ref (int) – Index of the argument on which to transfer ownership |
|---|
Bases: pyplusplus.function_transformers.transformer.transformer_t
Change/modify type of the argument.
Right now compiler should be able to use implicit conversion
Constructor.
modifier is callable, which take the type of the argument and should return new type
| Parameter: | arg_ref (int) – Index of the argument which will be transformed |
|---|