Module: Babeltrace2Gen::BTLocator
- Included in:
- BTEnvironmentClass, BTEventClass, BTFieldClass, BTMemberClass, BTStreamClass, BTTraceClass
- Defined in:
- lib/metababel/bt2_trace_class_generator.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#variable ⇒ Object
readonly
Returns the value of attribute variable.
Instance Method Summary collapse
- #rec_event_class ⇒ Object
- #rec_member_class ⇒ Object
- #rec_stream_class ⇒ Object
- #rec_trace_class ⇒ Object
- #resolve_path(path) ⇒ Object
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
30 31 32 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 30 def parent @parent end |
#variable ⇒ Object (readonly)
Returns the value of attribute variable.
30 31 32 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 30 def variable @variable end |
Instance Method Details
#rec_event_class ⇒ Object
40 41 42 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 40 def rec_event_class is_a?(Babeltrace2Gen::BTEventClass) ? self : @parent.rec_event_class end |
#rec_member_class ⇒ Object
44 45 46 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 44 def rec_member_class is_a?(Babeltrace2Gen::BTMemberClass) ? self : @parent.rec_member_class end |
#rec_stream_class ⇒ Object
36 37 38 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 36 def rec_stream_class is_a?(Babeltrace2Gen::BTStreamClass) ? self : @parent.rec_stream_class end |
#rec_trace_class ⇒ Object
32 33 34 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 32 def rec_trace_class is_a?(Babeltrace2Gen::BTTraceClass) ? self : @parent.rec_trace_class end |
#resolve_path(path) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/metababel/bt2_trace_class_generator.rb', line 48 def resolve_path(path) root, id = path.match(/^(PACKET_CONTEXT|EVENT_COMMON_CONTEXT|EVENT_SPECIFIC_CONTEXT|EVENT_PAYLOAD)\["?(.+)?"\]/).captures field_class = case root when 'PACKET_CONTEXT' rec_stream_class.packet_context_field_class when 'EVENT_COMMON_CONTEXT' rec_stream_class.event_common_context_field_class when 'EVENT_SPECIFIC_CONTEXT' rec_event_class.specific_context_field_class when 'EVENT_PAYLOAD' rec_event_class.payload_field_class else raise "invalid path #{path}" end [field_class, id] end |