Module: OklahomaMixer::Utilities

Extended by:
FFIDSL
Defined in:
lib/oklahoma_mixer/utilities.rb

Overview

:nodoc:

Defined Under Namespace

Modules: FFIDSL

Constant Summary collapse

INT_MIN =
int_min && int_min.to_i

Class Method Summary collapse

Methods included from FFIDSL

call, const, def_core_database_consts_and_funcs, def_hash_database_consts_and_funcs, def_new_and_del_funcs, extended, func, prefix, read_from_func

Class Method Details

.temp_intObject


180
181
182
183
184
185
# File 'lib/oklahoma_mixer/utilities.rb', line 180

def self.temp_int
  int = FFI::MemoryPointer.new(:int)
  yield int
ensure
  int.free if int
end

.temp_list(size) ⇒ Object


194
195
196
197
198
199
# File 'lib/oklahoma_mixer/utilities.rb', line 194

def self.temp_list(size)
  list = ArrayList.new(size)
  yield list
ensure
  list.free if list
end

.temp_mapObject


201
202
203
204
205
206
# File 'lib/oklahoma_mixer/utilities.rb', line 201

def self.temp_map
  map = HashMap.new
  yield map
ensure
  map.free if map
end

.temp_pointer(size) ⇒ Object


173
174
175
176
177
178
# File 'lib/oklahoma_mixer/utilities.rb', line 173

def self.temp_pointer(size)
  pointer = FFI::MemoryPointer.new(:pointer, size)
  yield pointer
ensure
  pointer.free if pointer
end

.temp_xstrObject


187
188
189
190
191
192
# File 'lib/oklahoma_mixer/utilities.rb', line 187

def self.temp_xstr
  xstr = ExtensibleString.new
  yield xstr
ensure
  xstr.free if xstr
end