Class: Proj::Api::PjAxisDescription
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Proj::Api::PjAxisDescription
- Defined in:
- lib/api/proj.rb,
lib/proj/pj_axis_description.rb
Instance Attribute Summary collapse
-
#retained_ptrs ⇒ Object
Returns the value of attribute retained_ptrs.
Class Method Summary collapse
Instance Method Summary collapse
-
#put_string(field, value) ⇒ Object
Write a string into a :string field and retain the pointer to prevent GC.
Instance Attribute Details
#retained_ptrs ⇒ Object
Returns the value of attribute retained_ptrs.
4 5 6 |
# File 'lib/proj/pj_axis_description.rb', line 4 def retained_ptrs @retained_ptrs end |
Class Method Details
.create(name:, abbreviation:, direction:, unit_name:, unit_conv_factor:, unit_type:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/proj/pj_axis_description.rb', line 6 def self.create(name:, abbreviation:, direction:, unit_name:, unit_conv_factor:, unit_type:) result = PjAxisDescription.new result.retained_ptrs = [] result.put_string(:name, name) result.put_string(:abbreviation, abbreviation) result.put_string(:direction, direction) result.put_string(:unit_name, unit_name) result[:unit_conv_factor] = unit_conv_factor result[:unit_type] = unit_type result end |
Instance Method Details
#put_string(field, value) ⇒ Object
Write a string into a :string field and retain the pointer to prevent GC.
19 20 21 22 23 |
# File 'lib/proj/pj_axis_description.rb', line 19 def put_string(field, value) ptr = FFI::MemoryPointer.from_string(value) @retained_ptrs << ptr pointer.put_pointer(offset_of(field), ptr) end |