Class: Babeltrace2Gen::BTTraceClass
- Inherits:
-
Object
- Object
- Babeltrace2Gen::BTTraceClass
- Extended by:
- BTFromH
- Defined in:
- lib/metababel/bt2_trace_class_generator.rb
Overview
__ _ _ _
| ___ \_ _| / __ \ |
| |_/ / | | | / \/ | __ _ ___ ___ ___ ___
| ___ \ | | | | | |/ _` / __/ __|/ _ \/ __|
| |_/ / | | | \__/\ | (_| \__ \__ \ __/\__ \
\____/ \_/ \____/_|\__,_|___/___/\___||___/
Constant Summary collapse
- BT_MATCH_ATTRS =
[:environment]
Constants included from BTPrinter
Babeltrace2Gen::BTPrinter::INDENT_INCREMENT
Instance Attribute Summary collapse
-
#assigns_automatic_stream_class_id ⇒ Object
readonly
Returns the value of attribute assigns_automatic_stream_class_id.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#stream_classes ⇒ Object
readonly
Returns the value of attribute stream_classes.
Attributes included from BTLocator
Instance Method Summary collapse
- #get_declarator(variable:, self_component:) ⇒ Object
-
#initialize(parent:, stream_classes:, environment: nil, assigns_automatic_stream_class_id: nil, match: false) ⇒ BTTraceClass
constructor
A new instance of BTTraceClass.
Methods included from BTFromH
Methods included from BTMatch
Methods included from BTUtils
Methods included from BTPrinter
context, #name_sanitized, pr, #scope
Methods included from BTLocator
#rec_event_class, #rec_member_class, #rec_stream_class, #rec_trace_class, #resolve_path
Constructor Details
#initialize(parent:, stream_classes:, environment: nil, assigns_automatic_stream_class_id: nil, match: false) ⇒ BTTraceClass
Returns a new instance of BTTraceClass.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 85 def initialize(parent:, stream_classes:, environment: nil, assigns_automatic_stream_class_id: nil, match: false) raise if parent # match indicate if this model will be used to match another. @match = match @parent = nil @assigns_automatic_stream_class_id = assigns_automatic_stream_class_id @environment = BTEnvironmentClass.from_h(self, environment) if environment @stream_classes = stream_classes.collect.with_index do |m, i| if m[:id].nil? != (@assigns_automatic_stream_class_id.nil? || @assigns_automatic_stream_class_id) raise "Incoherence between trace::assigns_automatic_stream_class_id and stream_class[#{i}]::id" end BTStreamClass.from_h(self, m) end end |
Instance Attribute Details
#assigns_automatic_stream_class_id ⇒ Object (readonly)
Returns the value of attribute assigns_automatic_stream_class_id.
83 84 85 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 83 def assigns_automatic_stream_class_id @assigns_automatic_stream_class_id end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
83 84 85 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 83 def environment @environment end |
#match ⇒ Object (readonly)
Returns the value of attribute match.
83 84 85 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 83 def match @match end |
#stream_classes ⇒ Object (readonly)
Returns the value of attribute stream_classes.
83 84 85 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 83 def stream_classes @stream_classes end |
Instance Method Details
#get_declarator(variable:, self_component:) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 102 def get_declarator(variable:, self_component:) pr "#{variable} = bt_trace_class_create(#{self_component});" bt_set_conditionally(@assigns_automatic_stream_class_id) do |v| pr "bt_trace_class_set_assigns_automatic_stream_class_id(#{variable}, #{v});" end @stream_classes.each_with_index do |m, i| stream_class_name = "#{variable}_sc_#{i}" scope do pr "bt_stream_class *#{stream_class_name};" m.get_declarator(variable: stream_class_name, self_component: self_component, trace_class: variable) end end end |