Class: Babeltrace2::BTMessageIteratorClass

Inherits:
BTSharedObject show all
Defined in:
lib/babeltrace2/graph/message-iterator-class.rb

Constant Summary collapse

CanSeekBeginningMethodStatus =
BTMessageIteratorClassCanSeekBeginningMethodStatus
CanSeekNSFromOriginMethodStatus =
BTMessageIteratorClassCanSeekNSFromOriginMethodStatus
InitializeMethodStatus =
BTMessageIteratorClassInitializeMethodStatus
NextMethodStatus =
BTMessageIteratorClassNextMethodStatus
SeekBeginningMethodStatus =
BTMessageIteratorClassSeekBeginningMethodStatus
SeekNSFromOriginMethodStatus =
BTMessageIteratorClassSeekNSFromOriginMethodStatus
SetMethodStatus =
BTMessageIteratorClassSetMethodStatus

Instance Attribute Summary

Attributes inherited from BTObject

#handle

Instance Method Summary collapse

Methods inherited from BTSharedObject

inherited

Methods inherited from BTObject

#==, #to_ptr

Constructor Details

#initialize(handle = nil, retain: true, auto_release: true, next_method: nil) ⇒ BTMessageIteratorClass

Returns a new instance of BTMessageIteratorClass.



302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 302

def initialize(handle = nil, retain: true, auto_release: true,
               next_method: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    raise ArgumentError, "invalid value for next_method" unless next_method
    next_method = Babeltrace2._wrap_message_iterator_class_next_method(next_method)
    handle = Babeltrace2.bt_message_iterator_class_create(next_method)
    raise Babeltrace2.process_error if handle.null?
    Babeltrace2._callbacks[handle.to_i][:next_method] = next_method
    super(handle, retain: false)
  end
end

Instance Method Details

#finalize_method=(method) ⇒ Object



323
324
325
326
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 323

def finalize_method=(method)
  set_finalize_method(method)
  method
end

#initialize_method=(method) ⇒ Object



335
336
337
338
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 335

def initialize_method=(method)
  set_initialize_method(method)
  method
end

#seek_beginning_method=(seek_method) ⇒ Object



352
353
354
355
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 352

def seek_beginning_method=(seek_method)
  set_seek_beginning_methods(seek_method)
  seek_method
end

#seek_ns_from_origin_method=(seek_method) ⇒ Object



369
370
371
372
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 369

def seek_ns_from_origin_method=(seek_method)
  set_seek_ns_from_origin_methods(seek_method)
  seek_method
end

#set_finalize_method(method) ⇒ Object



316
317
318
319
320
321
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 316

def set_finalize_method(method)
  method = Babeltrace2._wrap_message_iterator_class_finalize_method(@handle, method)
  res = Babeltrace2.bt_message_iterator_class_set_finalize_method(@handle, method)
  raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_initialize_method(method) ⇒ Object



328
329
330
331
332
333
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 328

def set_initialize_method(method)
  method = Babeltrace2._wrap_message_iterator_class_initialize_method(@handle, method)
  res = Babeltrace2.bt_message_iterator_class_set_initialize_method(@handle, method)
  raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_seek_beginning_methods(seek_method, can_seek_method: nil) ⇒ Object



340
341
342
343
344
345
346
347
348
349
350
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 340

def set_seek_beginning_methods(seek_method, can_seek_method: nil)
  seek_method = Babeltrace2._wrap_message_iterator_class_seek_beginning_method(
                  @handle, seek_method)
  can_seek_method =
    Babeltrace2._wrap_message_iterator_class_can_seek_beginning_method(
      @handle, can_seek_method) if can_seek_method
  res = Babeltrace2.bt_message_iterator_class_set_seek_beginning_methods(
    @handle, seek_method, can_seek_method)
  raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_seek_ns_from_origin_methods(seek_method, can_seek_method: nil) ⇒ Object



357
358
359
360
361
362
363
364
365
366
367
# File 'lib/babeltrace2/graph/message-iterator-class.rb', line 357

def set_seek_ns_from_origin_methods(seek_method, can_seek_method: nil)
  seek_method = Babeltrace2._wrap_message_iterator_class_seek_ns_from_origin_method(
                  @handle, seek_method)
  can_seek_method =
    Babeltrace2._wrap_message_iterator_class_can_seek_ns_from_origin_method(
      @handle, can_seek_method) if can_seek_method
  res = Babeltrace2.bt_message_iterator_class_set_seek_ns_from_origin_methods(
    @handle, seek_method, can_seek_method)
  raise Babeltrace2.process_error(res) if res != :BT_MESSAGE_ITERATOR_CLASS_SET_METHOD_STATUS_OK
  self
end