Class: Babeltrace2::BTHandle

Inherits:
FFI::Pointer
  • Object
show all
Extended by:
FFI::DataConverter
Defined in:
lib/babeltrace2/types.rb

Class Method Summary collapse

Class Method Details

.from_native(value, context) ⇒ Object



10
11
12
# File 'lib/babeltrace2/types.rb', line 10

def from_native(value, context)
  new(value) #value.null? ? nil : new(value)
end

.native_typeObject



6
7
8
# File 'lib/babeltrace2/types.rb', line 6

def native_type
  FFI::Type::POINTER
end

.to_native(value, context) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/babeltrace2/types.rb', line 14

def to_native(value, context)
  unless value.nil?
    p = value.to_ptr
    raise "invalid type #{p.class}, expected #{self}" unless p.kind_of?(self)
    p
  else
    nil
  end
end