Class: Hakuban::ObjectDescriptorEventQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/hakuban/event-queue.rb

Instance Method Summary collapse

Constructor Details

#initialize(contract) ⇒ ObjectDescriptorEventQueue

Returns a new instance of ObjectDescriptorEventQueue.



47
48
49
50
51
52
53
54
55
# File 'lib/hakuban/event-queue.rb', line 47

def initialize(contract)
	@contract = contract
	@queue = Queue.new
	@ffi_callback = proc { |descriptor, action|
		@queue << Hakuban::Event.new(action: action, descriptor: descriptor)
	}
	@ffi_events = @contract.new_callback_event_queue
	@ffi_events.callback_register(&@ffi_callback)
end

Instance Method Details

#closeObject



69
70
71
# File 'lib/hakuban/event-queue.rb', line 69

def close
	@queue.close
end

#next_changeObject



64
65
66
# File 'lib/hakuban/event-queue.rb', line 64

def next_change
	@queue.pop
end

#next_eventObject



63
# File 'lib/hakuban/event-queue.rb', line 63

def next_event; next_change; end