I am trying to create a Ruby wrapper for dynamic *.so library which deals with image processing. One of the functions convert_x_to_z
has a custom typedef input parameter. How can I pass in the vector of A
objects if I mapped the A
struct
typedef struct image {
uint16_t image_width;
uint16_t image_height;
uint16_t image_depth;
uint8_t* data;
} A;
into a FFI:Structure
like this
class A < FFI::Struct
layout :image_width , :int,
:image_height, :int,
:image_depth, :int,
:data, :pointer
end
Suppose I have a variable single
which is a instance of class A. How can I wrap this into an array of class B, which will represent the vector/array of classes A
and pass it as a parameter const B &x
to the function int32_t convert_x_to_z
?
int32_t convert_x_to_z(
const B &x,
uint32_t &t,
uint8_t* z);
This is the B
vector or array struct of A
class.
typedef std::vector<A> B;