Class: Babeltrace2::BTMessage::Event

Inherits:
Babeltrace2::BTMessage show all
Defined in:
lib/babeltrace2/graph/message.rb

Constant Summary

Constants inherited from Babeltrace2::BTMessage

StreamClockSnapshotState, Type

Instance Attribute Summary

Attributes inherited from Babeltrace2::BTObject

#handle

Instance Method Summary collapse

Methods inherited from Babeltrace2::BTMessage

from_handle, #get_type

Methods inherited from Babeltrace2::BTSharedObject

inherited

Methods inherited from Babeltrace2::BTObject

#==, #to_ptr

Constructor Details

#initialize(handle = nil, retain: true, auto_release: true, self_message_iterator: nil, event_class: nil, stream: nil, clock_snapshot_value: nil, packet: nil) ⇒ Event



269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/babeltrace2/graph/message.rb', line 269

def initialize(handle = nil, retain: true, auto_release: true,
               self_message_iterator: nil, event_class: nil, stream: nil,
               clock_snapshot_value: nil, packet: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    handle = if clock_snapshot_value
        if packet
          Babeltrace2.bt_message_event_create_with_packet_and_default_clock_snapshot(
            self_message_iterator, event_class, packet, clock_snapshot_value)
        else
          Babeltrace2.bt_message_event_create_with_default_clock_snapshot(
            self_message_iterator, event_class, stream, clock_snapshot_value)
        end
      else
        if packet
          Babeltrace2.bt_message_event_create_with_packet(
            self_message_iterator, event_class, packet)
        else
          Babeltrace2.bt_message_event_create(
            self_message_iterator, event_class, stream)
        end
      end
    raise Babeltrace2.process_error if handle.null?
    super(handle)
  end
end

Instance Method Details

#get_default_clock_snapshotObject Also known as: default_clock_snapshot



303
304
305
306
# File 'lib/babeltrace2/graph/message.rb', line 303

def get_default_clock_snapshot
  handle = Babeltrace2.bt_message_event_borrow_default_clock_snapshot_const(@handle)
  BTClockSnapshot.new(handle)
end

#get_eventObject Also known as: event



297
298
299
300
# File 'lib/babeltrace2/graph/message.rb', line 297

def get_event
  handle = Babeltrace2.bt_message_event_borrow_event(@handle)
  BTEvent.new(handle)
end

#get_stream_class_default_clock_classObject Also known as: stream_class_default_clock_class



309
310
311
312
# File 'lib/babeltrace2/graph/message.rb', line 309

def get_stream_class_default_clock_class
  handle = Babeltrace2.bt_message_event_borrow_stream_class_default_clock_class_const(@handle)
  BTClockClass.new(handle, retain: true, auto_release: true)
end