Class: LLDB::Listener
- Inherits:
-
Object
- Object
- LLDB::Listener
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/listener.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name = nil, context: nil, pointer: nil) ⇒ Listener
constructor
A new instance of Listener.
- #next_event ⇒ Object
- #peek_event ⇒ Object
- #start_listening_for_events(broadcaster, event_mask) ⇒ Object
- #stop_listening_for_events(broadcaster, event_mask) ⇒ Object
- #to_ptr ⇒ Object
- #valid? ⇒ Boolean
- #wait_for_event(timeout_seconds: 0) ⇒ Object
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object
Constructor Details
#initialize(name = nil, context: nil, pointer: nil) ⇒ Listener
Returns a new instance of Listener.
13 14 15 16 17 18 19 20 |
# File 'lib/lldb/listener.rb', line 13 def initialize(name = nil, context: nil, pointer: nil) ptr = pointer || FFIBindings.lldb_listener_create(name) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_listener_destroy(released) }, context: context ) end |
Class Method Details
.from_ptr(ptr, context: nil) ⇒ Object
25 26 27 |
# File 'lib/lldb/listener.rb', line 25 def self.from_ptr(ptr, context: nil) new(context: context, pointer: ptr) end |
Instance Method Details
#next_event ⇒ Object
66 67 68 69 |
# File 'lib/lldb/listener.rb', line 66 def next_event ensure_open! event_from_ptr(FFIBindings.lldb_listener_next_event(@ptr)) end |
#peek_event ⇒ Object
60 61 62 63 |
# File 'lib/lldb/listener.rb', line 60 def peek_event ensure_open! event_from_ptr(FFIBindings.lldb_listener_peek_event(@ptr)) end |
#start_listening_for_events(broadcaster, event_mask) ⇒ Object
37 38 39 40 |
# File 'lib/lldb/listener.rb', line 37 def start_listening_for_events(broadcaster, event_mask) ensure_open! FFIBindings.lldb_listener_start_listening_for_events(@ptr, broadcaster.to_ptr, event_mask) end |
#stop_listening_for_events(broadcaster, event_mask) ⇒ Object
45 46 47 48 |
# File 'lib/lldb/listener.rb', line 45 def stop_listening_for_events(broadcaster, event_mask) ensure_open! FFIBindings.lldb_listener_stop_listening_for_events(@ptr, broadcaster.to_ptr, event_mask) != 0 end |
#to_ptr ⇒ Object
72 73 74 |
# File 'lib/lldb/listener.rb', line 72 def to_ptr @ptr end |
#valid? ⇒ Boolean
30 31 32 |
# File 'lib/lldb/listener.rb', line 30 def valid? !@ptr.null? && FFIBindings.lldb_listener_is_valid(@ptr) != 0 end |
#wait_for_event(timeout_seconds: 0) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/lldb/listener.rb', line 52 def wait_for_event(timeout_seconds: 0) ensure_open! timeout = normalize_timeout(timeout_seconds) event_ptr = FFIBindings.lldb_listener_wait_for_event(@ptr, timeout) event_from_ptr(event_ptr) end |