Class: Babeltrace2::BTFieldClass::BitArray

Inherits:
Babeltrace2::BTFieldClass show all
Defined in:
lib/babeltrace2/trace-ir/field-class.rb

Constant Summary

Constants inherited from Babeltrace2::BTFieldClass

IntegerSigned, IntegerUnsigned, RealDoublePrecision, RealSinglePrecision, TYPE_MAP

Instance Attribute Summary

Attributes inherited from Babeltrace2::BTObject

#handle

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Babeltrace2::BTFieldClass

#from_h, from_handle, #get_type, #get_user_attributes, #set_user_attributes, #type_is, #user_attributes=

Methods inherited from Babeltrace2::BTSharedObject

inherited

Methods inherited from Babeltrace2::BTObject

#==, #to_ptr

Constructor Details

#initialize(handle = nil, retain: true, auto_release: true, trace_class: nil, length: nil) ⇒ BitArray

Returns a new instance of BitArray.



244
245
246
247
248
249
250
251
252
253
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 244

def initialize(handle = nil, retain: true, auto_release: true,
               trace_class: nil, length: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    handle = Babeltrace2.bt_field_class_bit_array_create(trace_class, length)
    raise Babeltrace2.process_error if handle.null?
    super(handle, retain: false)
  end
end

Class Method Details

.from_h(trace_class, h, stream_class_h = nil) ⇒ Object



266
267
268
269
270
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 266

def self.from_h(trace_class, h, stream_class_h = nil)
  o = self.new(trace_class: trace_class, length: h[:length]).from_h(h)
  h[:bt_field_class] = o
  o
end

Instance Method Details

#get_lengthObject Also known as: length



255
256
257
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 255

def get_length
  Babeltrace2.bt_field_class_bit_array_get_length(@handle)
end

#to_hObject



260
261
262
263
264
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 260

def to_h
  res = super
  res[:length] = length
  res
end