Class: FFI::StructByValue
Constant Summary
Constants inherited from Type
Instance Method Summary collapse
Methods inherited from Type
Constructor Details
#initialize(rbStructClass) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'ext/ffi_c/StructByValue.c', line 92
static VALUE
sbv_initialize(VALUE self, VALUE rbStructClass)
{
StructByValue* sbv = NULL;
StructLayout* layout = NULL;
VALUE rbLayout = Qnil;
rbLayout = rb_ivar_get(rbStructClass, rb_intern("@layout"));
if (!rb_obj_is_instance_of(rbLayout, rbffi_StructLayoutClass)) {
rb_raise(rb_eTypeError, "wrong type in @layout ivar (expected FFI::StructLayout)");
}
TypedData_Get_Struct(rbLayout, StructLayout, &rbffi_struct_layout_data_type, layout);
TypedData_Get_Struct(self, StructByValue, &sbv_type_data_type, sbv);
RB_OBJ_WRITE(self, &sbv->rbStructClass, rbStructClass);
RB_OBJ_WRITE(self, &sbv->rbStructLayout, rbLayout);
/* We can just use everything from the ffi_type directly */
*sbv->base.ffiType = *layout->base.ffiType;
return self;
}
|
Instance Method Details
#layout ⇒ Object
146 147 148 149 150 151 152 153 |
# File 'ext/ffi_c/StructByValue.c', line 146
static VALUE
sbv_layout(VALUE self)
{
StructByValue* sbv;
TypedData_Get_Struct(self, StructByValue, &sbv_type_data_type, sbv);
return sbv->rbStructLayout;
}
|
#struct_class ⇒ Object
155 156 157 158 159 160 161 162 163 |
# File 'ext/ffi_c/StructByValue.c', line 155
static VALUE
sbv_struct_class(VALUE self)
{
StructByValue* sbv;
TypedData_Get_Struct(self, StructByValue, &sbv_type_data_type, sbv);
return sbv->rbStructClass;
}
|