Class: Babeltrace2::BTFieldClass::Array::Static

Inherits:
Babeltrace2::BTFieldClass::Array 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::Array

#get_element_field_class

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, element_field_class: nil, length: nil) ⇒ Static

Returns a new instance of Static.



836
837
838
839
840
841
842
843
844
845
846
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 836

def initialize(handle = nil, retain: true, auto_release: true,
               trace_class: nil, element_field_class: nil, length: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    handle = Babeltrace2.bt_field_class_array_static_create(
               trace_class, element_field_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



860
861
862
863
864
865
866
867
868
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 860

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

Instance Method Details

#get_lengthObject Also known as: length, size



848
849
850
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 848

def get_length
  Babeltrace2.bt_field_class_array_static_get_length(@handle)
end

#to_hObject



854
855
856
857
858
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 854

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