Class: Babeltrace2Gen::BTFieldClass::Array::Static

Inherits:
Babeltrace2Gen::BTFieldClass::Array show all
Extended by:
Babeltrace2Gen::BTFromH
Defined in:
lib/metababel/bt2_trace_class_generator.rb

Constant Summary

Constants inherited from Babeltrace2Gen::BTFieldClass

BT_MATCH_ATTRS

Constants included from Babeltrace2Gen::BTPrinter

Babeltrace2Gen::BTPrinter::INDENT_INCREMENT

Instance Attribute Summary collapse

Attributes inherited from Babeltrace2Gen::BTFieldClass::Array

#element_field_class

Attributes inherited from Babeltrace2Gen::BTFieldClass

#cast_type, #cast_type_is_struct, #type

Attributes included from Babeltrace2Gen::BTLocator

#parent, #variable

Instance Method Summary collapse

Methods included from Babeltrace2Gen::BTFromH

from_h

Methods inherited from Babeltrace2Gen::BTFieldClass

#bt_get_variable, from_h, #get_getter, #get_setter

Methods included from Babeltrace2Gen::BTMatch

#match?

Methods included from Babeltrace2Gen::BTPrinter

context, #name_sanitized, pr, #scope

Methods included from Babeltrace2Gen::BTLocator

#rec_event_class, #rec_menber_class, #rec_stream_class, #rec_trace_class, #resolve_path

Constructor Details

#initialize(parent:, element_field_class:, length:) ⇒ Static

Returns a new instance of Static.



637
638
639
640
# File 'lib/metababel/bt2_trace_class_generator.rb', line 637

def initialize(parent:, element_field_class:, length:)
  @length = length
  super(parent: parent, element_field_class: element_field_class)
end

Instance Attribute Details

#lengthObject (readonly)

Returns the value of attribute length.



635
636
637
# File 'lib/metababel/bt2_trace_class_generator.rb', line 635

def length
  @length
end

Instance Method Details

#get_declarator(trace_class:, variable:) ⇒ Object



642
643
644
645
646
647
648
649
# File 'lib/metababel/bt2_trace_class_generator.rb', line 642

def get_declarator(trace_class:, variable:)
  element_field_class_variable = "#{variable}_field_class"
  scope do
    pr "bt_field_class *#{element_field_class_variable};"
    @element_field_class.get_declarator(trace_class: trace_class, variable: element_field_class_variable)
    pr "#{variable} = bt_field_class_array_static_create(#{trace_class}, #{element_field_class_variable}, #{@length});"
  end
end