Class: Babeltrace2Gen::BTFieldClass::Variant

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

Defined Under Namespace

Modules: WithSelectorField, WithoutSelectorField Classes: Option

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

#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_declarator, #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_member_class, #rec_stream_class, #rec_trace_class, #resolve_path

Constructor Details

#initialize(parent:, options:, selector_field_class: nil) ⇒ Variant

Returns a new instance of Variant.



952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
# File 'lib/metababel/bt2_trace_class_generator.rb', line 952

def initialize(parent:, options:, selector_field_class: nil)
  @parent = parent
  if selector_field_class
    extend(WithSelectorField)
    @selector_field_class = selector_field_class
    @options = options.collect do |o|
      BTFieldClass::Variant::WithSelectorField::Option.new(name: o[:name], field_class: o[:field_class],
                                                           range: o[:range])
    end
  else
    extend(WithoutSelectorField)
    @options = options.collect do |o|
      BTFieldClass::Variant::Option.new(name: o[:name], field_class: o[:field_class])
    end
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



924
925
926
# File 'lib/metababel/bt2_trace_class_generator.rb', line 924

def options
  @options
end