Class: FFI::StructByReference
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
DataConverter
|
|
| Inherits: | Object |
| Defined in: | lib/ffi/struct_by_reference.rb |
Overview
This class includes the DataConverter module.
Class Method Summary
- .new(struct_class) ⇒ StructByReference constructor
Instance Attribute Summary
- #struct_class readonly
Instance Method Summary
-
#from_native(value, ctx) ⇒ Struct
Create a struct from content of memory
value. -
#native_type(_type = nil)
Always get
Type::POINTER. - #to_native(value, ctx) ⇒ AbstractMemory
DataConverter - Included
| #from_native | Convert from a native type. |
| #native_type | Get native type. |
| #to_native | Convert to a native type. |
Constructor Details
.new(struct_class) ⇒ StructByReference
# File 'lib/ffi/struct_by_reference.rb', line 39
def initialize(struct_class) unless Class === struct_class and struct_class < FFI::Struct raise TypeError, 'wrong type (expected subclass of FFI::Struct)' end @struct_class = struct_class end
Instance Attribute Details
#struct_class (readonly)
[ GitHub ]# File 'lib/ffi/struct_by_reference.rb', line 36
attr_reader :struct_class
Instance Method Details
#from_native(value, ctx) ⇒ Struct
Create a struct from content of memory value.
# File 'lib/ffi/struct_by_reference.rb', line 68
def from_native(value, ctx) @struct_class.new(value) end
#native_type(_type = nil)
Always get Type::POINTER.