Class: Sigma::UnsignedInputs

Inherits:
Object
  • Object
show all
Extended by:
FFI::Library
Defined in:
lib/sigma/input.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#pointerObject

Returns the value of attribute pointer.



204
205
206
# File 'lib/sigma/input.rb', line 204

def pointer
  @pointer
end

Class Method Details

.createObject



210
211
212
213
214
215
# File 'lib/sigma/input.rb', line 210

def self.create
  pointer = FFI::MemoryPointer.new(:pointer)
  ergo_lib_unsigned_inputs_new(pointer)

  init(pointer)
end

.with_raw_pointer(unread_pointer) ⇒ Object



206
207
208
# File 'lib/sigma/input.rb', line 206

def self.with_raw_pointer(unread_pointer)
  init(unread_pointer)
end

Instance Method Details

#add(unsigned_input) ⇒ Object



221
222
223
# File 'lib/sigma/input.rb', line 221

def add(unsigned_input)
  ergo_lib_unsigned_inputs_add(unsigned_input.pointer, self.pointer)
end

#get(index) ⇒ Object



225
226
227
228
229
230
231
232
233
234
# File 'lib/sigma/input.rb', line 225

def get(index)
  pointer = FFI::MemoryPointer.new(:pointer)
  res = ergo_lib_unsigned_inputs_get(self.pointer, index, pointer)
  Util.check_error!(res[:error])
  if res[:is_some]
    Sigma::UnsignedInput.with_raw_pointer(pointer)
  else
    nil
  end
end

#lenObject



217
218
219
# File 'lib/sigma/input.rb', line 217

def len
  ergo_lib_unsigned_inputs_len(self.pointer)
end