Class: InterfaceCollectionOut
- Includes:
- Interface
- Defined in:
- lib/white_gold/abi/interface/interface_collection_out.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#call(host, name, *a) ⇒ Object
Works propertly only for single thread (like whole TGUI btw.).
-
#initialize(packer, unpacker, fiddle_type) ⇒ InterfaceCollectionOut
constructor
A new instance of InterfaceCollectionOut.
Methods included from Interface
abi_const_string_method_suffix, fiddle_type, packer_fiddle_type, parse_packer, parse_unpacker
Constructor Details
#initialize(packer, unpacker, fiddle_type) ⇒ InterfaceCollectionOut
Returns a new instance of InterfaceCollectionOut.
9 10 11 12 13 14 15 16 |
# File 'lib/white_gold/abi/interface/interface_collection_out.rb', line 9 def initialize packer, unpacker, fiddle_type @packer = packer @unpacker = unpacker # unpacking in block caller allows abi side to free memory on return eg. for strings passed by value @block_caller = Fiddle::Closure::BlockCaller.new(0, [fiddle_type]) do |a| @unpacked << @unpacker.call(@host, a) end end |
Class Method Details
.from(packer, unpacker) ⇒ Object
4 5 6 |
# File 'lib/white_gold/abi/interface/interface_collection_out.rb', line 4 def self.from packer, unpacker self.new Interface.parse_packer(packer), Interface.parse_unpacker(unpacker.min), Interface.fiddle_type(unpacker.min) end |
Instance Method Details
#call(host, name, *a) ⇒ Object
Works propertly only for single thread (like whole TGUI btw.)
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/white_gold/abi/interface/interface_collection_out.rb', line 19 def call host, name, *a a = @packer.call host, *a if @packer @host = host @unpacked = [] host.send name, *a, @block_caller unpacked = @unpacked @unpacked = nil @host = nil unpacked end |